Running into some problems doing what the subject says. One twist is that the snapshots may not have the same rs.conf which is needed on the new stack.
This is a simple set with primary, secondary, arb.
To that end, I have the following sequence of operations:
1) create volumes from snapshots <= works fine
2) attach volumes <= works fine
3) mdadm --assemble ..... <= works fine
4) mount /dev/mdXXX /mountpoint <= works fine
5) rm -rf /path/to/data/local.* <= works fine
6) rm -rf /path/to/data/mongod.lock <= works fine
7) service mongodb start <= works fine
8) mongo script_which_does_rs.initiate() <= Not so good
This gets me the message that db2 in the set 'has data'. db2 shows:
> show dbs;
admin (empty)
local (empty)
test 0.203125GB
so for the sake of completeness, I stopped mongo, removed the test.* files and restarted mongodb. This gives:
> show dbs;
local (empty)
>
and after waiting a few minutes, I see that the 'admin' database has appeared.
Trying to rs.initiate() from db1, it tells me that db2 is 'not ok'. After waiting a few more minutes I try again, and it works.....
So... from all this, how should I formulate an exact, programmatically
repeatable sequence of steps by which I can bring up a replSet from old
EC2 snapshots?
TIA.