Questions tagged [mongodb-replica-set]

MongoDB's replica set uses redundant nodes to provide a high availability and resilience against network partitions of the primary node.

333 questions
3
votes
4 answers

How to connect to mongodb replicaset (k8s) using compass

I installed mongodb as a replicaset with 3 replicas on my k8s cluster using the bitnami helm chart. So I get these…
user3142695
  • 15,844
  • 47
  • 176
  • 332
3
votes
1 answer

How to mongo shell in quiet mode with a replica set

When I try to execute a JavaScript code using --eval, mongo shell generates extra output, --quiet option doesn't seem to work check_mongodb_availability() { local hostname=$1 local database=$2 local js=" var found = 0; var dbs =…
Mahela Wickramasekara
  • 603
  • 1
  • 11
  • 22
3
votes
3 answers

Error restarting mongo.service trying to add multiple bind ip in mongodb 4.2

I am using mongodb 4.2 version. I am trying to make replicaset following this article but when I try to bind like in this screenshot mongo service fails to restart and show errors like: any ways to fix this? have tried all the Q&A about mongo from…
sssanjaya
  • 569
  • 6
  • 21
3
votes
1 answer

Form a new replica set with removed members

How to configure removed members of a replica set to form new replica set? I have a replica set with 4 mongod instances Output of rs.config() { "_id" : "rs0", "members" : [ { "_id" : 0, "host" :…
Sreeragh A R
  • 2,871
  • 3
  • 27
  • 54
3
votes
1 answer

Calling rs.status immediately after rs.initiate throws auth error

I have put all the steps to initiate a replica-set in a shell script. Basically, I am trying to convert a standalone instance A to replica-set that includes one arbiter B and one secondary node C. These are the following steps in the script: Start…
Eman Zaman
  • 31
  • 3
3
votes
2 answers

Unable to start com.bitnami.mongodb

I'm using MongoDB with replication on azure and I have attached an SSD disk to MongoDB node and mounted on a specific path. And I changed MongoDB data and logs path to specific path in MongoDB.conf(/opt/bitnami/mongodb/conf/mongodb.conf) file. But…
3
votes
2 answers

Requires simple explanation on Arbiter's role in a given mongoDB replica set

I came across MongoDB official site explaining on having odd number of members replica set up. I also heard of the term Arbiter from the same site, which based on my understanding, it will not be elected as primary and it does participate on…
3
votes
1 answer

Data loss due to unexpected failover of MongoDB replica set

So I encountered the following issue recently: I have a 5-member set replica set (priority) 1 x primary (2) 2 x secondary (0.5) 1 x hidden backup (0) 1 x arbiter (0) One of the secondary replicas with 0.5 priority (let's call it B) encountered…
Reuben L.
  • 2,806
  • 2
  • 29
  • 45
3
votes
1 answer

Mongo replica set can't find primary

I found a tutorial to set up a mongo replica set using docker, my commands were create network cluster sudo docker network create curator-cluster create a particular container named mongo1, map 27018 to 27017 inside and set name is rs0 sudo docker…
Bryan
  • 1,477
  • 1
  • 21
  • 38
3
votes
2 answers

MongoDB Primary fails to come back

I have a MongoDB 3 member replica set running on Windows. When the primary server (S1) goes down, the secondary is elected correctly. When the primary server comes back up, the replica member stays in an invalid state: { "state" :…
perfect_element
  • 663
  • 9
  • 15
3
votes
1 answer

Should I use hostname or IP address for mongodb connection string

I've set up a MongoDB replica set with 3 nodes. All servers live in the same VPC, but in different availability zones. Thanks to etc/hosts file, in while I describe where to find the other nodes, my replica set is able to communicate between nodes.…
Laurent Rivard
  • 509
  • 4
  • 13
3
votes
1 answer

Is the ReplicaSet name necessary in MongoClientURI Connection String?

I am confused about the use/need of the MongoDB connection string replicaSet option, when specifying a client URI for connection to a MongoDB replica set from a Java application. I have 3 node instances of MongoDB running comprising the replica set,…
user1104028
  • 381
  • 7
  • 18
3
votes
1 answer

reading data from specific nodes in mongo replica set

I have a replica set of three members. Is it possible that I just want to read from one of the two secondary nodes? I use following code where the ip is one of the secondary, but I still saw the traffic was deployed to other nodes. Mongo mongo = new…
billtian
  • 6,589
  • 4
  • 18
  • 28
2
votes
2 answers

How does mongo replica set elections behave when some nodes are dead?

Let’s say I have 5 nodes replica set. 3 of them are dead, 2 alive. How would the majority will be calculated? 5 nodes majority would be 5/2+1=3 but if 3 nodes are dead, will it still look for 3 votes? There are only 2 alive so only 2 votes… or the…
2
votes
0 answers

Would like to downscale deployment replicas to 1

Currently, the deployment replicas are set as 2. I'm trying to scale down deployments to 1 using the below command kubectl scale deploy -n myspace --replicas=1 --all it terminates but spins back to 2. How can I scale down?
1 2
3
22 23