Loading...
Tungsten Replicator 4.0 Mysql同步MongoDB

数据存储篇 2015/10/13

虚拟主机和网络配置(略,详看http://www.imethan.cn/blog/article/73

在centos1安装mysql,centos2安装mongodb


MySQL安装(略)


MySQL数据库配置

vi my.cnf

binlog-format = row

#For MySQL 5.6.2 and later, you must enable full row log images:

binlog-row-image = full

character-set-server=utf8

collation-server=utf8_general_ci

mysql restart


MongoDB安装(略,详看http://docs.mongodb.org/manual/

MongoDB配置

vi  /etc/mongod.conf

#bind_ip=127.0.0.1

/etc/rc.d/init.d/mongod restart


tungsten-replicator安装配置


./tools/tpm configure alpha \

    --topology=master-slave \

    --master=centos1\

    --slaves=centos2 \

    --install-directory=/opt/continuent \

    --enable-heterogenous-service=true \

    --property=replicator.filter.pkey.addColumnsToDeletes=true \

    --property=replicator.filter.pkey.addPkeyToInserts=true  \


    #以下两行指定需要同步的数据库表

    --repl-svc-applier-filters=replicate \

    --property=replicator.filter.replicate.do=from_mysql.hellotable

    --start


./tools/tpm configure alpha --hosts=centos1 \

    --datasource-type=mysql \

    --replication-user=tungsten \

    --replication-password=123456 \

    --datasource-mysql-conf=/usr/my.cnf 


./tools/tpm configure alpha --hosts=centos2 \

    --datasource-type=mongodb

    

./tools/tpm install alpha


#更新同步数据表

./tools/tpm update alpha --hosts=centos1,centos2\

    --repl-svc-applier-filters=replicate \

    --property=replicator.filter.replicate.do=from_mysql.hellotable


#开启mongodb用户权限,更新配置

./tools/tpm update alpha --hosts=centos2 \

    --datasource-type=mongodb \

    --datasource-user=tungsten \

    --datasource-password=123456



#更新配置重启后生效

cd /opt/continuent/tungsten/tungsten-replicator/bin

./replicator restart


#查看当前配置

./tools/tpm reverse


#将Staging配置转换为INI配置

http://pubs.vmware.com/continuent/tungsten-replicator-4.0/cmdline-tools-tpm-ini.html#cmdline-tools-tpm-ini-conversion


参考:

http://docs.mongodb.org/manual/

http://pubs.vmware.com/continuent/tungsten-replicator-4.0/index.html

http://www.imethan.cn/blog/article/73



Comments