1

I've got 3 nodes in a replica set.

Each time when performing a mongorestore from the Master, the secondaires go into a RECOVERING state. The oplog cannot keep up. unfortunately I cannot increase the oplog size because lack of disk space.

Now, I want to perform a manual restore by copying the files. https://docs.mongodb.com/manual/tutorial/resync-replica-set-member/

Here is a snippet of the files which I got:

meee@mongo-p01:~$ sudo ls -la /var/lib/mongodb
[sudo] password for meee:
total 44052516
drwxr-x---   4 mongodb root          4096 Feb 22 17:54 .
drwxr-xr-x. 32 root    root          4096 Feb 23 01:59 ..
-rw-------   1 mongodb mongodb   67108864 Feb 22 17:54 mymongobase.0
-rw-------   1 mongodb mongodb  134217728 Feb 22 17:08 mymongobase.1
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.10
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:12 mymongobase.11
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.12
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.13
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.14
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.15
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:14 mymongobase.16
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:15 mymongobase.17
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:21 mymongobase.18
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:51 mymongobase.19
-rw-------   1 mongodb mongodb  268435456 Feb 22 17:08 mymongobase.2
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:51 mymongobase.20
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 mymongobase.21
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 mymongobase.22
-rw-------   1 mongodb mongodb  536870912 Feb 22 17:08 mymongobase.3
-rw-------   1 mongodb mongodb 1073741824 Feb 22 17:08 mymongobase.4
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:11 mymongobase.5
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:53 mymongobase.6
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 mymongobase.7
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 mymongobase.8
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:53 mymongobase.9
-rw-------   1 mongodb mongodb   16777216 Feb 22 17:54 mymongobase.ns
drwxr-xr-x   2 mongodb mongodb         40 Feb 22 17:54 journal
-rw-------   1 mongodb mongodb   67108864 Feb 22 17:07 local.0
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 local.1
-rw-------   1 mongodb mongodb 2146435072 Feb 22 17:54 local.2
-rw-------   1 mongodb mongodb   16777216 Feb 22 17:54 local.ns
-rwxr-xr-x   1 mongodb mongodb          6 Feb 22 17:06 mongod.lock
drwxr-xr-x   2 mongodb mongodb          6 Feb 22 17:54 _tmp

What are the correct steps I should take?

    1. Reset all mongos by reïnstalling
    1. Perform a mongorestore on the master
    1. Right after the restore, stop all mongod
    1. Copy all local.x and mymongobase.x files to other nodes
    1. Start mongod on all nodes?

I'm a bit lost here.

1
  • Ensure you have enough disk space!
  • Shutdown mongos on all 3 nodes
  • From Master node; tar all local* and mymongobase* files
  • SCP files to 2 secondaries
  • Unpack files in mongo data location (/var/lib/mongodb)
  • Start mongod on all nodes

Works for me

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.