INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / RSS / GPG

Compare Postgresql tables by records count in tables

№ 11080 В разделе Sysadmin от July 16th, 2020,
В подшивках: ,

You have servers with master-slave(s) replication and want to be sure what all tables is synced. Program queries count of records for every table in database and shows to you on screen. Used on servers with logical replication and wal-g.

Create config.yaml with connection strings:

  master: postgres://
  slave_logical: postgres://
  slave_walg: postgres://

Sample output, table ga is out of sync on slave_walg:

2020/07/16 05:45:45 master successfully connected!
2020/07/16 05:45:46 slave_logical successfully connected!
2020/07/16 05:45:46 slave_walg successfully connected!
2020/07/16 05:45:46 Table name: ga
2020/07/16 05:46:07 Postgres name: master Count: 25381158
2020/07/16 05:45:51 Postgres name: slave_logical Count: 25381158
2020/07/16 05:46:06 Postgres name: slave_walg Count: 25342939
2020/07/16 05:46:07 ------------

Source code and install

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *



Fortune cookie: Evangelists do it with Him watching.