[SERVER-2680] Better balancer interface Created: 04/Mar/11  Updated: 12/Jul/16  Resolved: 29/Apr/11

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 1.9.0

Type: Improvement Priority: Minor - P4
Reporter: Kyle Banker Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

User interaction with the balancer could be improved.

Currently, to disable the balancer, users have to $set

{stopped: true}

in the balancer document. This is error-prone (it'd be easy to misspell "stopped', etc.) and there's no feedback.

I propose a couple of commands for changing the balancer's state and getting the balancer's status.

For example:

db.runCommand(

{balancerstatus: 1}

)
Returns:

{ state: 1,
msg: "Balancing round"
ops: [
describe what's scheduled for this round / what's currently happening
]
}

db.runCommand(

{disablebalancer: 1}

)

This prints a message indicating current balancer state and blocks if balancer is in the middle of something.

db.runCommand(

{enablebalancer: 1}

)

Re-enables balancing.



 Comments   
Comment by auto [ 29/Apr/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: shell helpers for turning on/off balancer SERVER-2680
Branch: master
https://github.com/mongodb/mongo/commit/c574959c57f3f66dcdd41a244f08b687ca03480b

Comment by Kyle Banker [ 04/Mar/11 ]

I think that makes sense.

maybe use "cluster" as the prefix instead:

cluster.stopBalancer();

Main thing to make balancer operations more determinate and predictable from the user's perspective.

Comment by Eliot Horowitz (Inactive) [ 04/Mar/11 ]

What do you think of a similar thing to the rs helper

so

sharding.stopBalancer()
sharding.startBalancer()

sharding.addShard( "..." )
sharding.enableSharding( "test" )

...

Generated at Thu Feb 08 03:00:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.