Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
This is a great answer. I looked around a lot for such a clear guide on this. Thanks. –  Haluk Aug 11 '12 at 22:48
add comment

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

share|improve this answer
    
There is a --config option to read arguments from a file. –  Aaron Brown Aug 9 '12 at 20:15
add comment

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.

share|improve this answer
    
Thank you Rolando! –  Haluk Aug 9 '12 at 15:42
    
I like this approach. We also have a wrapper around pt-table-checksum which checks which of our active/passive master/master pair is active and only runs the checksum on that server. –  Aaron Brown Aug 9 '12 at 19:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.