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
1
vote
0 answers

Node.js MongoClient cannot connect to replica set after primary down

With node.js mongodb ver. 2.2.25, I use the following connection string to connect to a replica set with primary node down but failed: mongodb://user:pass@host1:port1,host2:port2/dbname However, I can use the same connection string with a PHP mongo…
konghou
  • 557
  • 7
  • 20
1
vote
2 answers

Mongodb replica across multiple AWS geographic regions

I am currently trying to determine the best way to implement across region replica set for Mongodb in AWS. My 3 replica set would be distributed over multiple regions, not just multiple availability zones. For example, the primary would be in east…
1
vote
0 answers

Mongo possible data corruption returning secondary to replica set

I am trying to understand the source of some data corruption that occurred around the same time a secondary was returned to a replica set. We have a production replica set with 4 nodes - 3 data carrying nodes and an arbiter. I took a secondary (call…
rmin
  • 1,018
  • 1
  • 9
  • 18
1
vote
0 answers

Is that possible to define mongo::DBClientReplicaSet as a global variable in a class?

I am using c++ legacy driver, I built a class with many mongoDB operations in different functions. I don't want to define the mongo::DBClientReplicaSet in every function but if I define it in the global level, I had another problem because I need to…
Harold
  • 33
  • 5
1
vote
1 answer

A non-voting members of a MongoDB replica set can become a primary?

I'm trying to set to 0 the number of votes of a replica set member via a mongo shell connected to the primary, but i get an error when i call: rstest:PRIMARY> rs.reconfig(conf) { "ok" : 0, "errmsg" : "priority must be 0 when non-voting…
1
vote
0 answers

Prevent reads to primary from secondary

I have a two-machine MongoDB replica set. The primary is private (used internally) and it is critical that it stays running smoothly. The secondary is our public copy of the primary which is non-voting. It does not matter much if the secondary…
Randomblue
  • 112,777
  • 145
  • 353
  • 547
1
vote
1 answer

why is the mongodb oplog is idempotent? Even for insert operation?

I am learning the replica set function of mongodb and when i read this article: replica set oplog it said: Each operation in the oplog is idempotent. That is, oplog operations produce the same results whether applied once or multiple times to the…
tomwang1013
  • 1,349
  • 2
  • 13
  • 27
1
vote
0 answers

Why does php MongoClient::getHosts show more hosts than nodes exist?

We have a mongodb replica set with 3 nodes (db01-03) running as replica set "rs0". When getting hosts info via MongoClient::getHosts(), the primary server SOMETIMES is being reported twice, once as part of the rs0, once standalone (so it seems?): { …
Xosofox
  • 840
  • 1
  • 7
  • 21
1
vote
0 answers

Node Mongodb error : No valid replicaset instance servers found

We have multiple APIs running on AWS instance on different ports. One of the API is giving error "No valid replicaset instance servers found". Other APIs is working fine. No messages in mongodb log. Tried all other options mentioned in …
Spatil
  • 81
  • 4
1
vote
0 answers

PHP MongoClient connect to Mongodb replica set, about connection string

PHP connection to MongoDB replica set fails after the primary node is removed. I have built a mongodb replica set with five nodes; mongo1 is primary and the others are all secondary. Here is my connection code: $dbmongo_name =…
1
vote
1 answer

Where are mongo replication settings stored?

After a complete reinstall of mongo, it has still remembered the replica set configuration from before; where has it stored this? I installed mongo on a linux server, using our project's user account, into a directory owned by that user. I set up…
Scott Law
  • 708
  • 1
  • 6
  • 16
1
vote
1 answer

Mongodb official image errno:111 Connection refused when trying to create replicaset

I am trying to use the official MongoDB docker image to create a 3-set replication cluster inside a single container. following this official guide I created the following dockerfile: FROM mongo:3.2 RUN mkdir -p /srv/mongodb/rs0-0…
Gleeb
  • 10,773
  • 26
  • 92
  • 135
1
vote
1 answer

MongoDB Atlas User Authentication using node.js

I have a MongoDB Atlas instance, and am able to connect to it, but I am unable to create an account and access the DB from node.js. I can access the DB from Mongo Shell, after using the mongo command below & > 'use mytestcollection'. Trying to…
user3094755
  • 1,561
  • 16
  • 20
1
vote
0 answers

Why does the MongoDB PHP Client create a connection to each member of the replica set?

We have a replicaset with two servers in the connection string, with secondaryPreferred. In case of downtime of the secondary server we want MongoDB to connect to the primary automatically. This works well in "normal" downtime cases, however it…
Marijn Otte
  • 303
  • 2
  • 9
1
vote
1 answer

MongoDB: Different applications connecting to different replicas

We use Mongodb as the central Database for our application; a consumer facing mobile app. At present its a 7-member replica-set with replica-set-1 being the master at the moment. The backend which connects to the mongo replica is build in Ruby on…
Sunil
  • 3,424
  • 2
  • 24
  • 25