Guest User

Untitled

a guest
Jan 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. mongos> sh.getBalancerState()
  2. true
  3. mongos> sh.isBalancerRunning()
  4. false
  5.  
  6. sh.startBalancer()
  7.  
  8. mongos> sh.getBalancerState
  9. function () {
  10. var x = db.getSisterDB( "config" ).settings.findOne({ _id: "balancer" } )
  11. if ( x == null )
  12. return true;
  13. return ! x.stopped;
  14. }
  15.  
  16. mongos> sh.stopBalancer()
  17. Waiting for active hosts...
  18. Waiting for the balancer lock...
  19. Waiting again for active hosts after balancer is off...
  20. mongos> sh.getBalancerState()
  21. false
  22.  
  23. mongos> sh.startBalancer()
  24. mongos> sh.getBalancerState()
  25. true
  26.  
  27. mongos> sh.isBalancerRunning()
  28. false
  29.  
  30. mongos> sh.getBalancerState()
  31. false
  32. mongos> sh.status()
  33. --- Sharding Status ---
  34. sharding version: {
  35. "_id" : 1,
  36. "version" : 3,
  37. "minCompatibleVersion" : 3,
  38. "currentVersion" : 4,
  39. "clusterId" : ObjectId("53b5d3b5d95df3a66a597548")
  40. }
  41. shards:
  42. { "_id" : "shard0000", "host" : "localhost:30000" }
  43. { "_id" : "shard0001", "host" : "localhost:30001" }
  44. { "_id" : "shard0002", "host" : "localhost:30002" }
  45. databases:
  46. { "_id" : "admin", "partitioned" : false, "primary" : "config" }
  47. { "_id" : "test", "partitioned" : false, "primary" : "shard0001" }
  48. { "_id" : "users", "partitioned" : true, "primary" : "shard0001" }
  49. users.userInfo
  50. shard key: { "_id" : 1 }
  51. chunks:
  52. shard0001 2049
  53. too many chunks to print, use verbose if you want to force print
  54.  
  55. mongos> sh.isBalancerRunning()
  56. false
  57. mongos> sh.isBalancerRunning()
  58. true
  59.  
  60. mongos> sh.isBalancerRunning
  61. function () {
  62. var x = db.getSisterDB("config").locks.findOne({ _id: "balancer" });
  63. if (x == null) {
  64. print("config.locks collection empty or missing. be sure you are connected to a mongos");
  65. return false;
  66. }
  67. return x.state > 0;
  68. }
  69.  
  70. db.getSisterDB("config").locks.findOne({ _id: "balancer" });
  71. {
  72. "_id" : "balancer",
  73. "process" : "adamc-mbp:30999:1404425140:16807",
  74. "state" : 2,
  75. "ts" : ObjectId("53b5d86fd95df3a66a5975ff"),
  76. "when" : ISODate("2014-07-03T22:25:51.574Z"),
  77. "who" : "adamc-mbp:30999:1404425140:16807:Balancer:1622650073",
  78. "why" : "doing balance round"
  79. }
  80. db.getSisterDB("config").locks.findOne({ _id: "balancer" });
  81. {
  82. "_id" : "balancer",
  83. "process" : "adamc-mbp:30999:1404425140:16807",
  84. "state" : 0,
  85. "ts" : ObjectId("53b5d86ed95df3a66a5975fe"),
  86. "when" : ISODate("2014-07-03T22:25:50.528Z"),
  87. "who" : "adamc-mbp:30999:1404425140:16807:Balancer:1622650073",
  88. "why" : "doing balance round"
  89. }
Add Comment
Please, Sign In to add comment