systemctl start postgresql-10 第一次启动报错
版本
# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
# yum list installed |grep -i postgresql
postgresql10.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-contrib.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-devel.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-docs.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-libs.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-odbc.x86_64 13.00.0000-1PGDG.rhel7 @pgdg10
postgresql10-plperl.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-plpython.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-plpython3.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-pltcl.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-server.x86_64 10.17-1PGDG.rhel7 @pgdg10
postgresql10-tcl.x86_64 2.7.5-1.rhel7 @pgdg10
postgresql10-test.x86_64 10.17-1PGDG.rhel7 @pgdg10
启动报错
# systemctl start postgresql-10
Job for postgresql-10.service failed because the control process exited with error code. See "systemctl status postgresql-10.service" and "journalctl -xe" for details.
# systemctl status postgresql-10.service
● postgresql-10.service - PostgreSQL 10 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2021-06-22 09:45:06 CST; 20s ago
Docs: https://www.postgresql.org/docs/10/static/
Process: 14252 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Jun 22 09:45:06 xxoo systemd[1]: Starting PostgreSQL 10 database server...
Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service: control process exited, code=exited status=1
Jun 22 09:45:06 xxoo systemd[1]: Failed to start PostgreSQL 10 database server.
Jun 22 09:45:06 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service failed.
# journalctl -xe
Jun 22 09:43:15 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
Jun 22 09:43:15 xxoo systemd[1]: postgresql-10.service failed.
Jun 22 09:43:15 xxoo polkitd[2741]: Unregistered Authentication Agent for unix-process:14204:82813 (system bus name :1.77, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, local
Jun 22 09:44:29 xxoo systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Jun 22 09:44:29 xxoo systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.
Jun 22 09:45:06 xxoo polkitd[2741]: Registered Authentication Agent for unix-process:14245:93949 (system bus name :1.78 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/free
Jun 22 09:45:06 xxoo systemd[1]: Starting PostgreSQL 10 database server...
-- Subject: Unit postgresql-10.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-10.service has begun starting up.
Jun 22 09:45:06 xxoo postgresql-10-check-db-dir[14252]: "/var/lib/pgsql/10/data/" is missing or empty.
Jun 22 09:45:06 xxoo postgresql-10-check-db-dir[14252]: Use "/usr/pgsql-10/bin/postgresql-10-setup initdb" to initialize the database cluster.
Jun 22 09:45:06 xxoo postgresql-10-check-db-dir[14252]: See /usr/share/doc/postgresql10-10.17/README.rpm-dist for more information.
Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service: control process exited, code=exited status=1
Jun 22 09:45:06 xxoo systemd[1]: Failed to start PostgreSQL 10 database server.
-- Subject: Unit postgresql-10.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-10.service has failed.
--
-- The result is failed.
Jun 22 09:45:06 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service failed.
Jun 22 09:45:06 xxoo polkitd[2741]: Unregistered Authentication Agent for unix-process:14245:93949 (system bus name :1.78, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, local
lines 1282-1320/1320 (END)
“/var/lib/pgsql/10/data/” is missing or empty.
好吧,没有初始化
初始化
# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database ... OK
# systemctl start postgresql-10
#
#
# systemctl status postgresql-10
● postgresql-10.service - PostgreSQL 10 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2021-06-22 09:54:41 CST; 9s ago
Docs: https://www.postgresql.org/docs/10/static/
Process: 14447 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 14453 (postmaster)
CGroup: /system.slice/postgresql-10.service
├─14453 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
├─14459 postgres: logger process
├─14463 postgres: checkpointer process
├─14464 postgres: writer process
├─14465 postgres: wal writer process
├─14466 postgres: autovacuum launcher process
├─14467 postgres: stats collector process
└─14468 postgres: bgworker: logical replication launcher
Jun 22 09:54:41 xxoo systemd[1]: Starting PostgreSQL 10 database server...
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.579 CST [14453] LOG: listening on IPv4 address "127.0.0.1", port 5432
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.581 CST [14453] LOG: could not create IPv6 socket for address "::1": Address family not supported by protocol
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.585 CST [14453] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.592 CST [14453] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.608 CST [14453] LOG: redirecting log output to logging collector process
Jun 22 09:54:41 xxoo postmaster[14453]: 2021-06-22 09:54:41.608 CST [14453] HINT: Future log output will appear in directory "log".
Jun 22 09:54:41 xxoo systemd[1]: Started PostgreSQL 10 database server.
正常
还没有评论,来说两句吧...