I am using postgresql in Debian. The postgresql service cannot start after editing the configuration file:
#data_directory = '/var/lib/postgresql/9.4/main'
(yes, I just use a custom directory instead of the default data_directory file)
I found the log in /var/log/syslog
Sep 14 10:22:17 thinkserver-ckd postgresql@9.4-main [11324]: Error: could not exec /usr/lib/postgresql/9.4/bin/pg_ctl /usr/lib/postgresql/9.4/bin/pg_ctl start -D /opt/data/postgresql/data -l /var/log/postgresql/postgresql-9.4-main.log -s -o -c config_file="/etc/postgresql/9.4/main/postgresql.conf" : Sep 14 10:22:17 thinkserver-ckd systemd[1]: postgresql@9.4-main.service : control process exited, code=exited status=1 Sep 14 10:22:17 thinkserver-ckd systemd[1]: Failed to start PostgreSQL Cluster 9.4-main. Sep 14 10:22:17 thinkserver-ckd systemd[1]: Unit postgresql@9.4-main.service entered failed state.
And nothing in /var/log/postgresql/postgresql-9.4-main.log
Thanks.
I finally got this answer:
What does this error mean in PostgreSQL?
@langton.
He said that
you have to run pg_upgradecluster or similar or just create a new cluster with pg_createcluster (these commands are for debian systems - you did not specify your OS)
So, I ran the command:
pg_createcluster -d /opt/data/postgresql/data -l /opt/data/postgresql/log 9.4 ckd
And then: service postgresql restart
it started!
postgresql startup datadirectory
Billy yang
source share