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
sh.status() | |
--- Sharding Status --- | |
sharding version: { | |
"_id" : 1, | |
"version" : 3, | |
"minCompatibleVersion" : 3, | |
"currentVersion" : 4, | |
"clusterId" : ObjectId("5314f1487abd6cb2803696d6") | |
} | |
shards: |
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
sh.addTagRange('enron.messages',{date:MinKey},{date:ISODate("2001-07-01")},'tier 2') | |
sh.addTagRange('enron.messages',{date:ISODate("2001-07-01")},{date:MaxKey},'recent') |
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
mongos> sh.status() | |
--- Sharding Status --- | |
sharding version: { | |
"_id" : 1, | |
"version" : 3, | |
"minCompatibleVersion" : 3, | |
"currentVersion" : 4, | |
"clusterId" : ObjectId("5314f1487abd6cb2803696d6") | |
} | |
shards: |
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
sh.splitAt('enron.messages', {"date" : ISODate("2001-08-01")}) |
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
var cursor = db.messages.find({},{_id:1, 'headers.Date':1}) | |
while(cursor.hasNext()){ | |
var doc = cursor.next(); | |
var id = doc._id; | |
var dt = doc.headers.Date; | |
db.messages.update({_id:id},{$set:{date:dt},$unset:{'headers.Date':1}}) | |
} | |
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
sh.enableSharding('enron') | |
// { "ok" : 1 } |
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
mongos> use enron | |
switched to db enron | |
mongos> show tables | |
messages | |
system.indexes |
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
mongos> show dbs | |
admin (empty) | |
config 0.046875GB | |
enron 1.953125GB |
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
mongos> sh.status() | |
--- Sharding Status --- | |
sharding version: { | |
"_id" : 1, | |
"version" : 3, | |
"minCompatibleVersion" : 3, | |
"currentVersion" : 4, | |
"clusterId" : ObjectId("5314f1487abd6cb2803696d6") | |
} | |
shards: |
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
mongorestore ~/courses/m101p/enron/dump/enron/messages.bson |