执行故障转移后,我将先前的主数据库关闭,按预期,旧的备用数据库成为了主数据库。
$ repmgr -f /etc/repmgr.conf cluster show --compact
ID | Name | Role | Status | Upstream | Location | Prio. | TLI
----+-----------------+---------+-----------+----------+----------+-------+-----
1 | server1 | primary | - failed | | default | 100 | ?
2 | server2 | primary | * running | | default | 100 | 2
3 | PG-Node-Witness | witness | * running | server2 | default | 0 | 1
我想让旧的主要数据库作为备用数据库加入群集。
我收集了rejoin命令应该执行的操作。
但是,当我尝试重新加入时,要成为新的备用数据库,我会得到这个(我在旧的主数据库上运行了它):
repmgr -f /etc/repmgr.conf -d 'host=10.9.7.97 user=repmgr dbname=repmgr' node rejoin
-其中10.9.7.97是我正在运行的节点的IP。
我收到此错误:
$ repmgr -f /etc/repmgr.conf -d 'host=10.97.7.97 user=repmgr dbname=repmgr' node rejoin --verbose -
NOTICE: using provided configuration file "/etc/repmgr.conf"
ERROR: connection to database failed
DETAIL:
could not connect to server: Connection refused
Is the server running on host "10.97.7.97" and accepting
TCP/IP connections on port 5432?
当然postgres降到了10.9.7.97-旧的主要数据库。
但是,如果我启动它,它将作为另一个主要对象启动:
$ repmgr -f /etc/repmgr.conf cluster show --compact
ID | Name | Role | Status | Upstream | Location | Prio. | TLI
----+-----------------+---------+-----------+----------+----------+-------+-----
1 | server1 | primary | ! running | | default | 100 | 1
2 | server2 | primary | * running | | default | 100 | 2
3 | PG-Node-Witness | witness | * running | server2 | default | 0 | 1
谢谢
答案 0 :(得分:0)
显然是
-d 'host=
在rejoin命令中,应指定当前的主服务器(先前的备用服务器)。