Skip to content

Instantly share code, notes, and snippets.

@noblejasper
Last active July 11, 2016 10:32
Show Gist options
  • Save noblejasper/3088a95eca56859206c7 to your computer and use it in GitHub Desktop.
Save noblejasper/3088a95eca56859206c7 to your computer and use it in GitHub Desktop.
MongoDBのCollectionを削除しても容量が減らない対応 ref: http://qiita.com/noblejasper/items/4f391309ced03ae02e7e
set:PRIMARY> use dbname;
set:PRIMARY> db.collectionname.drop()
set:PRIMARY> rs.remove("10.120.41.196:27017")
set:REMOVED> use admin;
set:REMOVED> db.shutdownServer();
$ sudo rm -r /var/lib/mongodb/*
$ sudo rm -r /var/log/mongodb/*
$ sudo service mongod start
set:PRIMARY> rs.add("10.120.41.196:27017") # 追加するSECONDARY
> rs.syncFrom('10.120.41.199:27017') # もう一つのSECONDARY
> rs.syncFrom('10.120.41.199:27017') # もう一つのSECONDARY
set:PRIMARY> rs.status()
set:PRIMARY> rs.freeze(15)
set:PRIMARY> rs.stepDown(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment