The following is the operation process:
[root@freelab ~]# su - postgres
Last login: Sat Jul 4 10:16:58 EDT 2020 on pts/1
-bash-4.2$ /usr/pgsql-12/bin/pg_ctl -D /postgres -l logfile start
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
-bash-4.2$
-bash-4.2$ date
Sat Jul 4 10:35:13 EDT 2020
But the log does not seem to be updated accordingly
[root@freelab log]# tail -f postgresql-Sat.log
2020年07月04日 09:23:14.930 EDT [1832] LOG: background worker "logical replication launcher" (PID 1840) exited with exit code 1
2020年07月04日 09:23:14.930 EDT [1835] LOG: shutting down
2020年07月04日 09:23:14.943 EDT [1832] LOG: received SIGHUP, reloading configuration files
2020年07月04日 09:23:14.943 EDT [1832] LOG: parameter "data_directory" cannot be changed without restarting the server
2020年07月04日 09:23:14.944 EDT [1832] LOG: configuration file "/postgres/postgresql.conf" contains errors; unaffected changes were applied
2020年07月04日 09:23:15.052 EDT [1832] LOG: database system is shut down
1 Answer 1
When restarting the server with a specific logfile (see your restart command: /usr/pgsql-12/bin/pg_ctl -D /postgres -l logfile start
) you need to look at that specific logfile, not at postgresql-Sat.log
.
Moreover, this line in the previous log shows that you modified the data directory:
2020年07月04日 09:23:14.943 EDT [1832] LOG: parameter "data_directory" cannot be changed without restarting the server
Presumably log_directory
is relative to the data directory, so after this change you need to look at the new location now to find the new logs.
From the documentation:
log_directory (string)
When logging_collector is enabled, this parameter determines the directory in which log files will be created. It can be specified as an absolute path, or relative to the cluster data directory. This parameter can only be set in the postgresql.conf file or on the server command line. The default is log.