Пример #1
0
    def start_cassandra(self):
        """Strt the cassandra process."""
        LOGGER.debug("[start_cassandra] called last_safe_start [%s]",
                     self.last_safe_start)
        if not self.last_safe_start:
            self.last_safe_start = int(time.time())
        elif (int(time.time()) - self.last_safe_start) < 30:
            self.config = load_config()
            try:
                self.cass_error_msg = inspect_cass_log(self.config)
            except TypeError:
                LOGGER.error("[start_cassandra] can't " +
                                 "start cassandra check config.py")
                self.cass_error_msg = "cassandra doesn't start, no log error"
            else:
                self.do_tune()
            LOGGER.warn("[start_cassandra] cassandra error message [%s]",
                        self.cass_error_msg)

        LOGGER.error("%s", self.config.cassandra_start_options)
        pid_loc = os.path.join(*self.config.cassandra_start_options[1])
        handle_pid(pid_loc)
        self.last_safe_start = int(time.time())
        command = ' '.join((self.config.cassandra_startup_script,
                            self.config.cassandra_start_options[0],
                            pid_loc, ))
        output = self._run_command(command)
        if output:
            self.cassandra_running = True
            return True
Пример #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--command", help="agent command to run %s" % COMMANDS)
    parser.add_argument("--conf", help="where to load configuration data")
    parser.add_argument("--cass-conf", help="configuration to tune cassandra")
    parser.add_argument("--restore-point", help="The name of the file to " + "be used as a restore point w/o .tar.gz")
    (args, extra) = parser.parse_known_args()

    use_path(args.conf)
    config = load_config()
    setup_logging(config)

    if config.VERSION == 2.0:
        update_func = Cassandra.update_defaults_2_0
    elif config.VERSION == 1.2:
        update_func = Cassandra.update_defaults_1_2
    elif config.VERSION == 1.1:
        update_func = Cassandra.update_defaults_1_1

    cassandra = Cassandra(config, update_func)

    if args.conf:
        cassandra.cassandra_yaml = args.conf
    parse_args(args, cassandra, parser, extra)