Questions tagged [replicaset]

This tag is used mostly for a MongoDB replica set (a group of "mongod" processes that maintain the same data set) and rarely for a Kubernetes ReplicaSet (the next-generation Replication Controller with set-based selector support).

583 questions
4
votes
0 answers

seeding a new replica set member with mongorestore is not recommended, why?

In docs, I found the following statement: IMPORTANT Always use filesystem snapshots to create a copy of a member of the existing replica set. Do not use mongodump and mongorestore to seed a new replica set member. what do I have to do if my…
Sergey Grechin
  • 876
  • 11
  • 14
4
votes
1 answer

How can I setup mongo replica set with ansible?

I have two machines hosting one mongo instance each. I need them to work together as a replica set. I use Ansible for my provisioning. How can I achieve that ?
Raphaël
  • 1,924
  • 2
  • 18
  • 22
4
votes
1 answer

Update role user: not authorized on admin to execute command

When I try to get info about replica I get the following error: rep0:PRIMARY> rs.printReplicationInfo() 2015-05-19T13:30:29.231+0200 error: { "$err" : "not authorized for query on local.system.namespaces", "code" : 13 } at…
RuBiCK
  • 805
  • 4
  • 12
  • 23
4
votes
0 answers

What does "ha" event in nodejs-mongodb-native@2.x mean?

I'm using MongoDB with a replica set with RF=3. There's an event "ha" in the docs and as I see its impact on update op is huge: [Wed Apr 29 2015 09:00:13 GMT+0300 (MSK)] [pid 7251] update took 0ms for uuid 08ecd93346daa1b8b6fef1772cea0469 [Wed Apr…
Dmitrii Sorin
  • 3,855
  • 4
  • 31
  • 40
4
votes
1 answer

How can I know when MongoDB recovering will end

As per title, I have a replicaSet with 1 primary, 1 secondary and 1 arbiter, I restored a big DB in the primary and it is a much faster instance than the secondary. Now the secondary is lagging a lot (hours) and it's in recovery status since…
michelem
  • 14,430
  • 5
  • 50
  • 66
4
votes
0 answers

Node.js/Mongoose does not automatically reconnect to primary after primary restored

In a hosted MEAN stack application the following happened with the MongoDB replica set as reported by the hosting company's tech support: There was a three minute window where a new primary was briefly elected. It looks like some network issues…
Guy
  • 65,082
  • 97
  • 254
  • 325
4
votes
1 answer

Does mongoose.mongo.MongoClient.connect() works without mongo shell?

I am connecting to the mongo servers that are not localhost. I am using mongoose. And in some moment I needed to connect with mongo native driver so I am doing it like: mongoose.mongo.MongoClient.connect(uri, function (err, conn) {}); but conn…
Nenad
  • 65
  • 6
4
votes
0 answers

How can i run db.currentOp() from php against a specific mongodb secondary in a replicaset?

I am trying to run the db.currentOp() command against different members of a mongodb ReplicaSet to see their currently running queries. The only one I get data from is the master, all the secondaries respond with: array(3) { 'errmsg' => …
Robo47
  • 41
  • 2
3
votes
1 answer

Automatically initialize replica set for mongoDB in docker fails

I have a NodeJS Express App that depends on MongoDB change streams. For them to be available, MongoDB has to be configured to run as a replica set (even if there is only one node in that set). I'm working on Windows 10 pro. I'm trying to dockerize…
NoBullsh1t
  • 483
  • 4
  • 14
3
votes
1 answer

MongoDB - ReplicaSet - Failed to refresh key cache

I am deploying my first replica set on a Windows 10 machine with MongoDB 5.0. For the purpose of the tutorial, I want all the servers running on my machine, on different ports. A) I created my first server with : mongod --replSet rs0 --port 27018…
user3722440
  • 243
  • 1
  • 6
  • 14
3
votes
1 answer

How to connect to a Mongo Standalone ReplicaSet, running in Docker, with Mongoose 6.0.8?

Connecting to a MongoDB (with ReplicaSet) running in Docker worked in 5.13.9 but fails in 6.0.8 docker-compose.yml for the database: This is the docker-compose.yml file for the Database: version: '3.9' services: loggerdb: image: mongo …
BertC
  • 2,243
  • 26
  • 33
3
votes
2 answers

Mongo ReplicaSet in Docker - couldn't add user: not master

I am trying to set up a ReplicaSet but I'm having problem with the initialisation. The FIRST time I run db_1 | uncaught exception: Error: couldn't add user: not master And each time after db_1 |…
Brian
  • 1,026
  • 1
  • 15
  • 25
3
votes
1 answer

Problem while rs.initiate() for setup docker-compose for replica set

I want to setup MongoDB replica set with docker-compose with only one node. This is my docker-compose.yml file: version: '3.7' services: mongodb1: image: mongo:latest command: mongod --replSet rs0 ports: - 27017:27017 …
Eziz Durdyyev
  • 1,110
  • 2
  • 16
  • 34
3
votes
1 answer

As of MongoDB 4, how to check if authentication is enabled

I have had an elaborated check picked here and there on my ansible playbook to check whether authentication is enabled on mongo and it seems it doesn't work any longer with 4.0. Up to now it always works as expected. /usr/bin/mongo --eval…
black sensei
  • 6,528
  • 22
  • 109
  • 188
3
votes
1 answer

Connecting to replica set members through a removed member

I have a simple replica set with 3 members Ouput of rs.status() { ..., "members" : [ { "_id": 1, "name": "localhost:27021", "stateStr": "PRIMARY", }, { "_id": 2, …
Sreeragh A R
  • 2,871
  • 3
  • 27
  • 54