3

We're using Percona's pt-table-checksum for MySQL replication integrity check.
Is it possible to pass some or all of the options using some sort of configuration file?

For instance, can we write the list of tables we want checked in a file?
I understand the manual does not talk about such a file: http://www.percona.com/doc/percona-toolkit/2.1/pt-table-checksum.html

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
Haluk
  • 619
  • 3
  • 12
  • 22

3 Answers3

5

Yes, you can do this.

pt-table-checksum --config FILENAME

Where FILENAME looks like

tables                  = table1,table2,table3
ignore-tables-regex     = ^tmp
chunk-time              = .2
max-load                = Threads_running=10
chunk-size              = 100000
user                    = myuser
pass                    = mypass

If --config is not specified, pt-table-checksum will read from /etc/percona-toolkit/pt-table-checksum.conf by default. Nearly all Percona Toolkit tools have this ability.

Details on how the config files work is available here

Aaron Brown
  • 5,140
  • 25
  • 25
2

You should be able to shell script such automation

I posted a shell script I use to automate mk-table-checksum and mk-table-sync : Fixing tables out of sync as reported by pt-table-checksum, pt-table-sync is not working (Dec 5, 2011)

The script does the following:

  • accepts the IP addresses of Master and Slave as command-line parameters
  • retrieve the list of all databases
  • run mk-table-checksum on all the databases
  • generates a list of tables (each line has dbname.tbname) that have mismatched checksums
  • executes mk-table-sync and generates the SQL to sync the Slave
    • It does execute the generated SQL
    • It gives you the opportunity to manually look over the changes
    • When the changes look legitimate to you, you can manually run the SQL on the Slave

In that script, there are two lines

TC=/usr/local/sbin/mk-table-checksum
TS=/usr/local/sbin/mk-table-sync

You can easily replace them in the script with the absolute path of your pt-table-checksum and pt-table-sync. You can also augment the script to use a list of files rather than an entire DB Instance.

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
0

It's not possible to read options from file you have to pass them along with utility on command line you can create a job file which runs as a Cronjob.

I think it will be better to have reading arguments from file, You can ask Percona about such configuration options here: http://www.percona.com/bugs/pt-table-checksum

Mahesh Patil
  • 3,078
  • 2
  • 17
  • 23