Setting up Fan in using Tungsten Replicator


Fan-in using Tungsten Replicator is fairly simple. You just need to make sure the data being replicated into the slave is unique and there will be no conflicts.

Fan In the entire Instance


In this example DB1 and DB2 are the masters and DB3 is the slave to fan-in to. Before setting up replication you will need to ensure that the schemas are populated in DB3 with the data you need.

./tools/tungsten-installer
    –master-slave    
    –master-host=DB1  
    –datasource-user=tungsten
    –datasource-password=secret
    –service-name=master1  
    –home-directory=/opt/tungsten  
    –cluster-hosts=DB1,DB3
    –start-and-report

./tools/tungsten-installer  
   –master-slave
   –master-host=DB2  
   –datasource-user=tungsten  
   –datasource-password=secret
   –service-name=master2
   –home-directory=/opt/tungsten2
   –thl-port=2114
   –rmi-port=10002
   –cluster-hosts=DB2,DB3  
   –start-and-report

To test everything is working

mysql -h centos1 -e”create table test.c1 (a int)”
mysql -h centos2 -e”create table test.c2 (a int)”
mysql -h centos3 -e”use test;show tables;”

The output should look like this

+—————-+
| Tables_in_test |
+—————-+
| c1             |
| c2             |
+—————-+
2 rows in set (0.00 sec)

mysql> 

Fan In only specified Databases

You can filter the databases being replicated by adding the –property=replicator.filter.replicate.do option to the installer and enabling the filter

In this example only databaseA will be replicated from DB1 and databaseB from DB2



./tools/tungsten-installer
    –master-slave    
    –master-host=DB1  
    –datasource-user=tungsten
    –datasource-password=secret
    –service-name=master1  
    –home-directory=/opt/tungsten  
    –cluster-hosts=DB1,DB3
    –svc-extractor-filters=replicate
    –property=replicator.filter.replicate.do=databaseA
    –start-and-report

./tools/tungsten-installer  
   –master-slave
   –master-host=DB2  
   –datasource-user=tungsten  
   –datasource-password=secret
   –service-name=master2
   –home-directory=/opt/tungsten2
   –thl-port=2114
   –rmi-port=10002
   –cluster-hosts=DB2,DB3  
   –svc-extractor-filters=replicate
   –property=replicator.filter.replicate.do=databaseB
   –start-and-report

Advertisements
Setting up Fan in using Tungsten Replicator