Now that parallel replication is working a lot better, what is it good for? Here is a good start: assuming your workload is suitable for shard-based replication, Tungsten offers a nice replacement for MySQL slave replication that will give you immediate parallel replication for any MySQL server starting with version 5.0 and up. We call this native slave takeover. It looks like the following diagram.
You can migrate MySQL slaves to Tungsten very easily thanks to some great work on the Tungsten installer by Jeff Mace that Giuseppe Maxia also praised in a recent article. Seeing that Giuseppe is also the Continuent QA director, I guess this means it passed. :) Here is how to set up.
First, configure MySQL master/slave replication. Here are typical commands after you synchronize the slave with a backup from the master. For these examples, we assume the slave is running on host mercury, and the master is on host saturn.
mysql -utungsten -psecret -hmercury -e "CHANGE MASTER TO \
mysql -utungsten -psecret -hmercury -e "START SLAVE"
mysql -utungsten -psecret -hmercury -e "SHOW SLAVE STATUS\G"
Next, download and unpack Tungsten from the latest dev build. Here are sample commands for build 231.
wget --no-check-certificate https://s3.amazonaws.com/files.continuent.com/builds/nightly/tungsten-2.0-snapshots/tungsten-replicator-2.0.4-231.tar.gz
tar -xvzf tungsten-replicator-2.0.4-231.tar.gz
Finally, run the installation using the following handy command. This will copy the download into its proper location (here /opt/tungsten) and start Tungsten. Tungsten will stop MySQL replication if it is running and start Tungsten replication from the exact point where native replication left off.
If there is a problem with your pre-requisites the installer will print out a message and stop. Most of these messages should be pretty self-explanatory. (In some builds there's a problem with OpenJDK failing the install check. Use --no-validation to get around that.)
Here is another interesting tip. If you try Tungsten and want to go back to MySQL replication, you can flip back to MySQL native replication with two commands. Just take Tungsten offline cleanly, which shuts down all the replicator channels at the same point, and start MySQL replication again:
mysql -urepl -ps3cr3t -e 'START SLAVE'
We are currently doing a lot of performance profiling and testing of parallel replication. I hope to post more about performance results in a future article. Meanwhile, there are 36 new features (including on-disk queues) and bug fixes that will roll into a final Tungsten 2.0.4 in the next week or so. Try out the latest builds and see what you think.