Eu tenho um cluster do PostgreSQL v11.5 com replicação de streaming.
Quero configurar a alta disponibilidade gerenciada pelo Patroni.
Instalei o Patroni nas duas máquinas, configurei um cluster etcd em três outras Máquinas Virtuais [' http://10.AA191:2379 ', ' http://10.BB99:2379 ', ' http://10. CC170:2379 '] mas a inicialização do Patroni falhou com systemctl.
Quando inicio o Patroni com patroni -c /etc/patroni.yml
o comando, tenho os erros abaixo:
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
O problema parece estar no nível da API DEBUG: http://10.B.B.99:2379 "GET /v2/machines HTTP/1.1" 404 19
etcd é alcançável a partir do host PostgreSQL:
curl -s http://10.B.B.99:2380/members |jq -r
retorna
[
{
"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"
]
}
]
comando de início 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
Alguém poderia me ajudar por favor?
O que está errado?
Muito Obrigado
Versões:
etcd Versão: 3.4.0
etcdctl versão: 3.4.0
API versão: 3.4
patroni 1.6.3
python-etcd== 0.4.5
Graças a CyberDem0n.
Dois problemas no comando start etcd1:
VERSÃO API
Etcd v3.4 A versão padrão da API é v3.
Patroni atualmente não suporta a API v3.
Etcd 3.4 desativou a API v2 por padrão.
Eu adicionei --enable-v2=true sinalizador nos três etcd.service e este erro foi corrigido.
BANDEIRA de URLs de anúncio-cliente
E para cada servidor etcd eu substituí 0.0.0.0 pelo ip real do servidor etcd na
--advertise-client-urls
flag (como--advertise-client-urls http://10.B.B.99:2379
no exemplo).