Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. // 1. Set Profiling to Off in the UI hours in advance
  2. // Name: appboy_prod_users_2
  3. // Connection: iad-mongos0.objectrocket.com:15165
  4.  
  5. // 2. Prerequisite : Jon confirmed the names and results below.
  6. db.getSiblingDB("zedge_users").getCollectionNames();
  7. db.getSiblingDB("metro_user").getCollectionNames();
  8. db.getSiblingDB("tinder_users").getCollectionNames();
  9. db.getSiblingDB("thrillist_users").getCollectionNames();
  10. db.getSiblingDB("mdbfoo").getCollectionNames();
  11. db.getSiblingDB("glide_users").getCollectionNames();
  12. db.getSiblingDB("bing_users").getCollectionNames();
  13. db.getSiblingDB("samsunghq_uses").getCollectionNames();
  14. db.getSiblingDB("lifelock_users").getCollectionNames();
  15. db.getSiblingDB("qik_users").getCollectionNames();
  16. db.getSiblingDB("perfstats").getCollectionNames();
  17. db.getSiblingDB("letsbonus_users").getCollectionNames();
  18. db.getSiblingDB("test").getCollectionNames();
  19.  
  20. // 3. vim tkt80044.js <- Create the Script Below, fix user/pass
  21. user='xxx';
  22. password='xxx';
  23. dbs = [ "zedge_users", "metro_user", "tinder_users", "thrillist_users", "mdbfoo", "glide_users", "bing_users","samsunghq_uses", "lifelock_users", "qik_users", "perfstats", "letsbonus_users", "test"
  24. ];
  25. dbs.forEach(function(database){
  26. db.getSiblingDB(database).dropDatabase()
  27. })
  28. db.getSiblingDB('config').shards.find().forEach(function(shard){
  29. x = new Mongo (shard.host);
  30. x.getDB('admin').auth(user,password);
  31. dbs.forEach(function(database){
  32. try{
  33. x.getDB(database).dropDatabase()
  34. }catch(err){
  35. print("Failed to drop "+database+" from "+shard.host.split("/")[0])
  36. }
  37. });
  38. });
  39. db.getSiblingDB('config').mongos.find({ ping : {$gte: new Date(ISODate().getTime() - 1000 * 60 * 2)}}).forEach(function(mongos_host){
  40. x = new Mongo (mongos_host._id);
  41. x.getDB('admin').auth(user,password);
  42. x.adminCommand('flushRouterConfig');
  43. dbs.forEach(function(database){
  44. try{
  45. x.getDB(database).dropDatabase()
  46. }
  47. catch(err){
  48. print("Failed to drop "+database+" from mongos!")
  49. }
  50. });
  51. x.adminCommand('flushRouterConfig');
  52. x.adminCommand('flushRouterConfig');
  53. });
  54.  
  55. // 4. Drop : Run repeatedly until "show databases" doesn't list the databases above
  56. // mongo ....
  57. // load("tkt80044.js");
  58. //
  59. // Note, you will see output about mongo setting up connections to shards.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement