I want to try mongodb replica set. I follow the steps of《MongoDB: The Definitive Guide》.
$ mongo --nodb
then in the mongo shell:
replicaSet = new ReplicaSet({nodes: 3})
replicaSet.startSet()
then terminal repeat to output this:
[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
what' the problem?
You need to do
rs.initiate()
You could also try like this
replicaSet.startSet();replicaSet.initiate()
http://docs.mongodb.org/manual/reference/method/rs.initiate/
Initiates a replica set. Optionally takes a configuration argument in the form of a document that holds the configuration of a replica set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With