Esempio n. 1
0
 def _refresh(self, keyspace, table):
     try:
         sh.nodetool('-h', self.host, '-p', self.port, 'refresh', keyspace,
                     table)
     except:
         logger.error('Command possibly unfinished due to errors!')
         raise
Esempio n. 2
0
 def _snapshot(self, keyspace, tag):
     try:
         sh.nodetool('-h', self.host, '-p', self.port, 'snapshot', '-t',
                     tag, keyspace)
     except:
         logger.error('Command possibly unfinished due to errors!')
         raise
Esempio n. 3
0
    def _clearsnapshot(self, keyspace, tag):
        try:
            sh.nodetool('clearsnapshot', '-t', tag, keyspace)

        except:
            logger.error('Command possibly unfinished due to errors!')
            raise
Esempio n. 4
0
 def _refresh(self, keyspace, table):
     try:
         if self.jmxusername and self.jmxpassword:
             sh.nodetool('-u', self.jmxusername, '-pw', self.jmxpassword,
                         '-h', self.host, '-p', self.port, 'refresh',
                         keyspace, table)
         else:
             sh.nodetool('-h', self.host, '-p', self.port, 'refresh',
                         keyspace, table)
     except:
         logger.error('Command possibly unfinished due to errors!')
         raise
Esempio n. 5
0
 def _snapshot(self, keyspace, tag):
     try:
         if self.jmxusername and self.jmxpassword:
             sh.nodetool('-u', self.jmxusername, '-pw', self.jmxpassword,
                         '-h', self.host, '-p', self.port, 'snapshot', '-t',
                         tag, keyspace)
         else:
             sh.nodetool('-h', self.host, '-p', self.port, 'snapshot', '-t',
                         tag, keyspace)
     except:
         logger.error('Command possibly unfinished due to errors!')
         raise
Esempio n. 6
0
 def _refresh(self, keyspace, table):
     try:
         logger.debug('Refreshing: nodetool refresh')
         if self.jmxusername and self.jmxpassword:
             sh.nodetool('-u', self.jmxusername, '-pw', self.jmxpassword,
                         '-h', self.host, '-p', self.port, 'refresh', keyspace, table)
         else:
             sh.nodetool('-h', self.host, '-p', self.port, 'refresh', keyspace, table)
     except:
         logger.exception('Command possibly unfinished due to errors!')
         sys.exit(1)
         raise
Esempio n. 7
0
 def _clearsnapshot(self, keyspace, tag):
     try:
         logger.debug('Clearing snapshots for {} keyspace and {} tag'.format(keyspace, tag))
         if self.jmxusername and self.jmxpassword:
             logger.debug('Executing: nodetool -u %s -pw %s -h %s -p %s clearsnapshot -t %s %s',
                     self.jmxusername, self.jmxpassword, self.host, self.port, tag, keyspace)
             sh.nodetool('-u', self.jmxusername, '-pw', self.jmxpassword,
                         '-h', self.host, '-p', self.port, 'clearsnapshot', '-t', tag, keyspace)
         else:
             logger.debug('Executing: nodetool -h %s -p %s clearsnapshot -t %s %s', self.host, self.port, tag, keyspace)
             sh.nodetool('-h', self.host, '-p', self.port, 'clearsnapshot', '-t', tag, keyspace)
     except:
         logger.exception('Command possibly unfinished due to errors!')
         sys.exit(1)
         raise
Esempio n. 8
0
 def _snapshot(self, keyspace, tag):
     logger.debug('Taking snapshot for {0} keyspace with tag: {1}'.format(keyspace, tag))
     try:
         if self.jmxusername and self.jmxpassword:
             logger.debug('Executing: nodetool -u %s -pw %s -h %s -p %s snapshot -t %s %s',
                     self.jmxusername, self.jmxpassword, self.host, self.port, tag, keyspace)
             output = sh.nodetool('-u', self.jmxusername, '-pw', self.jmxpassword,
                         '-h', self.host, '-p', self.port, 'snapshot', '-t', tag, keyspace)
         else:
             logger.debug('Executing: nodetool -h %s -p %s snapshot -t %s %s', self.host, self.port, tag, keyspace)
             output = sh.nodetool('-h', self.host, '-p', self.port, 'snapshot', '-t', tag, keyspace)
         logger.debug('Snapshot returned with status code {}'.format(output.exit_code))
         logger.info('Adding Delay of 5 sec for completion')
         time.sleep(5)
     except:
         logger.exception('Command possibly unfinished due to errors!')
         sys.exit(1)
         raise