2012-03-14 10 views
5

Volevo modificare il parametro "shared_buffers" nel mio file postgresql.conf.Avvio del server PostgreSQL non riuscito dopo la modifica di postgresql.conf utilizzando il comando sudo

Il problema è che ho usato il comando sudo e ho dato la proprietà alla radice.

-rw-rw-rw- 1 root root 13661 Mar 14 15:36 postgresql.conf 

poi ho usato il seguente comando per recuperare la proprietà al postmaster:

sudo chown postgres:postgres /var/lib/pgsql/data/postgresql.conf 

così ho provato il comando:

postgres -D /var/lib/pgsql/data 

stavo male sorpreso per ottenere ancora il seguente messaggio di errore

postgres cannot access the server configuration file "/var/lib/pgsql/data/postgresql.conf": Permission denied 

sotto id il risultato del comando "ls" nella directory realted a PostgreSQL:

sudo ls -l /var/lib/pgsql/data/ 
total 208 
drwx------ 19 postgres postgres 4096 Mar 13 17:23 base 
drwx------ 2 postgres postgres 4096 Mar 14 14:30 global 
drwx------ 2 postgres postgres 4096 Mar 5 14:26 pg_clog 
-rw------- 1 postgres postgres 3365 Mar 1 2006 pg_hba.conf 
-rw------- 1 postgres postgres 3182 Mar 1 2006 pg_hba.conf.old 
-rw------- 1 postgres postgres 1460 Feb 24 2006 pg_ident.conf 
drwx------ 2 postgres postgres 139264 Mar 14 00:00 pg_log 
drwx------ 4 postgres postgres 4096 Feb 24 2006 pg_multixact 
drwx------ 2 postgres postgres 4096 Mar 14 10:42 pg_subtrans 
drwx------ 2 postgres postgres 4096 Feb 24 2006 pg_tblspc 
drwx------ 2 postgres postgres 4096 Feb 24 2006 pg_twophase 
-rw------- 1 postgres postgres  4 Feb 24 2006 PG_VERSION 
drwx------ 3 postgres postgres 4096 Mar 14 14:30 pg_xlog 
-rw-rw-rw- 1 postgres postgres 13661 Mar 14 15:36 postgresql.conf 
-rw------- 1 postgres postgres  49 Jan 2 17:15 postmaster.opts 

Se qualcuno ha un'idea di che potrebbe essere il modo per risolvere questo problema.

Grazie in anticipo.

Fred

risposta

7

controllare come è SELinux in esecuzione:

# sestatus 

Se è nel far rispettare modalità controllare il registro:

# less /var/log/audit/audit.log 

Se trovate SELinux bloccando quindi disattivare temporaneamente SELinux solo per conferma che è il colpevole:

# setenforce 0 

Ora prova ad avviare il server. Se funziona quindi riattivare SELinux:

# setenforce 1 

Ricerca di come ripristinare le impostazioni SELinux per quel file.

+0

Grazie mille per il tuo tempo. Ho ottenuto "bash: sestatus: comando non trovato". Hai un altro suggerimento in mente? Perché sto iniziando a essere pazzo dopo un pomeriggio navigando sul web senza alcun indizio. –

+0

@Fred Dato il percorso del file ho pensato che stavi usando un sistema operativo derivato da RedHat. Qual è il sistema operativo? –

+0

Nota: Sono in RedHat Enterprise Linux WS Release 4 –

1

Ho ricevuto lo stesso errore subito dopo una nuova installazione.
Prima i bit della modalità file predefinita di tutti i file in /var/lib/pgsql/data/ sono impostati su 600 e il vostro postgresql.conf ha 666. Questo non è il problema nel caso, ma è bene mantenere le cose come sono.
Non ho familiarità con la distro RedHat ma dai commenti sembra che questo non sia un problema con SELinux.
Sul mio Fedora 20 in funzione:

$ systemctl start postgresql.service 

sembra per eseguire il server.

E se si desidera eseguire alcuni comandi in PosgtreSQL per la prima volta, ad esempio creare il proprio utente per es. potresti trovare questa domanda utile: https://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install

Problemi correlati