Created
March 22, 2011 20:44
-
-
Save gatesvp/882010 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| print(' ') | |
| printShardingStatus() | |
| db.runCommand({enablesharding : 'fred_sharded'}) | |
| db.runCommand({enablesharding : 'fred_sharded2'}) | |
| db.runCommand({shardcollection : 'fred_sharded.temp', key:{'_id':1}}) | |
| db.runCommand({shardcollection : 'fred_sharded2.temp', key:{'_id':1}}) | |
| db2 = db.getSisterDB('fred_sharded') | |
| db3 = db.getSisterDB('fred_sharded2') | |
| db4 = db.getSisterDB('fred_shardednot') | |
| db2.temp.save({x:1}) | |
| db3.temp.save({x:1}) | |
| db4.temp.save({x:1}) | |
| print(' ') | |
| print('Record Count - Should all be one') | |
| print(db2.temp.count()) | |
| print(db3.temp.count()) | |
| print(db4.temp.count()) | |
| // Notice chunks data here | |
| print(' ') | |
| printShardingStatus() | |
| // This command should only drop "fred_sharded" | |
| // This command should not affect any other DB | |
| print('Dropping Database') | |
| printjson(db2.runCommand({dropDatabase:1})) | |
| // Notice that chunks are no longer present | |
| print(' ') | |
| printShardingStatus() | |
| db2 = db.getSisterDB('fred_sharded') | |
| db3 = db.getSisterDB('fred_sharded2') | |
| db4 = db.getSisterDB('fred_shardednot') | |
| // What happened to db3? We didn't delete it | |
| print(' ') | |
| print('Record Count - Should be 0 1 1') | |
| print(db2.temp.count()) | |
| print(db3.temp.count()) | |
| print(db4.temp.count()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment