Master class repo for learning patroni, consul, walg, s3
How to:
docker version
ansible-playbook -i inventory init.yml
docker ps
./dynamic_inventory.py
ansible-playbook -i dynamic_inventory.py consul.yml
docker logs h0
./dynamic_inventory.py
- (use
less
) h0
is172.18.0.2
ansible-playbook -i dynamic_inventory.py patroni.yml --tags=patroni-init --limit=172.18.0.2
docker exec -it h0 docker ps
docker exec -it h0 docker logs pg-h0
docker exec -it h0 docker exec -it pg-h0 ping master.patroni-class.service.consul
ansible-playbook -i dynamic_inventory.py patroni.yml --tags=patroni-init --limit=172.18.0.3
docker exec -it h0 docker exec -it pg-h0 ping replica.patroni-class.service.consul
docker exec -it h1 docker logs --tail 100 pg-h1
docker exec -it h0 docker exec -it pg-h0 gosu postgres psql -c "CREATE TABLE bins AS SELECT * FROM GENERATE_SERIES(1, 10000) AS id;"
docker exec -it h1 docker exec -it pg-h1 gosu postgres psql -c "SELECT max(id) from bins;"
docker exec -it h1 docker exec -it pg-h1 bash
patronictl --help
patronictl -c /var/lib/postgresql/patroni.yml list
patronictl -c /var/lib/postgresql/patroni.yml switchover
patronictl -c /var/lib/postgresql/patroni.yml list
ping master.patroni-class.service.consul
exit
docker network disconnect bridge h1
docker exec -it h0 docker exec -it pg-h0 patronictl -c /var/lib/postgresql/patroni.yml list
docker network connect bridge h1
docker exec -it h0 docker exec -it pg-h0 patronictl -c /var/lib/postgresql/patroni.yml list
ansible-playbook -i dynamic_inventory.py patroni.yml --tags=patroni-init-walg --limit=172.18.0.4
docker exec -it h2 docker logs --tail 100 pg-h2
docker exec -it h2 docker exec -it pg-h2 gosu postgres psql -c "SELECT max(id) from walg3;"
Join if you have questions: https://t.me/joinchat/BjLKBU-Z1PU5j0-mvhWQCw
# pg11 master
ansible-playbook -i dynamic_inventory.py patroni.yml --tags=patroni-init-pg11 --limit=172.18.0.4
# pg11 slave
ansible-playbook -i dynamic_inventory.py patroni.yml --tags=patroni-init-pg11 --limit=172.18.0.2