Replication
ubuntu 上的 repmgr 3.0.4 和 postgres 9.4(錯誤:複製槽“repmgr_slot_2”不存在)
我不是 DBA,但我的任務是設置數據庫和流複製,repmgr 是我決定使用的工具。
master 執行良好,我可以看到它在集群中註冊。
從機上的錯誤如下
[2016-07-22 15:39:35] [NOTICE] using configuration file "/etc/repmgr/repmgr.conf" [2016-07-22 15:39:35] [NOTICE] destination directory '/var/lib/postgresql/9.4/main' provided [2016-07-22 15:39:36] [ERROR] aborting, remote host xx.xxx.xxx.xxx is not reachable. [2016-07-22 15:39:36] [ERROR] unable to drop replication slot "repmgr_slot_2": ERROR: replication slot "repmgr_slot_2" does not exist [2016-07-22 15:39:36] [ERROR] unable to take a base backup of the master server [2016-07-22 15:39:36] [WARNING] destination directory (/var/lib/postgresql/9.4/main) may need to be cleaned up manually
導致上述錯誤的命令是
repmgr -f /etc/repmgr/repmgr.conf --force --rsync-only -h dbhost1 -d repmgr -U repmgr --verbose standby clone
配置文件如下
cluster=test node=2 node_name=db-002 use_replication_slots=1 conninfo='host=dbhost2 user=repmgr dbname=repmgr' pg_bindir=/usr/lib/postgresql/9.4/bin
我嘗試使用從 dbhost2/slave 登錄到 dbhost1/masrer
psql -h xx.xxx.xxx.xxx -p xxxx -d repmgr -U repmgr
它工作得很好,因此使用信任進行身份驗證正確配置了 dbhost1/master 中的 pg_hba 文件。
好的,我發現了問題。我沒有在主從之間正確配置無密碼 ssh 登錄。因此,儘管能夠從我的奴隸登錄到我的主人,但問題是它無法複製文件,因為 ssh 需要密碼。
我唯一的問題是錯誤報告對於repmgr 來說太可怕了。
按照本指南,我錯過了一小步。始終確保您測試主從之間的 ssh 登錄以進行無密碼登錄,以確保其設置正確。