0

I have 2 node replica-set

Vm1 - Primary 10.1.0.2 Priority = 2

Vm2 - Secondary 10.1.0.3 Priority = 1

Now I am trying to add a new node (Vm3 10.1.0.4 - Secondary Priority = 0) based on Data folder from Secondary. (I stopped the mongod on secondary, then create a snapshot)

Now when I add the Vm3 on my replica set when I check the mongod.log here is the error:

{"t":{"$date":"2022-06-06T22:05:13.172+08:00"},"s":"I", "c":"NETWORK", "id":22990, "ctx":"conn268","msg":"DBException handling request, closing client connection","attr":{"error":"NotWritablePrimary: Not-primary error while processing 'find' operation on 'investastock_ta' database via fire-and-forget command execution."}}

There is also an error that the node is too stale to use candidate as a sync source

3
  • According to Add Members to the Replica Set you have to take the copy from the PRIMARY. Or add an empty member using Initial Sync. Jun 7 at 12:22
  • Did you restart the secondary? Note, 1 out of 2 nodes is not the majority, thus it has no writable PRIMARY Jun 7 at 12:24
  • @WernfriedDomscheit thanks. i missed that part that the copy must be from the PRIMARY even if mongodb service is running. I already made it work
    – JRA
    Jun 8 at 2:10

1 Answer 1

0

Already fixed. The copy should be from the PRIMARY and not from a SECONDARY node. No downtime needed in my end even if the PRIMARY node is running when I took a snapshot. Running on MongoDB 4.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.