Last active
April 20, 2024 22:32
-
-
Save dincosman/dd3823226fdde83dca88e5bb401f5ba9 to your computer and use it in GitHub Desktop.
Reinitialize patroni cluster on other servers after upgrade and configure pgbackrest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[postgres@posvt01 ~]$ patronictl -c /etc/patroni.yml remove pgcluster | |
+ Cluster: pgcluster (7099446795009447890) -----+ | |
| Member | Host | Role | State | TL | Lag in MB | | |
+--------+------+------+-------+----+-----------+ | |
+--------+------+------+-------+----+-----------+ | |
Please confirm the cluster name to remove: pgcluster | |
You are about to remove all information in DCS for pgcluster, please type: "Yes I am aware": Yes I am aware | |
#-- Environment variables provided below are updated | |
[postgres@posvt01 ~]$ vi /var/lib/pgsql/.pgsql_profile | |
... | |
export PGDATA=/mnt/postgres/pgdata/16 | |
export PGHOME=/usr/pgsql-16/ | |
#-- Environment variables provided below are updated | |
[postgres@posvt02 ~]$ vi /var/lib/pgsql/.pgsql_profile | |
... | |
export PGDATA=/mnt/postgres/pgdata/16 | |
export PGHOME=/usr/pgsql-16/ | |
#-- parameters provided below are updated | |
[root@posvt01 ~]# vi /etc/patroni.yml | |
initdb: | |
- waldir: '/mnt/postgres/pg_wal/16' | |
... | |
postgresql: | |
... | |
data_dir: /mnt/postgres/pgdata/16 | |
bin_dir: /usr/pgsql-16/bin | |
... | |
basebackup: | |
... | |
waldir: /mnt/postgres/pg_wal/16 | |
#-- parameters provided below are updated | |
[postgres@posvt01 ~]$ vi /etc/pgbackrest/pgbackrest.conf | |
pg1-path=/mnt/postgres/pgdata/16 | |
... | |
#-- parameters provided below are updated | |
[postgres@posvt02 ~]$ vi /etc/pgbackrest/pgbackrest.conf | |
pg1-path=/mnt/postgres/pgdata/16 | |
... | |
#-- parameters provided below are updated | |
[pgbackrest@etcd03 ~]# vi /etc/pgbackrest/pgbackrest.conf | |
pg1-path=/mnt/postgres/pgdata/16 | |
pg1-port=3531 | |
pg1-socket-path=/var/run/postgresql | |
pg2-host=posvt02.localdomain | |
pg2-path=/mnt/postgres/pgdata/16 | |
... | |
[pgbackrest@etcd03 ~]$ pgbackrest --stanza=pgcluster --no-online stanza-upgrade | |
2024-04-18 21:53:00.857 P00 INFO: stanza-upgrade command begin 2.51: --exec-id=15361-8ec0423f --log-level-console=detail --log-level-file=off --no-online --pg1-host=posvt01.localdomain --pg2-host=posvt02.localdomain --pg1-host-ca-file=/etc/ssl/pgbackrest/root.crt --pg2-host-ca-file=/etc/ssl/pgbackrest/root.crt --pg1-host-cert-file=/etc/ssl/pgbackrest/serverbckp.crt --pg2-host-cert-file=/etc/ssl/pgbackrest/serverbckp.crt --pg1-host-key-file=/etc/ssl/pgbackrest/serverbckp.key --pg2-host-key-file=/etc/ssl/pgbackrest/serverbckp.key --pg1-host-type=tls --pg2-host-type=tls --pg1-host-user=postgres --pg2-host-user=postgres --pg1-path=/mnt/postgres/pgdata/16 --pg2-path=/mnt/postgres/pgdata/16 --pg1-port=3535 --pg2-port=3535 --pg1-socket-path=/var/run/postgresql --pg2-socket-path=/var/run/postgresql --repo1-path=/pgbackrest --stanza=pgcluster | |
2024-04-18 21:53:00.872 P00 INFO: stanza-upgrade for stanza 'pgcluster' on repo1 | |
2024-04-18 21:53:00.944 P00 DETAIL: statistics: {"socket.client":{"total":1},"socket.session":{"total":1},"tls.client":{"total":1},"tls.session":{"total":1}} | |
2024-04-18 21:53:00.944 P00 INFO: stanza-upgrade command end: completed successfully (88ms) | |
[root@posvt01 ~]# systemctl start patroni | |
[pgbackrest@etcd03 ~]$ pgbackrest --type=full --stanza=pgcluster backup | |
[root@posvt02 ~]# systemctl start patroni |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment