replicaset - Mongodb replica set questions -


i have mongodb replica set configuration of 1 primary machine, 1 secondary machine , 1 arbiter machine. primary , secondary machines have 2 collections (each in own database)

i need delete few gb 1 collection , leave other collection intact. brand new @ ideas/gotchas on this. thinking of following procedure:

  1. remove secondary replica set.
  2. in secondary, collection want delete, mongodump of data want keep.
  3. do mongo restore dump.
  4. re-add secondary replica set. think have set priorities primary not become secondary?
  5. the secondary sync/catch primary hope happens data deleted in secondary? primary removes itself? (which want)

  6. do need primary?

rolling maintenance:

  • to see how time of oplog have, bring down secondary , catchup : db.printreplicationinfo()
  • when working primary, secondary , arbiter ... taking out secondary can have risk. primary won't have failover in case happens during maintenance period. primary-secondary-secondary safer.
  • after shutdown secondary, restart without --replset option , on different port otherwise rest of replicaset confused.
  • restart secondary --replset , old port again add replicaset. don't worry, primary stay primary. voting/election 'only' happens when primary has disappeared ... , not case when adding secondary.
  • the secondary catch oplog.
  • to work on primary. rs.stepdown() on primary, let secondary take over, , repeat process.

cleanup during rolling maintenance

here not sure , can make guesses because didn't test yet. can during rolling maintenance is:

  • update binaries (apt-get update/yum update/...)
  • build indexes
  • compact , repair

now deleting data? need test on local small replica.

  • i'm afraid dump/restore bad idea. i'm not sure.
  • execute remove statement... think there way that, , let statement execute on primary don't know how yet.
  • most simple: why not execute remove statement on primary , let spread secondary? because want decrease database size? well, after remove can rolling maintenance repair. compact not create space, order data inside pre-allocated files. , repair, careful, needs double space build. 100gb db needs @ least 100gb free space repair.

https://dba.stackexchange.com/questions/28269/disk-space-recovery-on-mongodb-replicaset-secondaries

and have @ https://university.mongodb.com => m202: mongodb advanced deployment , operations ... issue handled in free lessons.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -