Mongodb replica set with Docker services 1.12

I am interested to know how to start the mongodb replica set using the new Docker 1.12 service mode model. starting the service allows you to specify the number of container replicas, which in the minimum case with the replica set will be 3. but how the parameters for the primary replica set will be indicated if Docker launches individual containers independently, all with the same service name (for contacting containers via the overlay network )?

how will replica containers contact each other with different names? mongodb1, mongodb2, mongodb3 - should these be different services?

everything was right with the dockers' run running command ... now it seems a little more confusing for containers with full content (members of a replica set), as they oppose stateless containers where all service containers are the same ...

any pointers or links would be helpful.

+6
source share
1 answer

I realized, through the official mongodb guides for replicas on top of Kubernetes, that you have to announce a new service for each replica member.

So, for the basic set of replicas, you declare 3 services, one primary, two secondary - service__primary, service__secondary_1, service_secondary_2.

Each of these roaming services then only proxies / balances the load into one container, which starts the mongod process.

+2
source

All Articles