For the past couple of months I have glanced over articles and blogs about Tungsten Replicator – a data replication engine for MySQL which surpasses the traditional MySQL replication feature set. But didn’t know where to begin in trying it out until Giuseppe Maxia posted on his blog – The Data Charmer, a link to his Quick Recipe Cookbook for getting started with Tungsten Replicator.
What is Tungsten Replicator ?
Tungsten Replicator is an open source high performance replication engine that can replace MySQL native replication and greatly enhance the user experience with a broader feature set.
Tungsten Replicator is not integrated into MySQL. It is, in fact, written in Java, and it is thus totally external to the database server. The little inconvenience of this non-integration is more than compensated by the set of features that the replicator offers. MySQL native replication is a simple pipeline of data from one master to one or more slaves. This simple paradigm makes MySQL replication easy to deploy and administer, but it also results in a lack of features and functionality. Most of what MySQL native replication cannot do, Tungsten Replicator can achieve easily with its dynamic architecture. Just to mention a few issues, Tungsten Replicator implements Global Transaction IDs, which make master seamless failover an easy task. MySQL masters know little or nothing about its slaves, and the slaves themselves have no visibility of the other nodes. Tungsten replicator allows the DBA to see the replication cluster as a whole, rather than as a collection of servers. Operations like master switch can be performed from any node, and quite easily. More notable features are:
- Parallel replication;
- Multiple source replication;
- Bi-directional replication;
Armed with the Tungsten Replicator Cookbook and official Continuent Tungsten Replicator documentation, I managed to setup and configure a basic Tungsten Replicator – master/slave setup on my local VirtualBox CentOS 6.0 (master) and CentOS 5.6 (slave). Both servers running with MariaDB 5.2.7 MySQL servers.
Diagram illustrates the setup just I’m using one MySQL slave server.
There are other configurations as well including parallel replication via Tungsten Replicator direct replication (native slave takeover) as well as bi-directional replication consisting of multiple master servers only or multiple masters with additional slaves. Thanks to Giuseppe Maxia, many of the different configurations are neatly outlined in his Cookbook
Example of parallel replication (Tungsten Replicator direct replication – native slave takeover) where Tungsten Replicator applies the logs with parallel connections:
Tungsten Replicator – master/slave setup
For my Tungsten Replicator master/slave test installation, I used v2.0.4 with the following settings:
- master (centos 6.0) = 192.168.56.101
- slave (centos 5.6) = 192.168.56.102
- tungsten mysql username = tungstenmysql
- service name = rep1
- installation directory (Tungsten Home Directory) = /opt/tungsten
Beauty of the Tungsten Replicator master/slave setup is that the intended slave shouldn’t have MySQL replication running at all. So you just need two or more MySQL servers to make up the master/slave replicator setup and running the Tungsten Replicator installer takes care of setting it all up.