MongoDB Grooming Note Removal Shard Server

Source: Internet
Author: User

Sometimes there is limited hardware resources, so we have to do some recycling, we have just enabled Shard server recycling, the system first will be removed on the Shard server data on the first evenly distributed on the other Shard server, And then finally kicking the Shard Server off the line, we need to keep calling Db.runcommand ({"Removeshard": "localhost:20002"}) to see where this removal is going:

>Use adminswitched to DB admin> Db.runcommand ({"Removeshard": "localhost:20002"}); {"MSG": "Draining started successfully","State": "Started","Shard": "shard0002","OK": 1}> Db.runcommand ({"Removeshard": "localhost:20002"}); {"MSG": "Draining ongoing","State": "ongoing","Remaining" : {"Chunks": Numberlong (44),"DBS": Numberlong (0)},"OK": 1} ...> Db.runcommand ({"Removeshard": "localhost:20002"}); {"MSG": "Draining ongoing","State": "ongoing","Remaining" : {"Chunks": Numberlong (1),"DBS": Numberlong (0)},"OK": 1}> Db.runcommand ({"Removeshard": "localhost:20002"}); {"MSG": "Removeshard completed successfully","State": "Completed","Shard": "shard0002","OK": 1}> Db.runcommand ({"Removeshard": "localhost:20002"}); {"Assertion": "Can ' t find Shard for:localhost:20002","Assertioncode": 13129,"ErrMsg": "DB assertion Failure","OK": 0}
View Code

After the final removal, when we call Db.runcommand again ({"Removeshard": "localhost:20002"}), the system will error, we have notified that there is no 20002 this port of the Shard Server, Because it has been removed.

>Use testswitched to DB test>db.users_2.stats () {"Sharded":true,"NS": "Test.users_2","Count": 500000,"Size": 48000000,"Avgobjsize": 96,"Storagesize": 95203584,"Nindexes": 1,"Nchunks": 92,"Shards" : {"shard0000" : {"NS": "Test.users_2","Count": 248749,"Size": 23879904,"Avgobjsize": 96,"Storagesize": 61875968,"Numextents": 11,"Nindexes": 1,"Lastextentsize": 15001856,"Paddingfactor": 1,"Flags": 1,"Totalindexsize": 13033472,"Indexsizes" : {"_id_": 13033472},"OK": 1},"Shard0001" : {"NS": "Test.users_2","Count": 251251,"Size": 24120096,"Avgobjsize": 96,"Storagesize": 33327616,"Numextents": 8,"Nindexes": 1,"Lastextentsize": 12079360,"Paddingfactor": 1,"Flags": 1,"Totalindexsize": 10469376,"Indexsizes" : {"_id_": 10469376},"OK": 1}},"OK": 1}
View Code

You can see that the data has been evenly distributed on another 2 shard servers!

MongoDB Grooming Note Removal Shard Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.