Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mongos> sh.getBalancerState()
- true
- mongos> sh.isBalancerRunning()
- false
- sh.startBalancer()
- mongos> sh.getBalancerState
- function () {
- var x = db.getSisterDB( "config" ).settings.findOne({ _id: "balancer" } )
- if ( x == null )
- return true;
- return ! x.stopped;
- }
- mongos> sh.stopBalancer()
- Waiting for active hosts...
- Waiting for the balancer lock...
- Waiting again for active hosts after balancer is off...
- mongos> sh.getBalancerState()
- false
- mongos> sh.startBalancer()
- mongos> sh.getBalancerState()
- true
- mongos> sh.isBalancerRunning()
- false
- mongos> sh.getBalancerState()
- false
- mongos> sh.status()
- --- Sharding Status ---
- sharding version: {
- "_id" : 1,
- "version" : 3,
- "minCompatibleVersion" : 3,
- "currentVersion" : 4,
- "clusterId" : ObjectId("53b5d3b5d95df3a66a597548")
- }
- shards:
- { "_id" : "shard0000", "host" : "localhost:30000" }
- { "_id" : "shard0001", "host" : "localhost:30001" }
- { "_id" : "shard0002", "host" : "localhost:30002" }
- databases:
- { "_id" : "admin", "partitioned" : false, "primary" : "config" }
- { "_id" : "test", "partitioned" : false, "primary" : "shard0001" }
- { "_id" : "users", "partitioned" : true, "primary" : "shard0001" }
- users.userInfo
- shard key: { "_id" : 1 }
- chunks:
- shard0001 2049
- too many chunks to print, use verbose if you want to force print
- mongos> sh.isBalancerRunning()
- false
- mongos> sh.isBalancerRunning()
- true
- mongos> sh.isBalancerRunning
- function () {
- var x = db.getSisterDB("config").locks.findOne({ _id: "balancer" });
- if (x == null) {
- print("config.locks collection empty or missing. be sure you are connected to a mongos");
- return false;
- }
- return x.state > 0;
- }
- db.getSisterDB("config").locks.findOne({ _id: "balancer" });
- {
- "_id" : "balancer",
- "process" : "adamc-mbp:30999:1404425140:16807",
- "state" : 2,
- "ts" : ObjectId("53b5d86fd95df3a66a5975ff"),
- "when" : ISODate("2014-07-03T22:25:51.574Z"),
- "who" : "adamc-mbp:30999:1404425140:16807:Balancer:1622650073",
- "why" : "doing balance round"
- }
- db.getSisterDB("config").locks.findOne({ _id: "balancer" });
- {
- "_id" : "balancer",
- "process" : "adamc-mbp:30999:1404425140:16807",
- "state" : 0,
- "ts" : ObjectId("53b5d86ed95df3a66a5975fe"),
- "when" : ISODate("2014-07-03T22:25:50.528Z"),
- "who" : "adamc-mbp:30999:1404425140:16807:Balancer:1622650073",
- "why" : "doing balance round"
- }
Add Comment
Please, Sign In to add comment