简体   繁体   中英

Replica configuration - MongoDB

On mongo 3.2.17 I have the following output when running rs.initiate(). I need "ok" equal to 1. I don't know how to modified the configuration. Any suggestion?

{
    "info2" : "no configuration specified. Using a default configuration for 
the set",
    "me" : "vpsxxxxxx:27017",
    "info" : "try querying local.system.replset to see current 
configuration",
    "ok" : 0,
    "errmsg" : "already initialized",
    "code" : 23
}

You are getting this error because you have already initialized replication on your machine. This would work on a fresh instance. In your case try using reconfig instead of initiate

rs.reconfig(config, {force: true})

You can use force option when reconfiguring replica set. Make sure you have at least 3 nodes: 2 full nodes and 1 arbiter (minimum supported configuration) or 3 full nodes (minimum recommended configuration) so that primary node can be elected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM