zxs / tungsten-replicator

Automatically exported from code.google.com/p/tungsten-replicator
0 stars 0 forks source link

MongoDB: Support URL in the form mongodb://... #1107

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Related to issue #1102:
https://code.google.com/p/tungsten-replicator/issues/detail?id=1102

Currently, Tungsten only supports MongoDB on the local machine. It doesn't 
support MongoDB on the cloud, like Compose.io:
https://www.compose.io/

It it because MongoDB on the cloud like Compose.io only allows connect string 
in this form:
mongodb://...

See:
http://api.mongodb.org/java/current/com/mongodb/MongoClientURI.html

In order to support the above:
* Please update MongoDB client lib (issue #1102).
* Modify MongoApplier.java like this:

            if (connectString == null)
                m = new MongoClient();
            else if (connectString.startsWith("mongodb://"))
                m = new MongoClient(new MongoClientURI(connectString));
            else
                m = new MongoClient(connectString);

See:
https://code.google.com/p/tungsten-replicator/source/browse/trunk/replicator/src
/java/com/continuent/tungsten/replicator/applier/MongoApplier.java#559

After that, we can install MongoDB applier like this (Tungsten 3.0.1, the 
extractor runs on the same local machine):

./tools/tpm configure defaults --reset

./tools/tpm configure dfs_main \
--datasource-type=mongodb \
--property=replicator.applier.dbms.connectString=mongodb://username:password@ser
ver:port/dbname \
--property=replicator.applier.dbms.autoIndex=true \
--install-directory=~/opt/tungsten/mongodb_applier \
--java-file-encoding=UTF8 \
--master=127.0.0.1 \
--members=localhost \
--svc-parallelization-type=none \
--topology=master-slave \
--enable-heterogenous-slave=true \
--rmi-port=10002 \
--master-thl-port=2112 \
--master-thl-host=127.0.0.1 \
--thl-port=2113 \
--start=true \
--skip-validation-check=InstallerMasterSlaveCheck,HostsFileCheck

./tools/tpm install

Original issue reported on code.google.com by ngo...@mobilus.co.jp on 12 Mar 2015 at 6:46

GoogleCodeExporter commented 9 years ago

Original comment by g.maxia on 12 Mar 2015 at 7:09