6.3. Deploying MySQL to MongoDB Replication
Tungsten Replication allows extraction of information from different database
types and apply them to different types. This is possible because of the
internal format used when reading the information and placing the data into
the THL. Using row-based replication, the data is extracted from the MySQL
binary log as column/value pairs, which can then be applied to other
databases, including MongoDB.
Deployment of a replication to MongoDB service is slightly different, there
are two parts to the process:
Service Alpha on the master extracts the information from the MySQL
binary log into THL.
Service Alpha on the slave reads the information from the remote
replicator as THL, and applies that to MongoDB.
Figure 6.2. Topologies: MySQL to MongoDB
Basic reformatting and restructuring of the data is performed by translating
the structure extracted from one database in row format and restructuring
for application in a different format. A filter, the ColumnNameFilter, is
used to extract the column names against the extracted row-based
With the MongoDB applier, information is extracted from the source database
using the row-format, column names and primary keys are identified, and
translated to the BSON (Binary JSON) format supported by MongoDB. The fields
in the source row are converted to the key/value pairs within the generated
BSON. For example, the row:
The transfer operates as follows:
Data is extracted from MySQL using the standard extractor, reading the
row change data from the binlog.
The Section 11.4.8, “ColumnName Filter” filter is used to
extract column name information from the database. This enables the
row-change information to be tagged with the corresponding column
information. The data changes, and corresponding row names, are stored
in the THL.
The THL information is then applied to MongoDB using the MongoDB
The two replication services can operate on the same machine, or they can be
installed on two different machines.