Skip to content

Instantly share code, notes, and snippets.

View internetuser2008's full-sized avatar

Bimal.Patel internetuser2008

  • USA
View GitHub Profile
IFS=$'\n'; for i in `psql -Upostgres -Atc "select concat(sequence_schema,'.','\"',sequence_name,'\"') from information_schema.sequences;"`; do echo $i; psql -Upostgres -c "select sequence_name, last_value, max_value, (last_value/max_value)*100 as percentage from $i;"; done; $IFS
@internetuser2008
internetuser2008 / pgplaybook.yml
Last active March 14, 2020 22:16
custom Ansible Playbook to deploy PostgerSql or PostgreSql BDR + Pgbackrest + Pgbouncer
# Usage
# host supply IP
# -t(tags) run specific tasks ie. db=master, dbslave=slave1/2, promote=update slave to master, remove= remove host
# ansible-playbook pg.yml -e "host=192.169.99.2 -t db ##Build Master
# ansible-playbook pg.yml -e "host=192.168.99.3" -t dbslave ##Build Slave
# ansible-playbook pg.yml -e "host=192.168.99.3" -t promote ##Promoe slave to master
# ansible-playbook pg.yml -e "host=192.168.99.2" -t remove ##Remove node from cluster
# ansible-playbook /var/lib/pgsql/pg.yml -e "host=192.168.99.4" -s -t db --user=user1 --ask-sudo-pass ##Ubuntu
# Created Bimal Patel
---