Archive for the 'Sys-Admin' Category

Summary of beCamp 2008

Yesterday I went to beCamp 2008 along with four roomfuls of other people interested in technology (perhaps close to 100 people total). The conference was a lot of fun. Not everything went as planned, but that was as planned. This was an Open Spaces conference and I thought it worked very well. From an email Eric Pugh sent:

Basically it all boils down to:

Open Space is the Law of Two Feet: if anyone finds themselves in a place where they are neither learning nor contributing they should move to somewhere more productive. And from the law flow four principles:

  • Whoever comes are the right people
  • Whatever happens is the only thing that could have
  • Whenever it starts is the right time
  • When it’s over, it’s over

From Hadoop to Bang-Splat

I used the law of two feet a time or two. In fact, the first session I wanted to go to, which was about Hadoop and MapReduce, had no knowledgeable attendees. Someone overslept. OK, that’s the way it goes: move along.

From there I went to a session about Unix command-line productivity. Most of the sessions I saw were traditional in that they had one person standing up talking and many people sitting and listening, but not all. This one had several clever command-line gurus mentioning their favorite power tips.

I learned about bang-splat and bang-dollar. The bangs have always gotten me in Bash: I avoid them because I’ve never felt like reading the Bash man page section on them. (Am I too lazy, or not lazy enough?) So it was great to hear some people say “bang-splat and bang-dollar are great” and then explain them. That was easy for me, and now I know how they can be useful to me.

This problem-first type of tip is great for me: tell me the problem, then how to solve it, rather than telling me what the solution is and leaving me guessing what kinds of problems I can solve with it. (The Bash man page is solution-first).

In case you’re wondering, bang-splat substitutes the arguments to the last command, and bang-dollar substitutes the last argument of the last command. So, instead of this:

$ touch file1 file2 file3
$ rm file1 file2 file3

I can do this:

$ touch file1 file2 file3
$ rm !*

There were lots of other nice tips too.

MySQL Performance

I ended up doing a talk on MySQL performance basics. I had no idea what the audience was looking for, so I winged it. I did make some slides, but most of the talk isn’t on the slides. You can get the slides from Percona’s slide page. It seemed to be useful to the folks attending, who had a wide variety of experience and knowledge about MySQL.

Cloud Computing

This session began with a demo of how to create an entire application stack in a few minutes with Cohesive Flexible Technologies. Someone else then demoed a similar thing using RightScale. rPath’s Jeff Uphoff was also in the room, but we didn’t get to see a demo of that. During this session the talk turned to various topics including a little bit of the topics I wanted to hear about in the Hadoop session.

Lunch

Lunch was catered Indian food provided by the Rimm-Kaufman Group. Yum.

Large Scale Storage

This session was sort of a round-table. The two people who talked the most were Josh Malone from the National Radio Astronomy Observatory and the Library of Congress, both of whom have a lot of storage needs they are unsure how to meet. Some people from UVA’s library were there as well, but I didn’t ask what they were working on.

This reminded me a lot of a recent keynote Jacek Becla gave at another conference. He’s with the Stanford Linear Accelerator Center, who are going to be generating a lotta data pretty soon.

High Availability Linux

This one started off with more from Josh Malone, who demoed Nagios briefly and then talked about his storage and backup systems. He uses BackupPC, which sounds pretty neat and very smart. We then talked about some of the things he’s looking into doing, with audience suggestions to look into shared storage or DRBD. We also looked at UltraMonkey briefly — it looks like it’s stagnating, though. And the Linux HA project.

Google App Engine

Finally, someone showed us a calculator application they’d built on Google App Engine, including the code and talking about the data model somewhat. It looks like a neat idea, but the lock-in worries me, a sentiment that was voiced by many others in the room.

Technorati Tags:, , , , , , , , , , , , , ,

You might also like:

  1. Come to beCamp 2008
  2. Bash parameter expansion cheatsheet
  3. MySQL Conference and Expo 2008, Day Three

Improved Cacti monitoring templates for MySQL

Download MySQL Cacti templates

As promised, I’ve created some improved software for monitoring MySQL via Cacti. I began using the de facto MySQL Cacti templates a while ago, but found some things I needed to improve about them. As time passed, I rewrote everything from scratch. The resulting templates are much improved.

You can grab the templates by browsing the source repository on the project’s homepage.

In no particular order, here are some things I improved:

  • Standard polling interval and graph size by default.
  • Full captions on every graph; you don’t have to guess at how big the values are. Each graph has current, max, and average values printed at the bottom for every value on it.
  • Much more data is captured. I’ve graphed almost everything I could think of.
  • The graphs are grouped better. Most graphs have only related values. There are some exceptions, but not many.
  • The templates don’t hijack your existing installation. They don’t depend on or alter anything in your default Cacti installation.
  • The script that gathers the data is totally rewritten from scratch, and much improved. For example, the math works on 32-bit systems. It has caching built-in so each poll cycle results in just one request to the server, instead of one request per graph. (This is a weakness of Cacti I’m trying to work around). It also has debugging aids and other good coding stuff.
  • By default, it assumes you have the same username and password across every server you’re monitoring, so you don’t have to fill in a username and password for every single graph you create.
  • One data template == one graph template. This helps work around another Cacti limitation.
  • Lots more. Honestly I can’t really remember everything I’ve done. I’m sure you’ll help me remember by asking me how to get X feature working the way you want, and I’ll go “oh, yeah, that’s another thing I improved…”

Cacti templates are very laborious to create if they’re complex at all; it takes a long time and is very error-prone. Instead of doing it through Cacti’s web interface and exporting a huge XML file, I eliminated the redundancies and created a small, easy-to-maintain file from which I generate the XML template with a Perl script. This gives the added benefit of letting me (or you) generate templates with different parameters such as polling interval or graph size. The README file has the full details. However, I’ve pre-generated a set of templates that matches Cacti’s defaults, so you can probably just use that.

This has taken a lot of time. In particular, I spent a lot of time working on it at my former employer, The Rimm-Kaufman Group (kudos to them for letting me open-source the work) and I just spent most of my weekend writing the scripts to convert from the compact format to XML templates, so it’s possible to maintain these beasts. Plus I had to develop the compact format, too. This took a lot of time because I had to understand the Cacti data model, which is pretty complex.

Please enter issue reports for bugs, feature requests, etc at the Google project homepage, not in the comments of this blog post. I do not look through comments on my blog when I’m trying to remember what I should be working on for a software project.

If these templates help you and you feel like visiting my Amazon.com wishlist and sending something my way, I’d appreciate it!

PS: You may also be interested in Alexey Kovyrin’s list of templates for monitoring servers.

Technorati Tags:, , , , , ,

You might also like:

  1. What’s the best way to choose graph colors?
  2. A new home for innotop in the new year

Introducing MySQL Parallel Restore

Download MySQL Toolkit

The new release of MySQL Toolkit (version 1051) updates MySQL Parallel Dump in minor ways, but more importantly, it adds MySQL Parallel Restore.

MySQL Parallel Restore is the reverse of MySQL Parallel Dump. You give it one or more files and/or directories, and it discovers all the files contained within them and loads them in parallel. It understands how to load SQL and/or TXT/CSV files. If you give it some of both, it loads the SQL first and then loads the TXT/CSV as delimited files with LOAD DATA INFILE.

It does not parallelize a single table. That is, it doesn’t try to load two files into a table at the same time. But if you’re loading multiple tables, it will do them in parallel.

It has what I consider to be smart defaults. For example, by default it commits between each delimited file it loads. And since the dump tool makes it easy to dump a table in chunks, this makes it much easier on the server to restore a very large table.

I’ve been following the “release early, release often” philosophy with these two tools. You should test carefully before you trust them with your data. If you can’t restore your data accurately, it’s probably a bug. I’ve been testing with the following procedure:

mysql-table-checksum -a ACCUM localhost > checksum-before
mysqldump --all-databases | gzip -c - > sanity.gz
mysql-parallel-dump ... options ... 
mysql-parallel-restore ... options ... default/
mysql-table-checksum -a ACCUM localhost > checksum-after
mysql-checksum-filter checksum-before checksum-after

If the checksums don’t match after restoring, you can restore the original data from the sanity dump. I encourage you to report any bugs you find with this procedure. Incidentally, this exercise taught me that LOAD DATA INFILE is pretty hard to get just right. It has all sorts of weird dependencies on character sets that aren’t documented. That’s why I’m a little cautious and I’m asking you to tell me if you can’t restore correctly.

Technorati Tags:, , , ,

You might also like:

  1. MySQL Toolkit version 1254 released
  2. MySQL Toolkit version 946 released
  3. Maatkit version 1674 released
  4. MySQL Toolkit version 1030 released
  5. MySQL Toolkit version 989 released

How to check and optimize MySQL tables in parallel

I wanted to point out something that might not be obvious from the name: MySQL Parallel Dump can be used as a generic wrapper to discover tables and databases, and fork off worker processes to do something to them in parallel. That “something” can easily be invoking mysqlcheck — or any other program. This makes it really easy for you to do multi-threaded whatever-you-need-to-do on MySQL tables. Here’s how:

mysql-parallel-dump [options] -- 'mysqlcheck --optimize %D %N'

There are several things going on here:

  1. You’re running mysql-parallel-dump with all the ordinary options. Some of them are really specific to dumping data, but not all that many — most of the options are about choosing which databases to include and exclude, and so on.
  2. You’re adding a double dash -- to make it stop processing any further options.
  3. The rest of the arguments are being treated as a system command, but…
  4. Not before interpolating the database and table name into them. The %D and %N are a little macro language. There are some other macros too — see the documentation.

The net effect is to loop through all the tables and run OPTIMIZE TABLE on them.

MySQL Parallel Dump takes responsibility for noticing the exit status of the system command, keeping track of times, and reporting it all when it’s done. And its functionality for working on sets of things is also generic. You could easily create a table of “optimization jobs” and point it at that table, perhaps using the --age option, and it would obediently do what the table’s contents specify:

mysql> select setname, db, tbl from test.opti_job;
+-----------+--------+------------+
| setname   | db     | tbl        |
+-----------+--------+------------+
| dvd_store | sakila | film       | 
| dvd_store | sakila | film_actor | 
| set1      | test   | t1         | 
| set1      | test   | t2         | 
+-----------+--------+------------+
$ mysql-parallel-dump --nolocktables --sets set1,dvd_store --settable test.opti_job -- 'mysqlcheck --optimize %D %N > /dev/null'
        set1:              2 tables,     2 chunks,     2 successes,  0 failures,  0.14 wall-clock time,  0.17 dump time
   dvd_store:              2 tables,     2 chunks,     2 successes,  0 failures,  0.51 wall-clock time,  0.85 dump time
Final result:  2 sets,     4 tables,     4 chunks,     4 successes,  0 failures,  0.65 wall-clock time,  1.02 dump time

Much of the code for any kind of parallel tool is generic. I put a little extra time into this tool to make that code reusable, not special-purpose.

Technorati Tags:, , , , ,

You might also like:

  1. Introducing MySQL Parallel Restore
  2. Introducing MySQL Parallel Dump
  3. MySQL Toolkit version 1254 released
  4. MySQL Toolkit version 946 released
  5. Maatkit version 1297 released

pair Networks is now carbon-neutral

I’m a big fan of pair Networks, my hosting company. Their service has been outstanding; the few times I’ve ever had a glitch with my shared hosting, they have been responsive beyond the call of duty and done whatever it takes to fix the issue. I use them to host not only a half-dozen of my own sites, but family and client sites as well, plus some other groups I’m involved with. It has been a uniformly excellent experience.

Now I see pair Networks has gone carbon-neutral too. While such labels can be abused, and I wouldn’t really trust this announcement from just anyone, I trust them. I’m happy to see them trying to reduce their environmental impact. Go pair, go!

Side note: pair is not the cheapest (and I’m accepting gifts if you feel the urge), but every other hosting provider I’ve heard people rave about for cheapness eventually ends up being a sore point — even the biggest in the industry — I’ll name no names. Sometimes there’s no way to know if someone is good without trying them for six months and seeing how they handle problems. I am also involved with enterprises that use Blue Ridge InternetWorks, who is also top-notch and employs a number of people I respect a lot.

Technorati Tags:, , , , ,

You might also like:

  1. Four companies to sponsor Maatkit development
  2. How to install beautiful X11 cursors

Introducing MySQL Slave Delay

Download MySQL Slave Delay

MySQL Slave Delay implements an oft-requested replication feature: the ability to make a slave lag its master, a.k.a scheduling binlog events for some time in the future. This will probably be built into MySQL replication someday, but in the meantime, you can use this tool. A delayed slave is great if disaster strikes and propagates through replication, because it lets you stop the delayed slave before it gets corrupted, restart the slave until just before the offending statement, and recover quickly. This is a lot faster than restoring last night’s full backup and replaying a day’s worth of binary logs on the master.

This is the first tool largely contributed by someone else. Sergey Zhuravlev sent me the original program over email, and I tweaked it to watch the slave’s relay logs so it doesn’t need to connect to the master, added documentation, and released it.

What it does

MySQL Slave Delay watches the slave’s relay log positions and makes the SQL thread lag the I/O thread by starting and stopping it as needed. It can also watch the master’s log positions, but this is usually not needed unless the slave’s I/O thread delay is large (typically it’s just milliseconds, but it depends on the network speed).

Since you can’t tell how far behind the slave is unless it’s running, MySQL Slave Delay samples and remembers the binlog positions. Later, when it needs to start the slave, it recalls the master’s position at the desired time ago, and makes the slave run until it hits that position.

Another way to think about it is that it schedules replication events for sometime in the future, instead of letting them be applied immediately.

All in all, a simple and easy way to accomplish delayed replication.

About MySQL Toolkit

MySQL Toolkit is a set of essential tools for MySQL users, developers and administrators. The project’s goal is to make high-quality command-line tools that follow the UNIX philosophy of doing one thing and doing it well. They are designed for scriptability and ease of processing with standard command-line utilities such as awk and sed.

Technorati Tags:, , , ,

You might also like:

  1. How to sync tables in master-master MySQL replication
  2. How pre-fetching relay logs speeds up MySQL replication slaves
  3. MySQL Toolkit version 896 released
  4. How to measure MySQL slave lag accurately
  5. How fast is MySQL replication?

A review of MONyog

This is a review of Webyog’s MONyog MySQL monitoring tool. The product is still in beta and has some rough edges, but holds promise. Its design includes some interesting architectural decisions I think will help distinguish it from MySQL’s own Monitoring and Advisory Service.

MONyog overview

MONyog starts an HTTP listener on your machine. After you start the program, you point your Web browser at localhost:9999. Your browser talks to MONyog, which talks to one or many MySQL servers. My impression is that MONyog is meant to be a nearly zero-footprint desktop install you’ll put on your own desktop machine, and monitor remote servers. In other words, you don’t install it on the servers you’ll monitor.

It initially prompts you for connection information, which it saves for the future. After you create and select a connection, MONyog starts watching the MySQL instance. As far as I can see, it just retrieves SHOW STATUS and SHOW VARIABLES, though I believe there are plans for more in the future.

Your web browser, in turn, communicates with MONyog via AJAX. You view the data in a dashboard through Flash graphs. If you have more than one server on your screen, you see the graphs side by side in multiple columns. Here’s a screenshot of the dashboard (nothing’s really happening because this is just watching my wife’s laptop, which is idle).

The MONyog dashboard

You can also navigate through a hierarchical display of counter data that isn’t Flash-graphed, by clicking on the “Show All” in the navigation bar. For example, if you select “InnoDB Cache,” it renders each server side by side in a table, with a bar graph if the value is a percentage. The built-in rules specify warning thresholds for values, and the top-level knows when something underneath it has a warning. In the screenshot below, you can see my InnoDB cache hit ratio is only in the 92% range, which would be worrisome if this laptop were really doing any work. Notice the red dots next to the graph, and also on the far left-hand side of the screen, indicating a problem:

MONyog all counters

The counters are generated from ordinary JavaScript expressions. Anyone who can write JavaScript can customize the built-in counters or write their own code to generate the desired data.

If you’re monitoring Linux servers, you can specify SSH login information and MONyog will also display system stats like CPU usage.

Rough edges and drawbacks

As I said, things are a bit rough around the edges in places. There is no documentation at all, despite the fact that MONyog is featured on the Webyog homepage. (In fact, this article has more information than I have seen anywhere else on the web). As of yet it doesn’t fetch or expose much variety of data from MySQL. The Linux version is RPM-only; there’s not even a .tar.gz to download, and I wasn’t able to get it working on my Linux machine. The Linux version is also very out of date compared to the Windows version, which I tried to use under Wine but couldn’t.

As far as I can tell, it is based on some open-source software such as the Netscape Portable Runtime, but is not Free Software itself. This is a definite drawback for me.

Zero-install on servers

There’s no need to install anything on the servers you’re going to monitor, which is refreshing. From what I’ve heard, the MySQL Monitoring and Advisory Service (formerly code-named Merlin) actually requires you to install an agent on each server you’re watching, as well as another server which is dedicated to collecting data from the agents. Apparently these agents are anything but lightweight and unobtrusive; I have heard a few people griping about the need to install a Java runtime and a bunch of other things (see Jan’s comment below; this is just hearsay, and I perhaps shouldn’t have written this).

In contrast, MONyog is zero-install on your MySQL servers. It simply opens a connection and requests status and other information. I think this is really appealing from a simplicity and maintenance point of view. It means you can start monitoring an unlimited number of servers without touching the configuration on any of them. All your MONyog configuration is in a single place.

I’m not picking on the MySQL folks with my comments about installing an agent. It is one of my favorite gripes. Nagios and Munin want to install agents, too. I really dislike this. In the age of SSH, there should be more agent-less monitoring systems.

JavaScript object model

MONyog populates a JavaScript object hierarchy with the data it fetches. I think people will find it easy to customize the interface, especially since you can do it from within your web browser. You just click on the file you want to edit — including any of the built-in ones — and you see the code. It’s all there; there is nothing hidden from you. If you don’t know where to get started, just take a look at the built-in counters and copy/paste to make your own.

MONyog compared to innotop

If you’re wondering how MONyog compares to innotop, I think they’re quite different. MONyog seems much more counter-oriented to me; sort of like a Flash-based version of an RRD tool. I am not sure what the future will hold for it, but in my opinion it’s a little more narrowly focused at the moment.

Disregarding the different approaches, innotop’s feature set is much larger, of course; I haven’t seen any tool that even approaches innotop’s capabilities, so that should be no surprise.

Conclusion

I continue to be interested in all sorts of monitoring systems, both for MySQL and in general, and I’m trying to learn as much about them as I can. MONyog looks like the beginnings of a nice offering, though ultimately I am unlikely to use it since it’s not Free Software. The most important advantages over other monitoring systems, in my opinion, are the simplicity and ease of use, the agent-less installation, and customizability.

Technorati Tags:No Tags

You might also like:

  1. Installing innotop on FreeBSD and Gentoo
  2. How to update a GCC profile on Gentoo
  3. A look at innotop’s new features
  4. Version 0.1.146 of innotop released
  5. How to install innotop

MySQL Table Sync 0.9.3 released

Download MySQL Table Sync

This release of MySQL Table Sync adds the ability to sync only part of a table, adds minor new functionality, and fixes a bug that could crash the tool.

I will be focusing some effort on this tool soon. If you would like to see particular features, please consider sponsoring them.

Technorati Tags:No Tags

You might also like:

  1. MySQL Toolkit version 946 released
  2. JavaScript number-formatting library updated
  3. MySQL Toolkit released as one package
  4. I need your advice on how to package MySQL Toolkit as one file
  5. MySQL Table Sync 0.9.2 released

MySQL Find 0.9.0 released

Download MySQL Find

If you’ve used the UNIX find command for more than a trivial find-and-print, you know how powerful it is; it’s almost a miniature programming environment to find and manipulate files and directories. What if you could do the same thing with MySQL tables and databases? That was the inspiration for writing this tool. I was about to write several other tools to do some MySQL administrative jobs when I realized I could generalize and make something much more useful and powerful.

This first release has only the functionality I needed for the jobs I had to do. Initially I just implemented commands for working with tables, but the design evolved into something that can be more powerful with minimal added work. Though I modelled the tool after find, I didn’t build in all the complex expressions and conditions. Instead, I followed the general idea of having three kinds of options: regular options, tests, and actions.

The tests allow you to do things like select tables with more than a certain number of rows and with a given storage engine. There are numeric, date, and regular-expression tests.

You can apply actions to the selected tables, and as with find, the default action is to just print their names. There’s a --printf option and two ways to exec SQL commands.

What’s it for?

By way of introduction, let me explain what I was going to write special-purpose tools to do, and then show you how I can do it with mysql-find instead.

  • The first job was a tool I had tentatively titled mysql-measure-tables, which would gather selected data about all tables (data size, index size, number of rows) and store it into another table for forensics and analysis over time.
  • The second was a stale-table-sniper tool to find scratch tables and delete them when a process fails to clean up after itself. I had something like this implemented at my employer, but it also needed to throw away tables in some databases after they got a few weeks old. These are tables the analysts create and don’t delete.

Both are fairly easy to implement; really just a dozen or so lines of code. But as I began to implement the stale table sniper, it occurred to me that I should emulate find instead.

With mysql-find, now I can do these tasks and many more, very easily:

# Delete scratch tables created by processes that died
mysql-find --pid '\D_(\d+)$' scratch --exec_plus "DROP TABLE %s";

# Delete old tables created by analysts
mysql-find --mtime +30 analyst_scratch --exec_plus "DROP TABLE %s";

# Save table size and row count for monitoring over time
mysql-find --noquote --exec "INSERT INTO stat.tblsize(db, tbl, idxlen, datalen, rowcount) VALUES('%D', '%N', %I, %d, %S)";

I’ll write separately about the --pid option and how I use it. It’s a simple naming convention that makes life easy when you don’t want to use temporary tables (in my case, because of replication). If you’re curious, there are more details in the mysql-find man page.

Speaking of the man page, I hope you’ll find the documentation complete and useful. There are examples to stimulate your imagination too.

It’s not revolutionary, but it might be useful — who knows.

What’s next?

What features are upcoming, you say? Actually, I don’t have plans for any more functionality myself. This tool works for me as it is. But if you need something, hop onto the mailing lists, forums, or bug trackers at MySQL Toolkit Sourceforge page and ask. Other obvious additions would be the ability to work with databases, columns, indexes, foreign keys etc. And of course, if you find bugs, that’s the place to report them.

About MySQL Toolkit

MySQL Toolkit is a set of essential tools for MySQL users, developers and administrators. The project’s goal is to make high-quality command-line tools that follow the UNIX philosophy of doing one thing and doing it well. They are designed for scriptability and ease of processing with standard command-line utilities such as awk and sed.

Technorati Tags:No Tags

You might also like:

  1. Introducing MySQL Duplicate Key Checker
  2. MySQL Toolkit version 946 released
  3. MySQL Toolkit’s Show Grants tool 0.9.1 released
  4. MySQL Toolkit released as one package
  5. Two Perl documentation time-savers

MySQL Table Checksum 1.1.0 released

Download MySQL Table Checksum

MySQL Table Checksum 1.1.0 adds many improvements, but the most important is a new way to ensure slaves have the same data as their master. Instead of checksumming the slave and the master, it can now insert the checksum results directly on the master via an INSERT.. SELECT statement. This statement will replicate to the slave, where a simple query can find tables that differ from the master. This makes a consistent, lock-free checksum trivially easy.

There are also many other feature improvements and bug fixes, compatibility with MySQL 3.23.2 through 6.0-alpha, and I’ve finally gotten the documentation finished to my satisfaction. Plus I wrote a test suite.

The new checksum method

While I was at last week’s conference, Martin Friebe and I went to supper and he suggested doing checksums via INSERT.. SELECT to avoid all the hassles with locking, waiting for slaves to catch up, and so on. This method guarantees checksums are taken at the same point in replication on the master and slave, and requires no locking or waiting. It’s a much better way to verify your slaves are in sync with the master.

The technique is implemented in two ways: with a variable accumulator (a modified version of the original checksum queries I wrote about in previous articles), and with a BIT_XOR checksum similar to the checksum queries used by MySQL Table Sync. Each method has strengths and weaknesses.

It’s now practical — nay, easy — to run MySQL Table Checksum from a cron job, and just as easy to check whether a slave is out of sync with the master. First, you create a table to hold the checksums:

  CREATE TABLE test.checksum (
     db         char(64)     NOT NULL,
     tbl        char(64)     NOT NULL,
     this_crc   char(40)     NOT NULL,
     this_cnt   int unsigned NOT NULL,
     master_crc char(40)         NULL,
     master_cnt int unsigned     NULL,
     ts         timestamp    NOT NULL,
     PRIMARY KEY (db,tbl)
  );

Then you run MySQL Table Checksum:

mysql-table-checksum --replicate=test.checksum master-hostname

When it’s all done, you check the slave:

SELECT db, tbl, this_cnt-master_cnt AS cnt_diff,
     this_crc <> master_crc AS crc_diff
FROM checksum
WHERE master_cnt <> this_cnt OR master_crc <> this_crc;

That’s it! Is that easy to throw into Nagios, or what?

Technorati Tags:No Tags

You might also like:

  1. How to know if a MySQL slave is identical to its master
  2. Introducing MySQL Table Checksum
  3. How to sync tables in master-master MySQL replication
  4. How to calculate table checksums in MySQL
  5. How MySQL replication got out of sync