我在 CentOS 7 上,我正在尝试解决“PG::ConnectionBad: FATAL: Peer authentication failed for user”错误。
所以我已经想出我应该更改 pg_hba.conf(对等到 md5)并且我已经完成了。看来我必须重新启动 postgres,但它并不像我想象的那么容易。
我尝试了“service postgresql restart”,结果是“无法重新启动 postgresql.service:未找到单元。”
然后尝试安装 posgresql-server。得到:
oct 23 01:16:15 serverct1 pg_ctl[3280]: HINT: Is another postmaster already running on port 5432? If ...try.
oct 23 01:16:15 serverct1 pg_ctl[3280]: WARNING: could not create listen socket for "localhost"
oct 23 01:16:15 serverct1 pg_ctl[3280]: FATAL: could not create any TCP/IP sockets
oct 23 01:16:16 serverct1 pg_ctl[3280]: pg_ctl: could not start server
oct 23 01:16:16 serverct1 systemd[1]: postgresql.service: control process exited, code=exited status=1
oct 23 01:16:16 serverct1 systemd[1]: Failed to start PostgreSQL database server.
关于5432端口的使用:
postgres 5432/tcp postgresql # POSTGRES
postgres 5432/udp postgresql # POSTGRES
所以我很好奇:
1) postgresql 和 postgresql-server 分开工作吗?
2)是否可以在没有postgresql-server的情况下重启posgresql?
3) 如果不是——如何释放端口 5432 以运行 postgresql-server?
最佳答案
如果你使用标准的 postgres pg_ctl
,你可以避免 serverct1
的麻烦,例如:
pg_ctl reload
或者如果需要 pg_ctl reload -D $PGDATA
您无需重新启动 postgres 即可应用 pg_hba 更改:https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
The pg_hba.conf file is read on start-up and when the main server process receives a SIGHUP signal. If you edit the file on an active system, you will need to signal the postmaster (using pg_ctl reload or kill -HUP) to make it re-read the file.
关于postgresql - 在没有 postgresql-server 的情况下重启 PostgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46879534/