Skip to content

Instantly share code, notes, and snippets.

@umiyosh
Created March 18, 2016 06:00
Show Gist options
  • Save umiyosh/ee84cb66de3500f5f583 to your computer and use it in GitHub Desktop.
Save umiyosh/ee84cb66de3500f5f583 to your computer and use it in GitHub Desktop.
mongodb getShardDistributionをcollection全部にやるやつ
#!/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