It can be used to build image of mongo-connector and its dependencies, such as elastic2-doc-manager.
- build
$ docker build -t mongoconnector .
- run (mongo and es need to be started before this)
$ docker run --link some-mongo:my-mongo --link some-es:es -d mongoconnector
or
$ docker run -e MONGO_HOST="192.168.31.223" -e ES_HOST="192.168.31.223" -e MONGO_IP_ADDR="192.168.31.223" -e MONGO_HOSTNAME="my-mongo" -d mongoconnector
where
- MONGO_HOST is the hostname or IP address of mongo server,
- ES_HOST is the hostname or IP address of es server,
- MONGO_IP_ADDR is the IP address of mongo server, and
- MONGO_HOSTNAME is the hostname of mongo in the replica set.
How to get MONGO_HOSTNAME? Run the following command on your mongo server:
root@my-mongo:/# mongo
> rs.initiate()
rs0:PRIMARY> rs.config()
"host" : "my-mongo:27017"