Exemplo n.º 1
0
 def restoreConfigDB(self):
     remoteHost = RemoteHost(self._remote_host, self._user_login,
                             self._user_pass)
     mongodbcommand = "mongorestore --host %s --port %s --gzip --nsExclude 'config.*log' --nsExclude 'system.sessions'  --drop --username %s --password %s --authenticationDatabase %s --db %s " %\
                      (self._remote_host,self._remote_port,self._mongodb_user,self._mongodb_pass,self._mongodb_auth_database,self._mongodb_config_database) +\
                      join(self._remote_path, self._replica_name, self._backup_mark, "config")
     remoteHost.execOnScreenSession(mongodbcommand)
Exemplo n.º 2
0
 def restoreMongoDB(self):
     remoteHost = RemoteHost(self._remote_host,self._user_login,self._user_pass)
     remoteHost.removeOnScreenLog()
     mongodbcommand = "mongorestore --host %s --port %s --gzip --drop --username %s --password %s --authenticationDatabase %s --db %s " %\
                      (self._remote_host,self._remote_port,self._mongodb_user,self._mongodb_pass,self._mongodb_auth_database,self._mongodb_database) +\
                      join(self._remote_path, self._shard_name, self._backup_mark, self._mongodb_database)
     remoteHost.execOnScreenSession(mongodbcommand)
Exemplo n.º 3
0
 def checkStatusRestoreDB(self):
     remoteHost = RemoteHost(self._remote_host,self._user_login,self._user_pass)
     log = remoteHost.tailScreenLog()
     if "    done" in log:
         print(self._shard_name + ':\n' + log)
         remoteHost.closeScreenSession()
         return 1
     elif "    Failed" in log:
         print(self._shard_name + ':\n' + log)
         remoteHost.closeScreenSession()
         return -1
     else:
         return 0
Exemplo n.º 4
0
 def replaceMongodConfigAndRestart(self, replacement_config_extension):
     remoteHost = RemoteHost(self._remote_host, self._user_login,
                             self._user_pass)
     remoteHost.execOnRemote(
         "sudo /bin/cp /etc/mongoc.conf.%s /etc/mongoc.conf; bash ./restartMongoC.sh"
         % replacement_config_extension)
Exemplo n.º 5
0
 def startMongoRouter(self):
     remoteHost = RemoteHost(self._remote_host, self._user_login,
                             self._user_pass)
     remoteHost.execOnRemote("bash ./startMongoS.sh")
Exemplo n.º 6
0
 def restartMongoShard(self):
     remoteHost = RemoteHost(self._remote_host,self._user_login,self._user_pass)
     remoteHost.execOnRemote("bash ./restartMongoD.sh")