Skip to content

Instantly share code, notes, and snippets.

@CaptTofu
Created April 19, 2016 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaptTofu/f3e74da37b21ba36680745520302221c to your computer and use it in GitHub Desktop.
Save CaptTofu/f3e74da37b21ba36680745520302221c to your computer and use it in GitHub Desktop.
-- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5713c23c28b7146220118d0a")
}
shards:
{ "_id" : "west1", "host" : "west1/ec2-52-53-243-185.us-west-1.compute.amazonaws.com:27017,ec2-54-153-95-198.us-west-1.compute.amazonaws.com:27017,ip-172-31-28-205:27017" }
{ "_id" : "west2", "host" : "west2/ec2-54-186-125-103.us-west-2.compute.amazonaws.com:27017,ec2-54-200-15-235.us-west-2.compute.amazonaws.com:27017,ip-172-31-17-143:27017" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "testdb", "partitioned" : true, "primary" : "west1” }
mongos> sh.shardCollection("testdb.restaurants", { "restaurant_id" : 1 })
{ "collectionsharded" : "testdb.restaurants", "ok" : 1 }
ubuntu@ip-172-31-28-205:~$ mongoimport --host localhost -u testuser -p xxx --db testdb --port 27018 --collection restaurants --drop --file primer-dataset.json
2016-04-19T03:13:53.130+0000 connected to: localhost:27018
2016-04-19T03:13:53.131+0000 dropping: testdb.restaurants
2016-04-19T03:13:56.119+0000 [########################] testdb.restaurants 11.3 MB/11.3 MB (100.0%)
2016-04-19T03:13:56.287+0000 imported 25359 documents
ubuntu@ip-172-31-28-205:~$ mongo -u root -p xxx localhost:27018/admin
MongoDB shell version: 3.0.11
connecting to: localhost:27018/admin
mongos> use testdb
switched to db testdb
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5713c23c28b7146220118d0a")
}
shards:
{ "_id" : "west1", "host" : "west1/ec2-52-53-243-185.us-west-1.compute.amazonaws.com:27017,ec2-54-153-95-198.us-west-1.compute.amazonaws.com:27017,ip-172-31-28-205:27017" }
{ "_id" : "west2", "host" : "west2/ec2-54-186-125-103.us-west-2.compute.amazonaws.com:27017,ec2-54-200-15-235.us-west-2.compute.amazonaws.com:27017,ip-172-31-17-143:27017" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "testdb", "partitioned" : true, "primary" : "west1" }
mongos> db.restaurants.getShardDistribution()
Collection testdb.restaurants is not sharded.
???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment