Created
March 18, 2016 06:00
-
-
Save umiyosh/ee84cb66de3500f5f583 to your computer and use it in GitHub Desktop.
mongodb getShardDistributionをcollection全部にやるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
set -eu | |
remote=${1:-localhost} | |
database=${2:-test} | |
mongos=(--host $remote $database --port 27017) | |
collections=($(echo "show collections" | mongo $mongos --quiet)) | |
echo "show collections" | mongo $mongos | |
for col in $collections | |
do | |
echo "======================== $col ==========================" | |
echo "db.${col}.getShardDistribution()" | mongo $mongos | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment