systemctl start postgresql-10 第一次启动报错

桃扇骨 2022-10-08 14:30 141阅读 0赞

版本

  1. # cat /etc/centos-release
  2. CentOS Linux release 7.6.1810 (Core)
  3. # yum list installed |grep -i postgresql
  4. postgresql10.x86_64 10.17-1PGDG.rhel7 @pgdg10
  5. postgresql10-contrib.x86_64 10.17-1PGDG.rhel7 @pgdg10
  6. postgresql10-devel.x86_64 10.17-1PGDG.rhel7 @pgdg10
  7. postgresql10-docs.x86_64 10.17-1PGDG.rhel7 @pgdg10
  8. postgresql10-libs.x86_64 10.17-1PGDG.rhel7 @pgdg10
  9. postgresql10-odbc.x86_64 13.00.0000-1PGDG.rhel7 @pgdg10
  10. postgresql10-plperl.x86_64 10.17-1PGDG.rhel7 @pgdg10
  11. postgresql10-plpython.x86_64 10.17-1PGDG.rhel7 @pgdg10
  12. postgresql10-plpython3.x86_64 10.17-1PGDG.rhel7 @pgdg10
  13. postgresql10-pltcl.x86_64 10.17-1PGDG.rhel7 @pgdg10
  14. postgresql10-server.x86_64 10.17-1PGDG.rhel7 @pgdg10
  15. postgresql10-tcl.x86_64 2.7.5-1.rhel7 @pgdg10
  16. postgresql10-test.x86_64 10.17-1PGDG.rhel7 @pgdg10

启动报错

  1. # systemctl start postgresql-10
  2. 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.
  3. # systemctl status postgresql-10.service
  4. postgresql-10.service - PostgreSQL 10 database server
  5. Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled)
  6. Active: failed (Result: exit-code) since Tue 2021-06-22 09:45:06 CST; 20s ago
  7. Docs: https://www.postgresql.org/docs/10/static/
  8. Process: 14252 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
  9. Jun 22 09:45:06 xxoo systemd[1]: Starting PostgreSQL 10 database server...
  10. Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service: control process exited, code=exited status=1
  11. Jun 22 09:45:06 xxoo systemd[1]: Failed to start PostgreSQL 10 database server.
  12. Jun 22 09:45:06 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
  13. Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service failed.
  14. # journalctl -xe
  15. Jun 22 09:43:15 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
  16. Jun 22 09:43:15 xxoo systemd[1]: postgresql-10.service failed.
  17. 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
  18. Jun 22 09:44:29 xxoo systemd[1]: Starting Cleanup of Temporary Directories...
  19. -- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
  20. -- Defined-By: systemd
  21. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  22. --
  23. -- Unit systemd-tmpfiles-clean.service has begun starting up.
  24. Jun 22 09:44:29 xxoo systemd[1]: Started Cleanup of Temporary Directories.
  25. -- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
  26. -- Defined-By: systemd
  27. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  28. --
  29. -- Unit systemd-tmpfiles-clean.service has finished starting up.
  30. --
  31. -- The start-up result is done.
  32. 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
  33. Jun 22 09:45:06 xxoo systemd[1]: Starting PostgreSQL 10 database server...
  34. -- Subject: Unit postgresql-10.service has begun start-up
  35. -- Defined-By: systemd
  36. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  37. --
  38. -- Unit postgresql-10.service has begun starting up.
  39. Jun 22 09:45:06 xxoo postgresql-10-check-db-dir[14252]: "/var/lib/pgsql/10/data/" is missing or empty.
  40. 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.
  41. 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.
  42. Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service: control process exited, code=exited status=1
  43. Jun 22 09:45:06 xxoo systemd[1]: Failed to start PostgreSQL 10 database server.
  44. -- Subject: Unit postgresql-10.service has failed
  45. -- Defined-By: systemd
  46. -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
  47. --
  48. -- Unit postgresql-10.service has failed.
  49. --
  50. -- The result is failed.
  51. Jun 22 09:45:06 xxoo systemd[1]: Unit postgresql-10.service entered failed state.
  52. Jun 22 09:45:06 xxoo systemd[1]: postgresql-10.service failed.
  53. 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
  54. lines 1282-1320/1320 (END)

“/var/lib/pgsql/10/data/” is missing or empty.
好吧,没有初始化

初始化

  1. # /usr/pgsql-10/bin/postgresql-10-setup initdb
  2. Initializing database ... OK
  3. # systemctl start postgresql-10
  4. #
  5. #
  6. # systemctl status postgresql-10
  7. postgresql-10.service - PostgreSQL 10 database server
  8. Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; disabled; vendor preset: disabled)
  9. Active: active (running) since Tue 2021-06-22 09:54:41 CST; 9s ago
  10. Docs: https://www.postgresql.org/docs/10/static/
  11. Process: 14447 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
  12. Main PID: 14453 (postmaster)
  13. CGroup: /system.slice/postgresql-10.service
  14. ├─14453 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
  15. ├─14459 postgres: logger process
  16. ├─14463 postgres: checkpointer process
  17. ├─14464 postgres: writer process
  18. ├─14465 postgres: wal writer process
  19. ├─14466 postgres: autovacuum launcher process
  20. ├─14467 postgres: stats collector process
  21. └─14468 postgres: bgworker: logical replication launcher
  22. Jun 22 09:54:41 xxoo systemd[1]: Starting PostgreSQL 10 database server...
  23. 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
  24. 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
  25. 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"
  26. 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"
  27. 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
  28. 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".
  29. Jun 22 09:54:41 xxoo systemd[1]: Started PostgreSQL 10 database server.

正常

发表评论

表情:
评论列表 (有 0 条评论,141人围观)

还没有评论,来说两句吧...

相关阅读