How to convert a MongoDB replica set to a stand alone server

后端 未结 5 1852
我寻月下人不归
我寻月下人不归 2020-12-14 06:38

Consider, I have 4 replicate sets and the config is as follows:

{
 \"_id\": \"rs_0\",
 \"version\": 5,
 \"members\" : [
  {\"_id\": 1, \"host\": \"127.0.0.1:         


        
5条回答
  •  孤城傲影
    2020-12-14 06:56

    Follow below steps :

    1. Go to mongo shell on Secondary servers

    2. Stop the secondary servers by using below command : use admin db.shutdownServer()

    3. Go to Linux shell- on secondary servers and type below command :

    sudo service mongod stop

    Starting the MongoDB replication -

    • Go to Linux shell - on secondary servers and type below command :

      sudo service mongod start Starting the MongoDB replication -

    • Go to primary and type below commands to start the replication :

    a] rs.initiate()

    b] rs.add("Secondar -1:port no")

    c] rs.add("Secondary-2:port no")

    d] rs.add({ "_id" : 3, "host" : "Hidden_member:port no", "priority" : 0, "hidden" : true })

    e] rs.status()

提交回复
热议问题