Reputation: 401
sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5dfa6c3cb121a735f9ad8f6e")
}
shards:
{ "_id" : "s0", "host" : "s0/localhost:37017,localhost:37018,localhost:37019", "state" : 1 }
{ "_id" : "s1", "host" : "s1/localhost:47017,localhost:47018,localhost:47019", "state" : 1 }
{ "_id" : "s2", "host" : "s2/localhost:57017,localhost:57018,localhost:57019", "state" : 1 }
active mongoses:
"4.2.1" : 1
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: no
Balancer active window is set between 00:00 and 23:59 server local time
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "apple", "primary" : "s2", "partitioned" : true, "version" : { "uuid" : UUID("20431f1a-ddb1-4fac-887e-c4c5db01b211"), "lastMod" : 1 } }
apple.user
shard key: { "userId" : 1 }
unique: false
balancing: true
chunks:
undefined undefined
too many chunks to print, use verbose if you want to force print
{ "_id" : "config", "primary" : "config", "partitioned" : true }
config.system.sessions
shard key: { "_id" : 1 }
unique: false
balancing: true
chunks:
undefined undefined
too many chunks to print, use verbose if you want to force print
After starting balancing using sh.startBalancer() when I see the status the balancer running status is still false.
Is there anything need to configure while creating shard?
Upvotes: 0
Views: 1373
Reputation: 14287
After starting balancing using sh.startBalancer() when I see the status the balancer running status is still false.
Balancer is a process which is responsible for evenly distributing chunks across a sharded cluster. It is an automatic process. By default, the balancer is enabled. It runs on the primary of the config server replica-set (mongos in 3.4 version or earlier).
The balancer runs only when needed. The balancer process checks the chunk distribution across the cluster and looks for certain migration thresholds. It identifies which shard has too many chunks in the cluster. If it detects an imbalance it starts a Balancer Round. It moves the chunks across shards in the cluster in an attempt to achieve an even data distribution.
From the sh.status
output in the post, the balancer is enabled and not running.
balancer:
Currently enabled: yes Currently running: no
NOTE: The balancer will run automatically when even chunk distribution is needed.
You can manually start and stop the balancer any time; the commands sh.startBalancer()
enable the balancer and sh.stopBalancer()
disables the balancer temporarily when needed.
sh.getBalancerState()
tells if the balancer is enabled and or not. sh.enableBalancing()
does not start balancing. Rather, it allows balancing of a collection the next time the balancer runs.
Reference: See Sharded Cluster Balancer.
Upvotes: 1