Open emanfeah opened 1 year ago
hello ,
i do all the step but when i run the
ubuntu@node1:~$ sudo systemctl status patroni.service
i have this error
Jul 11 09:30:36 node1 patroni[6306]: 2023-07-11 09:30:36,778 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 11 09:30:36 node1 patroni[6306]: 2023-07-11 09:30:36,778 INFO: waiting on etcd Jul 11 09:30:41 node1 patroni[6306]: 2023-07-11 09:30:41,784 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 11 09:30:41 node1 patroni[6306]: 2023-07-11 09:30:41,785 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 11 09:30:41 node1 patroni[6306]: 2023-07-11 09:30:41,785 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 11 09:30:41 node1 patroni[6306]: 2023-07-11 09:30:41,785 INFO: waiting on etcd Jul 11 09:30:46 node1 patroni[6306]: 2023-07-11 09:30:46,792 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 11 09:30:46 node1 patroni[6306]: 2023-07-11 09:30:46,793 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 11 09:30:46 node1 patroni[6306]: 2023-07-11 09:30:46,794 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 11 09:30:46 node1 patroni[6306]: 2023-07-11 09:30:46,794 INFO: waiting on etcd
also i used a private ip for node1 and node2 and etcd ..
Can you reach the etcd host? Please check if etcd is running. The log says "waiting on etcd" so check the conf file where you point to etcd and check the etcd service if there are any errors.
Check so your patroni.yml got this: (Set your IP)
etcd: host: 10.10.0.184:2379
And check the etcd conf file should look like this:
ETCD_LISTEN_PEER_URLS="http://10.10.0.184:2380,http://127.0.0.1:7001" ETCD_LISTEN_CLIENT_URLS="http://127.0.0.1:2379, http://10.10.0.184:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.10.0.181:2380" ETCD_INITIAL_CLUSTER="etcd0=http://10.10.0.184:2380," ETCD_ADVERTISE_CLIENT_URLS="http://10.10.0.184:2379" ETCD_INITIAL_CLUSTER_TOKEN="node1" ETCD_INITIAL_CLUSTER_STATE="new"
i have 3 server all have same publickey node1 10.0.30.13 node2 10.0.30.3 etcd 10.0.30.6
the patroni.yaml
scope: postgres
namespace: /db/
name: node1
restapi:
listen: 10.0.30.13:8008
connect_address: 10.0.30.13:8008
etcd:
host: 10.0.30.6:2379
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
initdb:
- encoding: UTF8
- data-checksums
pg_hba:
- host replication replicator 10.0.30.0/0 md5
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: 10.0.30.13:5432
connect_address: 10.0.30.13:5432
data_dir: /mnt/data/patroni/
pgpass: /tmp/pgpass
authentication:
replication:
username: replicator
password: password
superuser:
username: postgres
password: password
parameters:
unix_socket_directories: '.'
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false
and conf etcd :
ETCD_LISTEN_PEER_URLS="http://10.0.30.6:2380,http://10.0.30.6:7001" ETCD_LISTEN_CLIENT_URLS="http://10.0.30.13:2379, http://10.0.30.6:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.0.30.6:2380" ETCD_INITIAL_CLUSTER="etcd=http://10.0.30.6:2380," ETCD_ADVERTISE_CLIENT_URLS="http://10.0.30.6:2379" ETCD_INITIAL_CLUSTER_TOKEN="node1" ETCD_INITIAL_CLUSTER_STATE="new"
sudo systemctl status etcd
Jul 23 07:24:54 etcd etcd[1835]: enabled capabilities for version 3.3
Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d is starting a new election at term 12
Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d became candidate at term 13
Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d received MsgVoteResp from 8e9e05c52164694d at term 13
Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d became leader at term 13
Jul 23 07:24:55 etcd etcd[1835]: raft.node: 8e9e05c52164694d elected leader 8e9e05c52164694d at term 13
Jul 23 07:24:55 etcd etcd[1835]: published {Name:etcd ClientURLs:[http://10.0.30.6:2379]} to cluster cdf818194e3a8c32
Jul 23 07:24:55 etcd etcd[1835]: ready to serve client requests
Jul 23 07:24:55 etcd systemd[1]: Started etcd - highly-available key value store.
Jul 23 07:24:55 etcd etcd[1835]: serving insecure client requests on 10.0.30.6:2379, this is strongly discouraged!
node 1
ubuntu@node1:~$ sudo systemctl status patroni.service
● patroni.service - Runners to orchestrate a high-availability PostgreSQL
Loaded: loaded (/etc/systemd/system/patroni.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2023-07-23 07:29:30 UTC; 51s ago
Main PID: 2433 (patroni)
Tasks: 2 (limit: 19099)
Memory: 32.4M
CPU: 525ms
CGroup: /system.slice/patroni.service
└─2433 /usr/bin/python3 /usr/local/bin/patroni /etc/patroni.yml
Jul 23 07:30:11 node1 patroni[2433]: 2023-07-23 07:30:11,555 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:11 node1 patroni[2433]: 2023-07-23 07:30:11,555 INFO: waiting on etcd
Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,561 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,562 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,563 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,563 INFO: waiting on etcd
Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,569 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,570 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,571 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,571 INFO: waiting on etcd
i have 3 server all have same publickey node1 10.0.30.13 node2 10.0.30.3 etcd 10.0.30.6
the patroni.yaml
scope: postgres namespace: /db/ name: node1 restapi: listen: 10.0.30.13:8008 connect_address: 10.0.30.13:8008 etcd: host: 10.0.30.6:2379 bootstrap: dcs: ttl: 30 loop_wait: 10 retry_timeout: 10 maximum_lag_on_failover: 1048576 postgresql: use_pg_rewind: true initdb: - encoding: UTF8 - data-checksums pg_hba: - host replication replicator 10.0.30.0/0 md5 users: admin: password: admin options: - createrole - createdb postgresql: listen: 10.0.30.13:5432 connect_address: 10.0.30.13:5432 data_dir: /mnt/data/patroni/ pgpass: /tmp/pgpass authentication: replication: username: replicator password: password superuser: username: postgres password: password parameters: unix_socket_directories: '.' tags: nofailover: false noloadbalance: false clonefrom: false nosync: false
and conf etcd :
ETCD_LISTEN_PEER_URLS="http://10.0.30.6:2380,http://10.0.30.6:7001" ETCD_LISTEN_CLIENT_URLS="http://10.0.30.13:2379, http://10.0.30.6:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.0.30.6:2380" ETCD_INITIAL_CLUSTER="etcd=http://10.0.30.6:2380," ETCD_ADVERTISE_CLIENT_URLS="http://10.0.30.6:2379" ETCD_INITIAL_CLUSTER_TOKEN="node1" ETCD_INITIAL_CLUSTER_STATE="new"
sudo systemctl status etcd
Jul 23 07:24:54 etcd etcd[1835]: enabled capabilities for version 3.3 Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d is starting a new election at term 12 Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d became candidate at term 13 Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d received MsgVoteResp from 8e9e05c52164694d at term 13 Jul 23 07:24:55 etcd etcd[1835]: 8e9e05c52164694d became leader at term 13 Jul 23 07:24:55 etcd etcd[1835]: raft.node: 8e9e05c52164694d elected leader 8e9e05c52164694d at term 13 Jul 23 07:24:55 etcd etcd[1835]: published {Name:etcd ClientURLs:[http://10.0.30.6:2379]} to cluster cdf818194e3a8c32 Jul 23 07:24:55 etcd etcd[1835]: ready to serve client requests Jul 23 07:24:55 etcd systemd[1]: Started etcd - highly-available key value store. Jul 23 07:24:55 etcd etcd[1835]: serving insecure client requests on 10.0.30.6:2379, this is strongly discouraged!
node 1
ubuntu@node1:~$ sudo systemctl status patroni.service ● patroni.service - Runners to orchestrate a high-availability PostgreSQL Loaded: loaded (/etc/systemd/system/patroni.service; disabled; vendor preset: enabled) Active: active (running) since Sun 2023-07-23 07:29:30 UTC; 51s ago Main PID: 2433 (patroni) Tasks: 2 (limit: 19099) Memory: 32.4M CPU: 525ms CGroup: /system.slice/patroni.service └─2433 /usr/bin/python3 /usr/local/bin/patroni /etc/patroni.yml Jul 23 07:30:11 node1 patroni[2433]: 2023-07-23 07:30:11,555 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:11 node1 patroni[2433]: 2023-07-23 07:30:11,555 INFO: waiting on etcd Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,561 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,562 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,563 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:16 node1 patroni[2433]: 2023-07-23 07:30:16,563 INFO: waiting on etcd Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,569 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=0, st>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,570 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, st>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,571 ERROR: Failed to get list of machines from http://10.0.30.6:2379/v2: MaxR>Jul 23 07:30:21 node1 patroni[2433]: 2023-07-23 07:30:21,571 INFO: waiting on etcd
Hey just add the dns name and IP in the /etc/hosts on your nodes like this
nano /etc/hosts
10.0.30.6 etcd1
nano /etc/patroni.yml
etcd:
hosts: etcd1:2379
systemctl restart patroni
hello ,
i do all the step but when i run the
ubuntu@node1:~$ sudo systemctl status patroni.service
i have this error
also i used a private ip for node1 and node2 and etcd ..