I want to keep MongoDB and Solr in sync. The mongodb-connector (python) is the tool I want to use to do that. Now a replica set in mongodb is required (see ReadMe), but I don't want (and can) setup a set/instance.
So can I have a replica set setup with only the primary and without secondaries? Means: A replica set setup with only one instance? And how does this
Meanwhile I found a solution:
- Add in the config-File following:
replSet=rs0
(name is variable) (necessary because starting mongod with replSet option didn't work)oplogSize=[MemSize]
- Start mongodb-instance:
sudo /etc/init.d/mongod start
mongo
- Set replicaset:
rs.initiate({"_id" : "rs0","version" : 1,"members" : [{"_id" : 0,"host" : "localhost:27017"}]})
- Check with
rs.status()
In mongodb 3.2 "replSet" is changed to "replSetName" https://docs.mongodb.com/v3.2/tutorial/upgrade-config-servers-to-replica-set/