2015-03-31 85 views
1

我正在使用repmgr進行復制。我已成功將主節點註冊到repmgr。我已成功克隆主節點&啓動備用服務器。但問題是我無法在repmgr中註冊備用節點。repmgr錯誤:在配置從站之前必須定義主站

我使用的版本repmgr 2.0beta1(PostgreSQL 9.3.2)。操作系統:Ubuntu 14.04 LTS

註冊備用節點時。

$ repmgr -f /etc/repmgr/repmgr.conf --verbose standby register 
Opening configuration file: /etc/repmgr/repmgr.conf 
[2015-03-31 11:43:19] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair! 
[2015-03-31 11:43:19] [INFO] repmgr connecting to standby database 
[2015-03-31 11:43:19] [INFO] repmgr connected to standby, checking its state 
[2015-03-31 11:43:19] [INFO] repmgr connecting to master database 
[2015-03-31 11:43:19] [INFO] finding node list for cluster 'test' 
[2015-03-31 11:43:19] [INFO] checking role of cluster node 'host=127.0.0.1 user=repmgr_usr dbname=repmgr_db' 
[2015-03-31 11:43:19] [ERROR] A master must be defined before configuring a slave 

得到此錯誤。

在待機Postgres的LOG:(配log_connections =上,log_disconnections = ON)

$ tail -f /var/log/postgresql/postgresql-9.3-main.log 
2015-03-31 11:38:51 IST LOG: disconnection: session time: 0:00:00.011 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53055 
2015-03-31 11:38:51 IST LOG: could not receive data from client: Connection reset by peer 
2015-03-31 11:38:51 IST LOG: disconnection: session time: 0:00:00.029 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53054 
2015-03-31 11:43:19 IST LOG: connection received: host=127.0.0.1 port=53061 
2015-03-31 11:43:19 IST LOG: connection authorized: user=repmgr_usr database=repmgr_db 
2015-03-31 11:43:19 IST LOG: connection received: host=127.0.0.1 port=53062 
2015-03-31 11:43:19 IST LOG: connection authorized: user=repmgr_usr database=repmgr_db 
2015-03-31 11:43:19 IST LOG: disconnection: session time: 0:00:00.008 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53062 
2015-03-31 11:43:19 IST LOG: could not receive data from client: Connection reset by peer 
2015-03-31 11:43:19 IST LOG: disconnection: session time: 0:00:00.025 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53061 

我在LOG 得到了錯誤 「無法接收來自客戶端的數據:由對等連接重置」

在主Postgres的日誌:(帶log_connections =上,log_disconnections = ON)

$tail -f /var/log/postgresql/postgresql-9.3-main.log 
2015-03-31 11:25:18 IST LOG: connection authorized: user=postgres database=postgres 
2015-03-31 11:25:18 IST LOG: disconnection: session time: 0:00:00.010 user=postgres database=postgres host=[local] 
2015-03-31 11:25:19 IST LOG: connection received: host=[local] 
2015-03-31 11:25:19 IST LOG: connection authorized: user=postgres database=postgres 
2015-03-31 11:25:19 IST LOG: disconnection: session time: 0:00:00.002 user=postgres database=postgres host=[local] 
2015-03-31 11:25:19 IST LOG: connection received: host=[local] 
2015-03-31 11:25:19 IST LOG: connection authorized: user=postgres database=postgres 
2015-03-31 11:25:19 IST LOG: disconnection: session time: 0:00:00.002 user=postgres database=postgres host=[local] 
2015-03-31 11:26:14 IST LOG: connection received: host=192.168.1.218 port=40381 
2015-03-31 11:26:14 IST LOG: replication connection authorized: user=repmgr_usr 

我認爲沒有關於STA細節ndby連接在這個日誌裏。 (我不知道bcoz我不知道)

主repmgr.conf:

cluster=test 
node=1 
node_name=node1 
conninfo='host=127.0.0.1 user=repmgr_usr dbname=repmgr_db' 
pg_bindir=/usr/lib/postgresql/9.3/bin 

待機repmgr.conf

cluster=test 
node=2 
node_name=node2 
conninfo='host=localhost user=repmgr_usr dbname=repmgr_db' 
pg_bindir='/usr/lib/postgresql/9.3/bin' 

主&待機postgres.conf

listen_addresses='*' 
wal_level = 'hot_standby' 
archive_mode = on 
archive_command = 'cd .'  
max_wal_senders = 10 
wal_keep_segments = 5000  
hot_standby = on 
log_connections = on 
log_disconnections = on 

主人& stanby pg_hba.conf

在備用節點
host repmgr_db  repmgr_usr 192.168.1.0/24   trust 
host replication  repmgr_usr 192.168.1.0/24   trust 
host repmgr_db  repmgr_usr 127.0.0.1/24   trust 
host replication  repmgr_usr 127.0.0.1/24   trust 

集羣詳細信息:

$ repmgr -f /etc/repmgr/repmgr.conf cluster show 
[2015-03-31 12:06:17] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair! 
Role  | Connection String 
    standby | host=127.0.0.1 user=repmgr_usr dbname=repmgr_db 

集羣詳細信息在主節點:

$ repmgr -f /etc/repmgr/repmgr.conf cluster show 
[2015-03-31 12:07:46] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair! 
Role  | Connection String 
* master | host=127.0.0.1 user=repmgr_usr dbname=repmgr_db 

請幫我在這個問題上。

+0

beta1?請更新至最新版本(2.0.2)或至少穩定版本。自beta1以來,許多bug已經修復。 – 2015-03-31 07:01:17

+0

是的,我在repmgr 2.0(PostgreSQL 9.3.5)中試過。也是同樣的錯誤。在此之前,每件事都很好。 – Rajiv 2015-03-31 12:59:43

+0

嗨,我有同樣的問題。我不想重複同樣的問題。你有沒有找到解決辦法? – 2016-09-06 12:27:56

回答

1

最後我通過更改repmgr.conf文件解決了這個問題。我曾與

conninfo='host=192.168.1.205 user=repmgr_usr dbname=repmgr_db' 

即改變了

conninfo='host=localhost user=repmgr_usr dbname=repmgr_db' 

。在配置文件中,我們必須給由集羣解析的IP地址或名稱。

相關問題