HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Add an arbiter to mongodb ReplicaSet failed

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
arbitermongodbreplicasetfailedadd

Problem

I am new to mongodb and this is my second post in order to build a test cluster and gain knowledge at the same time. I have a 3 nodes cluster holding server MONGO2, MONGO3 and MONGOARB1. MONGO2 and MONGO3 are in replicaset "rs0" and works great :

rs0:PRIMARY> rs.conf()
{
        "_id" : "rs0",
        "version" : 3,
        "term" : 9,
        "members" : [
                {
                        "_id" : 0,
                        "host" : "MONGO2:27017",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "secondaryDelaySecs" : NumberLong(0),
                        "votes" : 1
                },
                {
                        "_id" : 1,
                        "host" : "MONGO3:27017",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "secondaryDelaySecs" : NumberLong(0),
                        "votes" : 1
                }
        ],


I'd like to add an arbiter to my PSA cluster as described here :
https://docs.mongodb.com/manual/tutorial/add-replica-set-arbiter/

So following the documentation:

  • Create a specific directory => OK (C:\MONGO\arb)



  • Start the arbiter, specifying the data directory and the name of the replica set to join => OK : ./mongod.exe --port 27017 --dbpath C:\MONGO\arb --replSet rs0 --bind_ip_all



"msg":"Failed to refresh key
cache","attr":{"error":"NotYetInitialized: Cannot use non-local read
concern until replica set is finished
initializing.","nextWakeupMillis":24200}}

  • Connect to the primary and add the arbiter to the replica set. => KO rs.addArb("MONGOARB1:27017");



After this last command n

Solution

In your primary mongodb shell, execute following:

db.adminCommand({
   "setDefaultRWConcern" : 1,
   "defaultWriteConcern" : {
     "w" : 1
   }
 })


this should resolve the issue.

Code Snippets

db.adminCommand({
   "setDefaultRWConcern" : 1,
   "defaultWriteConcern" : {
     "w" : 1
   }
 })

Context

StackExchange Database Administrators Q#306002, answer score: 3

Revisions (0)

No revisions yet.