PostgreSQL - 斯洛尼 >致命错误:重复的键值违反了唯一约束“sl_nodelock-pkey”
只是在这里发布这个,可能会帮助其他人:
不久前我们发生中断时,我收到了这个错误,并尝试重新启动 slon 复制服务,因为复制并没有真正将数据从 MASTER 复制到 SLAVE:
FATAL localListenThread: "select "_MY_DATABASE_copy".cleanupNodelock(); insert into "_MY_DATABASE_copy".sl_nodelock values ( 1, 0, "pg_catalog".pg_backend_pid()); " - ERROR: duplicate key value violates unique constraint "sl_nodelock-pkey"
DEBUG2 slon_abort() from pid=xxxx
DEBUG1 slon: shutdown requested
Just posting this here and might help the others:
I got this error when we had an outage a while ago, and tried to restart the slon replication service as the replication is NOT really replicating the data from MASTER to SLAVE:
FATAL localListenThread: "select "_MY_DATABASE_copy".cleanupNodelock(); insert into "_MY_DATABASE_copy".sl_nodelock values ( 1, 0, "pg_catalog".pg_backend_pid()); " - ERROR: duplicate key value violates unique constraint "sl_nodelock-pkey"
DEBUG2 slon_abort() from pid=xxxx
DEBUG1 slon: shutdown requested
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我们的环境中,这是由中断(计划内或计划外)引起的,其中 Postgres 在 slon 守护进程之前关闭。通常,重新启动 slon 并不能解决该错误。解决这个问题的方法是:
可以,只需通过 slon_kill 停止所有 slon 即可;简单得多)。
sl_nodelock
主数据库服务器上的表,并删除带有
nl_nodeid 对应于失败/重新启动的节点。
停止了斯隆斯。
This, in our environment, is caused by outages (planned or unplanned) in which Postgres goes down before the slon daemons. Oftentimes, restarting the slons doesn't resolve the error. What does resolve it is:
can, just stop all slons via
slon_kill
; much simpler).sl_nodelock
table on the master database server, and remove all rows with an
nl_nodeid corresponding to the failed/restarted node.
stopped slons.
我也遇到了这个错误,就我而言,应用了第三个修复。我们不小心在准奴隶上运行了一个“slon”进程。我们的解决方案是关闭该进程,然后重新启动主服务器上的“slon”进程。
I also got this error, and in my case, a third fix applied. We accidentally had a 'slon' process running on the slave-to-be. Our solution was to shut down that process, and then restart the 'slon' processes on the master.
好吧,这就是我修复它的方法,但这并不能保证它对每个人都有效:
~# ps aux | grep slon
然后杀死所有进程
运行 slon 复制服务
看起来像这样。
<前><代码>~# ps aux | grep slon
根 8321 0.0 0.0 6528 1568 点/2 S+ 10:35 0:00 slon MY_SCHEMA dbname=MY_DATABASE 用户=postgres 主机=169.1.1.1 密码=密码
通常它有两个进程在后台运行,这是正常的,所以我们必须杀死这些进程。
然后再次运行您的 slonreplicatin 服务脚本。
Ok so this is how I fix it, but this doesn't guarantee it will work for everyone:
~# ps aux | grep slon
Then kill all process
running the slon replicatin service
that will look something like this.
Normally it has two process running in the background, and this is normal, so we have to kill those process.
Then run your slon replicatin service script again.