Getting list of tables on servers and counts records
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
Vladimir Smagin dff6035456 dockerfile fix pirms 3 nedēļām
build/package add pipeline pirms 4 nedēļām
vendor better logging pirms 3 nedēļām
.gitignore implement argument with config file pirms 3 nedēļām
Dockerfile dockerfile fix pirms 3 nedēļām
Jenkinsfile dockerfile fix pirms 3 nedēļām
README.md check single table pirms 3 nedēļām
config.example.yaml import pirms 4 nedēļām
go.mod better logging pirms 3 nedēļām
go.sum better logging pirms 3 nedēļām
main.go check single table pirms 3 nedēļām

README.md

Compare Postgresql tables

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 and run compare-pg -config config.yaml. If you want check only single table add argument -table table_name.

Sample config file:

credentials:
  master: postgres://username:password@pg-master.server.ru:5433/mydatabase?sslmode=disable
  slave_logical: postgres://username:password@pg-slave1.server.ru:5432/mydatabase?sslmode=disable
  slave_walg: postgres://username:password@pg-slave2.server.ru:5435/mydatabase?sslmode=disable

Sample output, table user_info is out of sync on slave_logic:

[INFO]  2020/07/16 16:43:53 master successfully connected!
[INFO]  2020/07/16 16:43:54 slave_logic successfully connected!
[INFO]  2020/07/16 16:43:54 Table name: ga
[INFO]  2020/07/16 16:43:55 Postgres name: master 	Count: 25381695 	Size: 5727 MB
[INFO]  2020/07/16 16:43:55 Postgres name: slave_logic 	Count: 25381695 	Size: 6147 MB
[INFO]  2020/07/16 16:43:55 ------------
[INFO]  2020/07/16 16:43:55 Table name: ch_vk_email_phone
[INFO]  2020/07/16 16:43:57 Postgres name: master 	Count: 27670694 	Size: 2770 MB
[INFO]  2020/07/16 16:44:02 Postgres name: slave_logic 	Count: 27670694 	Size: 2770 MB
[INFO]  2020/07/16 16:44:02 ------------
[INFO]  2020/07/16 16:44:04 Table name: user_info
[INFO]  2020/07/16 16:44:16 Postgres name: master 	Count: 414710344 	Size: 135 GB
[INFO]  2020/07/16 16:45:04 Postgres name: slave_logic 	Count: 414555984 	Size: 151 GB
[WARN]  2020/07/16 16:45:04 ------------ TABLES DIFFERENT ------------

Install

Add my Ubuntu\Debian repository http://deb.blindage.org/ and install compare-pg package.

Or download binary from releases tab.


Copyright by Vladimir Smagin (21h) 2020
http://blindage.org email: 21h@blindage.org
Project page: https://git.blindage.org/21h/compare-postgres-tables