Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ssh ubuntu@md9bench24-db1.int.parse.com
# first screen
rm -rf /tmp/database; mkdir /tmp/database; sudo mongod --dbpath=/tmp/database --storageEngine=rocksdb
# second screen
mongo
use animals;
db.cats.insert({type: "cheetah", speed_mph: 75})
db.cats.find()
# third screen
sudo -E -s
source agf/aw_access_rc
agf/strata -b=all_backups -p=igor-demo backup -r=md9bench24-db1
agf/strata -b=all_backups -p=igor-demo show backups -r=md9bench24-db1
# second screen
db.cats.insert({type: "tiger", speed_mph: 40})
db.cats.find()
# third screen
agf/strata -b=all_backups -p=igor-demo backup -r=md9bench24-db1
agf/strata -b=all_backups -p=igor-demo show backups -r=md9bench24-db1
# first screen
kill mongod
sudo rm -rf /tmp/database
# fourth screen
source agf/aw_access_rc
sudo -E /usr/bin/python /usr/local/bin/yas3fs s3://all_backups/igor-demo /tmp/mountpoint --mkdir --no-metadata --read-only -f -d
# third screen
agf/mongoq -b=all_backups -p=igor-demo -m=/tmp/mountpoint
help
list_replicas
change_replica md9bench24-db1
list_backups
change_backup 0
use animals
db.cats.find();
change_backup 1
use animals
db.cats.find();
exit
######## speed demonstration
# first screen
rm -rf /tmp/database; mkdir /tmp/database; sudo mongod --dbpath=/tmp/database --storageEngine=rocksdb
# second screen
time seq 10 | parallel --gnu --eta 'mongo fillup.js #'
mongo
use fillup
db.coll.stats()
db.serverStatus()["rocksdb"]
# third screen
sudo -E -s
source agf/aw_access_rc
time agf/strata -b=all_backups -p=igor-demo backup -r=md9bench24-db1
agf/strata -b=all_backups -p=igor-demo show backups -r=md9bench24-db1
# second screen
time mongo fillup.js
mongo
use fillup
db.coll.stats()
db.serverStatus()["rocksdb"]
# third screen
time agf/strata -b=all_backups -p=igor-demo backup -r=md9bench24-db1
agf/strata -b=all_backups -p=igor-demo show backups -r=md9bench24-db1
# first screen
kill mongod
sudo rm -rf /tmp/database
# third screen
agf/mongoq -b=all_backups -p=igor-demo -m=/tmp/mountpoint
help
list_replicas
change_replica md9bench24-db1
list_backups
change_backup 2
use fillup
db.coll.stats();
db.serverStatus()["rocksdb"]
change_backup 3
use fillup
db.coll.stats();
db.coll.find();
db.serverStatus()["rocksdb"]
exit
#### cleanup
for i in seq 0 3; do agf/strata -b=all_backups -p=igor-demo delete -d=$i -r=md9bench24-db1; done
#### files:
# fillup.js:
var c = this.db.getSiblingDB("fillup").getCollection("coll");
function getRandomStr(L){
var s= '';
var randomchar=function(){
var n= Math.floor(Math.random()*62);
if(n<10) return n; //1-10
if(n<36) return String.fromCharCode(n+55); //A-Z
return String.fromCharCode(n+61); //a-z
}
while(s.length< L) s+= randomchar();
return s;
}
for (var i = 0; i < 100000; ++i) {
c.insert({bigString : getRandomStr(1024)});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment