Percona Live London starts on Monday, so this is the last in the series of free-Percona-Live tickets we’ll give away. But first — have you ever wondered what servers are in your MySQL replication hierarchy?
We have, too. As consultants, a lot of times we need to get a quick overview of the whole replication hierarchy and specific things about it, such as replication filters, versions, whether replication is running, how far behind it is, and so on. These things are very important for making sure that we don’t break something in the system, get blamed for breaking replication when it was already broken, and so on.
So we built pt-slave-find (it was actually born as mk-slave-find, ages ago before I even worked at Percona). It automatically detects and connects to every server in the replication hierarchy, and prints out a summary of each one’s most important details.
Here’s an example. Notice how one of the servers has a replication filter on it, the servers don’t all have the same version installed, and some are in the AWS cloud. All of these things are important to know — if we run a checksum on the non-cloud servers, for example, we could make the cloud servers fall far behind in replication.
$ perl pt-slave-find localhost localhost Version 5.1.57-rel12.8-log Server ID 6275 Uptime 10+01:18:10 (started 2011-10-08T19:22:04) Replication Is a slave, has 5 slaves connected, is not read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode IDEMPOTENT Auto-increment increment 4, offset 2 InnoDB version 1.0.16-12.8 +- 10.124.62.76 Version 5.1.57-rel12.8-log Server ID 6276 Uptime 12+03:35:17 (started 2011-10-06T17:04:57) Replication Is a slave, has 2 slaves connected, is read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode IDEMPOTENT Auto-increment increment 4, offset 2 InnoDB version 1.0.16-12.8 +- 10.124.62.78 Version 5.1.57-rel12.8-log Server ID 6278 Uptime 12+03:53:59 (started 2011-10-06T16:46:15) Replication Is a slave, has 0 slaves connected, is read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode IDEMPOTENT Auto-increment increment 4, offset 2 InnoDB version 1.0.16-12.8 +- 10.124.62.77 Version 5.1.57-rel12.8-log Server ID 6277 Uptime 12+04:00:24 (started 2011-10-06T16:39:50) Replication Is a slave, has 0 slaves connected, is read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode IDEMPOTENT Auto-increment increment 4, offset 2 InnoDB version 1.0.16-12.8 +- 10.124.62.86 Version 5.1.57-rel12.8-log Server ID 6286 Uptime 12+02:52:15 (started 2011-10-06T17:47:59) Replication Is a slave, has 4 slaves connected, is not read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 1, offset 1 InnoDB version 1.0.16-12.8 +- [redacted].compute-1.amazonaws.com Version 5.1.43-60.hardy.7-log Server ID 3141592 Uptime 11:29:58 (started 2011-10-18T09:10:16) Replication Is a slave, has 0 slaves connected, is not read_only Filters replicate_wild_ignore_table=foo%.mount% Binary logging ROW Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 1, offset 1 InnoDB version 1.0.6-unknown +- [redacted].compute-1.amazonaws.com Version 5.1.43-60.hardy.7-log Server ID 19924124 Uptime 12+23:32:10 (started 2011-10-05T21:08:04) Replication Is a slave, has 1 slaves connected, is not read_only Filters Binary logging STATEMENT Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 1, offset 1 InnoDB version 1.0.6-unknown +- [redacted].compute-1.amazonaws.com Version 5.1.43-60.hardy.7-log Server ID 207 Uptime 12+23:40:41 (started 2011-10-05T20:59:34) Replication Is a slave, has 1 slaves connected, is not read_only Filters Binary logging STATEMENT Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 1, offset 1 InnoDB version 1.0.6-unknown +- [redacted].compute-1.amazonaws.com Version 5.1.43-60.hardy.7-log Server ID 330612 Uptime 12+23:44:28 (started 2011-10-05T20:55:47) Replication Is a slave, has 0 slaves connected, is not read_only Filters Binary logging STATEMENT Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 1, offset 1 InnoDB version 1.0.6-unknown +- [redacted].compute-1.amazonaws.com Version 5.1.43-60.hardy.7-log Server ID 215924 Uptime 12+08:15:08 (started 2011-10-06T12:25:08) Replication Is a slave, has 6 slaves connected, is read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode IDEMPOTENT Auto-increment increment 4, offset 3 InnoDB version 1.0.6-unknown +- 10.153.116.5 Version 5.1.57-rel12.8-log Server ID 1165 Uptime 20+09:44:46 (started 2011-09-28T10:55:30) Replication Is a slave, has 0 slaves connected, is read_only Filters Binary logging MIXED Slave status 0 seconds behind, running, no errors Slave mode STRICT Auto-increment increment 4, offset 3 InnoDB version 1.0.16-12.8
So that’s how you can quickly find out what’s in your replication hierarchy, how it’s configured, and a few basic bits of status information.
Now how do you win a free ticket to Percona Live London? Watch our @percona Twitter stream to find out!
The post Find where your data is replicated, win a Percona Live ticket appeared first on MySQL Performance Blog.