[DOCS-387] FAQ entry for shard balancer prioritizing of chunk migrations and draining Created: 09/Aug/12  Updated: 13/Nov/23  Resolved: 21/Feb/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: mongodb-2.2, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Improvement Priority: Blocker - P1
Reporter: Jeremy Mikola Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 10 years, 51 weeks, 6 days ago

 Description   

Scenario:

A sharded system has uneven chunk distribution. The user removes a shard (setting it to drain) and adds new shards. The balancer prioritizes moving chunks to reach equilibrium before draining the removed shard. This priority is not configurable.

Two alternative solutions:

  • Stop the balancer. Write a script to manually move chunks off of the draining shard (using the moveChunk command). Restart the balancer.
  • Set the maxSize on the new shards to some low value so they cannot accept more chunks, which should stop the balancing operation and allow draining to continue (with chunks likely moved to the full shards). Restore the original maxSize value afterwards. When changing maxSize in the config database, you probably need to run the flushRouterConfig command to refresh mongos. Versions of mongos prior to 2.0 won't support this, so you'd need to restart mongos.


 Comments   
Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-21T19:54:24Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: merge: DOCS-387
Branch: master
https://github.com/mongodb/docs/commit/4206fb04c92895b3fbef4ce72cb46f96103db485

Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-20T17:39:52Z', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-387 FAQ entry for shard balancer prioritization

DOCS-387 incorporate Jeremy's comments

DOCS-387 balancer and shard drain
Branch: master
https://github.com/mongodb/docs/commit/a3f5a9ab905f01228f9b429ada8eb283a2387642

Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-20T17:39:52Z', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-387 FAQ entry for shard balancer prioritization

DOCS-387 incorporate Jeremy's comments

DOCS-387 balancer and shard drain
Branch: master
https://github.com/mongodb/docs/commit/a3f5a9ab905f01228f9b429ada8eb283a2387642

Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-20T17:39:52Z', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-387 FAQ entry for shard balancer prioritization

DOCS-387 incorporate Jeremy's comments

DOCS-387 balancer and shard drain
Branch: master
https://github.com/mongodb/docs/commit/a3f5a9ab905f01228f9b429ada8eb283a2387642

Comment by Scott Hernandez (Inactive) [ 12/Sep/12 ]

This is not true with 2.2+. The balancer will first remove chunks from the draining shard before general balancing: https://github.com/mongodb/mongo/blob/master/src/mongo/s/balancer_policy.cpp#L210

With pre-2.2 it will balance first, then move off the draining shard's chunks.
https://github.com/mongodb/mongo/blob/v2.0/s/balancer_policy.cpp#L108

Generated at Thu Feb 08 07:38:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.