Running pt-table-checksum with replicate-do-db option on
-
30-09-2020 - |
Question
I've read the documentation on percona page, but still a bit confused, especially about the --replicate
option.
My setting is that the slave is only replicating certain databases from master, say db1
and db2
. So I have this following line in the my.cnf
file on slave host:
replicate-do-db=db1
replicate-do-db=db2
So when I use the tool, I know I need to pass --databases=db1, db2
as an option, but do I need to write the resulting checksum table into one of these dbs with --replicate=db1.checksum
? I know by default it creates a database called percona
and writes to percona.checksum
, but since I'm not replicating all the databases, will it also create and write such a db on slave?
And after using the tool, should I be running USE db1
before dropping the checksum table on master so that this is logged and sent to slave?
I know this can be easily tested but when I read the documentation mentioning of causing replication failure scared me. I somehow screwed my local MySQL and only having access to this two servers. Appreciate your help.
Solution
But do I need to write the resulting checksum table into one of these dbs with --replicate=db1.checksum?
Yes, you need. Otherwise it would not be replicated.
And after using the tool, should I be running USE db1 before dropping the checksum table on master so that this is logged and sent to slave?
Yes.
OTHER TIPS
To add to Sveta's answer, you'll also need to set the flag --no-check-replication-filters so the tool won't complain about them.