使用 etcd 啟動的 Patroni
我有一個帶有流複製的現有 PostgreSQL 集群 v11.5。
我想設置由 Patroni 管理的高可用性。
我在兩台機器上都安裝了 Patroni,在另外三台虛擬機上設置了 etcd 集群 [’ http://10.AA191:2379 ‘、’ http://10.BB99:2379 ‘、’ http://10. CC170:2379 ‘] 但使用 systemctl 啟動 Patroni 失敗。
當我使用
patroni -c /etc/patroni.yml
命令啟動 Patroni 時,出現以下錯誤:2019-12-26 16:51:38,207 DEBUG: Selection next machine in cache. Available machines: ['http://10.A.A.191:2379', 'http://10.B.B.99:2379', 'http://10.C.C.170:2379'] 2019-12-26 16:51:38,207 INFO: Selected new etcd server http://10.C.C.170:2379 2019-12-26 16:51:38,208 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None) 2019-12-26 16:51:38,208 DEBUG: Starting new HTTP connection (1): 10.C.C.170:2379 2019-12-26 16:51:38,210 DEBUG: http://10.C.C.170:2379 "GET /v2/machines HTTP/1.1" 404 19 2019-12-26 16:51:38,211 ERROR: Failed to get list of machines from http://10.C.C.170:2379/v2: EtcdException('Bad response : 404 page not found\n',) 2019-12-26 16:51:38,211 INFO: Retrying on http://10.A.A.191:2379 2019-12-26 16:51:38,211 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None) 2019-12-26 16:51:38,211 DEBUG: Starting new HTTP connection (1): 10.237.132.191:2379 2019-12-26 16:51:38,214 DEBUG: http://10.A.A.191:2379 "GET /v2/machines HTTP/1.1" 404 19 2019-12-26 16:51:38,214 ERROR: Failed to get list of machines from http://10.A.A.191:2379/v2: EtcdException('Bad response : 404 page not found\n',) 2019-12-26 16:51:38,214 INFO: Retrying on http://10.B.B.99:2379 2019-12-26 16:51:38,215 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None) 2019-12-26 16:51:38,215 DEBUG: Starting new HTTP connection (1): 10.B.B.99:2379 2019-12-26 16:51:38,217 DEBUG: http://10.B.B.99:2379 "GET /v2/machines HTTP/1.1" 404 19 2019-12-26 16:51:38,217 ERROR: Failed to get list of machines from http://10.B.B.99:2379/v2: EtcdException('Bad response : 404 page not found\n',) 2019-12-26 16:51:38,217 INFO: waiting on etcd
問題似乎出在 API 級別
DEBUG: http://10.B.B.99:2379 "GET /v2/machines HTTP/1.1" 404 19
etcd 可從 PostgreSQL 主機訪問:
curl -s http://10.B.B.99:2380/members |jq -r
返回[ { "id": 730XXXXXXXXXXX000, "peerURLs": [ "http://10.B.B.99:2380" ], "name": "etcd1", "clientURLs": [ "http://0.0.0.0:2379" ] }, { "id": 956XXXXXXXXXXX000, "peerURLs": [ "http://10.C.C.170:2380" ], "name": "etcd3", "clientURLs": [ "http://0.0.0.0:2379" ] }, { "id": 1551XXXXXXXXXXX000, "peerURLs": [ "http://10.A.A.191:2380" ], "name": "etcd2", "clientURLs": [ "http://0.0.0.0:2379" ] } ]
etcd1 啟動命令:
ExecStart=/usr/local/bin/etcd \ --name etcd1 \ --advertise-client-urls http://0.0.0.0:2379 \ --listen-client-urls http://0.0.0.0:2379 \ --initial-advertise-peer-urls http://10.B.B.99:2380 \ --listen-peer-urls http://0.0.0.0:2380 \ --initial-cluster etcd1=http://10.B.B.99:2380,etcd2=http://10.A.A.191:2380,etcd3=http://10.C.C.170:2380 \ --initial-cluster-token etcd-cluster-atom \ --initial-cluster-state new \ --logger zap \ --log-outputs stdout \ --log-level debug
有人可以幫助我嗎?
怎麼了?
非常感謝
版本:
etcd 版本:3.4.0
etcdctl 版本:3.4.0
API 版本:3.4
贊助人1.6.3
python-etcd== 0.4.5
感謝 CyberDem0n。
etcd1 啟動命令中的兩個問題:
API VERSION
Etcd v3.4 預設 API 版本為 v3。
Patroni 目前不支持 v3 API。
Etcd 3.4 預設關閉 API v2。
我在三個 etcd.service 上添加了 –enable-v2=true 標誌,此錯誤已修復。
廣告客戶網址標誌
對於每個 etcd 伺服器,我將 0.0.0.0 替換為 flag 上的真實 etcd 伺服器 ip
--advertise-client-urls
(如--advertise-client-urls http://10.B.B.99:2379
範例中所示)。