Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>According the <code>sh.status()</code> output in the comments, you have 164 chunks on shard0000 (the single host) and 85 on set1 (the replica set). There are a couple of common reasons that this kind of imbalance can happen:</p> <ol> <li>You picked a bad shard key (monotonically increasing or similar)</li> <li>All your data was initially on a single shard and is being rebalanced</li> </ol> <p>The balancer will be continuously attempting to move chunks from the high shard to the low while at the same time moving the max-chunk around (for people that pick the aforementioned monotonically increasing keys, this helps). However, there can only be one migration at the time, so this will take some time, especially if you continue writing/reading from the shards at the same time. If things are really bad, and you did pick a poor shard key, then this may persist for some time.</p> <p>If all your data was on one shard first, and then you added another, then you have a similar problem - it will take a while for the chunk count to stabilise because half the data has to be moved from the original shard (in addition to its other activities) to balance things out. The balancer will pick low range chunks to move first in general, so if these are less likely to be in memory (back to the poor shard key again), then they will have to be paged in before they can be migrated.</p> <p>To check the balancer is running:</p> <p><a href="http://docs.mongodb.org/manual/reference/method/sh.setBalancerState/#sh.getBalancerState" rel="nofollow">http://docs.mongodb.org/manual/reference/method/sh.setBalancerState/#sh.getBalancerState</a></p> <p>Then, to see what it has been up to, connect to a mongos (last 10 operations):</p> <pre><code>use config db.changelog.find().sort({$natural:-1}).limit(10).pretty() </code></pre> <p>Similarly you will see messaging in the primary logs of each shard relating to the migrations, how long they are taking etc. if you want to see their performance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload