Home:ALL Converter>Automating MongoDB Replica set configuration on Kubernetes

Automating MongoDB Replica set configuration on Kubernetes

Ask Time:2017-01-26T04:11:38         Author:Jyothi

Json Formatter

I am creating a MongoDB cluster on Kubernetes using Stateful sets. I have 3 mongo replicas configured in my Stateful set.

Now I create Stateful set and service using just one command

kubectl create -f mongo-stateful.yaml

Then I use the mongo client to initiate mongo replica set members.

rs.initiate(
   {
      _id: "replicaset1",
      version: 1,
      members: [
         { _id: 0, host:port1 },
         { _id: 1, host : host:port1 },
         { _id: 2, host : host:port1  }
      ]
   }
)

All of this works except I would like to automate this step of configuring replica set members.

My questions is whether this step can be automated and if we can add this to the yaml file?

Author:Jyothi,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41860794/automating-mongodb-replica-set-configuration-on-kubernetes
tzik :

This might be what you're looking for: \n\nhttp://blog.kubernetes.io/2017/01/running-mongodb-on-kubernetes-with-statefulsets.html",
2017-01-31T17:48:49
yy