In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Take on the last article
14. Configure the balancer process in the cluster
The balancer process runs on one of the mongos instances in the cluster, ensuring that the chunks is evenly distributed across the cluster.
Change the maximum storage size of the specified shard
15. Remove a shard from an existing sharding cluster
Before removing a shard, you need to make sure that the data on that shard has been moved to another shard.
1) make sure that the Blancer process is enabled
Sh.getBalancerState ()
2) determine the name of the shard to be removed
Db.adminCommand ({listShards: 1})
Or
Db.printShardingStatus ()
Or
Sh.status ()
3) remove data blocks from the shard
Mongos > use admin;switched to db adminmongos > db.runCommand ({removeShard: "taiwan_shard1"}) {"msg": "draining started successfully", "state": "started", "shard": "taiwan_shard1", "ok": 1}
Depending on the state of the network and the amount of data, this operation may take several minutes or days to complete.
4) check the status of the migration
Mongos > db.runCommand ({removeShard: "taiwan_shard1"}) {"msg": "draining ongoing", "state": "ongoing", "remaining": {"chunks": NumberLong (0), "dbs": NumberLong (2)}, "note": "you need to drop or movePrimary these databases" "dbsToMove": ["taiwan_game4", "taiwan_game5"], "ok": 1}
It is important to note that if a shard is the primary shard of one or more databases, then the shard contains unshredded data.
Mongos > use admin Switched to db adminmongos > db.runCommand ({movePrimary: "taiwan_game4", to: "taiwan_shard2"}) {"primary": "taiwan_shard2:taiwan_shard2/gintama-taiwan-mongodb2:28018", "ok": 1} mongos > db.runCommand ({movePrimary: "taiwan_game5", to: "taiwan_shard2"}) {"primary": "taiwan_shard2:taiwan_shard2/gintama-taiwan-mongodb2:28018" "ok": 1}
5) end the migration process
Mongos > db.runCommand ({removeShard: "taiwan_shard1"}) {"msg": "removeshard completed successfully", "state": "completed", "shard": "taiwan_shard1", "ok": 1}
When the state status is completed, the migration is complete.
Reference documentation:
Http://docs.mongodb.org/v2.4/tutorial/remove-shards-from-cluster/
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.