MongoDB's replica set uses redundant nodes to provide a high availability and resilience against network partitions of the primary node.
Questions tagged [mongodb-replica-set]
333 questions
42
votes
2 answers
Mongo DB - difference between standalone & 1-node replica set
I needed to use Mongo DB transactions, and recently I understood that transactions don't work for Mongo standalone mode, but only for replica sets
(Mongo DB with C# - document added regardless of transaction).
Also, I read that standalone mode is…

Metheny
- 1,112
- 1
- 11
- 23
26
votes
5 answers
Can't initiate replica set in Ubuntu
Whenever I type: rs.initiate(), I get the following error message:
{
"info2" : "no configuration explicitly specified -- making one",
"me" : "VMHOSTNAME:27017",
"ok" : 0,
"errmsg" : "No host described in new configuration 1 for…

Italo Maia
- 1,956
- 3
- 18
- 31
15
votes
5 answers
MongoDB Replica Set : Cannot use non-local read concern until replica set is finished initializing
I tried to create a replica set following instruction such as : https://hevodata.com/learn/mongodb-replica-set-3-easy-methods/
Sadly, I have a problem at the first step :
Problem
The command :
mongod --port 27017 --dbpath "C:\Program…

Macab
- 151
- 1
- 1
- 4
13
votes
5 answers
error in using rs.initiate() in mongo
I want to turn on the replication in monga. So when I tried to use rs.initiate I get the following errorrs.initiate()
{
"ok" : 0,
"errmsg" : "This node was not started with the replSet option",
"code" : 76,
"codeName" :…

arman
- 414
- 2
- 6
- 19
13
votes
3 answers
errmsg" : "No host described in new configuration 1 for replica set rs0 maps to this node", Why I am getting this message?
I am getting this message every time I do rs.initiate() :
No host described in new configuration 1 for replica set rs0 maps to this node
This is how my /etc/hosts/ file looks on both the replica set servers.
Server 1 and server 2 "hosts"…

Shashank
- 149
- 1
- 2
- 6
13
votes
8 answers
How to shut down replica set in mongodb?
I use ubuntu.
I start three mongod replica set as follows:
$ mongod --replSet setname --logpath "1.log" --dbpath /data/rs1 --port 27017 --smallfiles --fork
$ mongod --replSet setname --logpath "2.log" --dbpath /data/rs2 --port 27018 --smallfiles…

Huo
- 798
- 3
- 12
- 22
11
votes
1 answer
What is the difference between a cluster and a replica set in mongodb atlas?
I'm taking the Mongodb University M103 course and over there they gave a brief overview of what a cluster and a replica set is.
From my understanding a cluster is a set of servers or nodes. While a replica set is a set of servers or nodes all of…

Devorein
- 1,112
- 2
- 15
- 23
11
votes
2 answers
MongoDB load balancer for the Replica set
In replica set cluster of MongoDB how can i ensure quick response for a concurent users when my primary is busy in serving another request?
Do i need to use load balancer, or the mongodb itself route the query to available Secondary?
Thanks

Geek
- 1,214
- 5
- 14
- 27
10
votes
1 answer
How to fix 'Sessions collection is not set up' error when trying to convert existing mongodb instance to replica set
I have installed the latest version of mongodb (v4.0.5) using the following link
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
Following this now I'm trying to set up replication using the instructions provided in the…

Jack
- 125
- 1
- 1
- 6
8
votes
1 answer
Enabling MongoDB transactions without replica sets or with least possible configuration
[Some background information - possibly skippable]
To begin with, I have barely any understanding of database management
and just shallow experience with mongoose and node in the backend
realm(a couple of udemy courses). Udemy courses made me…

fly
- 121
- 1
- 7
7
votes
3 answers
Connect to MongoDB Replica Set running inside Docker with Java (Windows)
I want to set up a MongoDB replica set with docker. The setup seems to be fine but I'm not able to connect to the cluster with my Java-app. I'm running Docker version 17.06.0-ce on Windows 10 with VirtualBox as driver.
I followed the instructions…

Mia
- 241
- 1
- 2
- 7
7
votes
3 answers
Stop replica set on mongo and primary goes into recovery status
When I stop nodes of my replica set and start them up again, the primary node goes into status "recovering".
I have a replica set created, running without authorization. In order to use authorization I have added users "db.createUser(...)", and…

MrElephant
- 302
- 4
- 26
6
votes
2 answers
MongoError: no primary found in replicaset
I have 2 application servers, which are connecting to a replicaSet (Primary, Secondary and Arbitrer).
Issue i'm facing is
[ 'MongoError: no primary found in replicaset',
' at…

dragonfly163
- 111
- 1
- 1
- 8
6
votes
1 answer
What is the correct MONGO_URL setting for replica sets on Meteor 1.4.1.1
This morning I went to deploy my updated Meteor project onto Heroku.
I was upgrading from 1.1.0.3 to 1.4.1.1.
Using the Meteor Buildpack Horse everything installed correctly, but the application was erroring out with the error;
MongoError: seed…

Toby
- 8,483
- 13
- 45
- 68
6
votes
1 answer
Mongodb replica set with Docker 1.12 services
Im wondering as to how to start a mongodb replica set using the new Docker 1.12 swarm mode service model.
starting a service allows you to specify a number of container replicas, which in the minimal replica set case would be 3. but how would then…

deepblue
- 8,426
- 13
- 48
- 60