如何处理postgresql连接问题

时间:2014-10-06 14:28:16

标签: macos postgresql homebrew ubuntu-14.04

我遇到过很多postgresql连接处于错误状态的情况。好的,我将通过拥有一个带有几个从属服务器的主服务器来使这变得复杂......而且更复杂的是,主服务器在OS X上,通过自制程序安装了postgresql

这样的东西
pg_basebackup: could not connect to server: could not connect to server: Connection refused
    Is the server running on host "XX.XX.XX.XX" and accepting
    TCP/IP connections on port 5432?

突然出现。主postgres / server.log正在显示

FATAL: pre-existing shared memory block (key xx, ID yyy) is still in use.

尽管正在运行

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

启动和停止服务。 [head scratch]让我们担心......所以我跑了

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

我查询主人的应用程序并可以编辑数据! WAIT postgresql应该被卸载了!

所以启动工作没有按预期工作......这就解释了为什么有些同步已经被淘汰了。

问题1:我们如何确保在OS X上真正停止postgres,因为尽管它可能存在风险,the only alternative appears to be to kill the postmaster.pid

然后事情可能在流程中变得混乱......主人的日志状态:

LOG: could not send data to client: Broken pipe

并且实际上有一个VPS在抱怨

$ service postgresql stop
Error: pid file is invalid, please manually kill the stale server process.

问题2:如何在不损害数据库和应该更新奴隶的WAL进程的情况下杀死它们(Ubuntu 14.04)? (或者是否有更有效/更健全的方法来处理主从复制?)

0 个答案:

没有答案