def validate(self, parser, options, args): Cmd.validate(self, parser, options, args, node_name=True, load_cluster=True, load_node=False) if options.itfs is None and (options.thrift_itf is None or options.storage_itf is None or options.binary_itf is None): print_('Missing thrift and/or storage and/or binary protocol interfaces or jmx port', file=sys.stderr) parser.print_help() exit(1) if options.thrift_itf is None: options.thrift_itf = options.itfs if options.storage_itf is None: options.storage_itf = options.itfs if options.binary_itf is None: options.binary_itf = options.itfs self.thrift = common.parse_interface(options.thrift_itf, 9160) self.storage = common.parse_interface(options.storage_itf, 7000) self.binary = common.parse_interface(options.binary_itf, 9042) if self.binary[0] != self.thrift[0]: print_('Cannot set a binary address different from the thrift one', file=sys.stderr) exit(1) self.jmx_port = options.jmx_port self.remote_debug_port = options.remote_debug_port self.initial_token = options.initial_token
def validate(self, parser, options, args): Cmd.validate(self, parser, options, args, node_name=True, load_cluster=True, load_node=False) if options.itfs is None and ( options.thrift_itf is None or options.storage_itf is None or options.binary_itf is None ): print_("Missing thrift and/or storage and/or binary protocol interfaces or jmx port", file=sys.stderr) parser.print_help() exit(1) used_jmx_ports = [node.jmx_port for node in self.cluster.nodelist()] if options.jmx_port in used_jmx_ports: print_("This JMX port is already in use. Choose another.", file=sys.stderr) parser.print_help() exit(1) if options.thrift_itf is None: options.thrift_itf = options.itfs if options.storage_itf is None: options.storage_itf = options.itfs if options.binary_itf is None: options.binary_itf = options.itfs self.thrift = common.parse_interface(options.thrift_itf, 9160) self.storage = common.parse_interface(options.storage_itf, 7000) self.binary = common.parse_interface(options.binary_itf, 9042) if self.binary[0] != self.thrift[0]: print_("Cannot set a binary address different from the thrift one", file=sys.stderr) exit(1) self.jmx_port = options.jmx_port self.remote_debug_port = options.remote_debug_port self.initial_token = options.initial_token
def _start_scylla_manager_agent(self): agent_bin = os.path.join(self.scylla_manager._get_path(), 'bin', 'scylla-manager-agent') log_file = os.path.join(self.get_path(), 'logs', 'system.log.manager_agent') config_file = self._create_agent_config() agent_log = open(log_file, 'a') args = [agent_bin, '--config-file', config_file] self._process_agent = subprocess.Popen(args, stdout=agent_log, stderr=agent_log, close_fds=True) self._process_agent.poll() # When running on ccm standalone, the waiter thread would block # the create commands. Besides in that mode, waiting is unnecessary, # since the original popen reference is garbage collected. standalone = os.environ.get('SCYLLA_CCM_STANDALONE', None) if standalone is None: self._process_agent_waiter = threading.Thread( target=self._wait_for_agent) # Don't block the main thread on abnormal shutdown self._process_agent_waiter.daemon = True self._process_agent_waiter.start() pid_filename = os.path.join(self.get_path(), 'scylla-agent.pid') with open(pid_filename, 'w') as pid_file: pid_file.write(str(self._process_agent.pid)) api_interface = common.parse_interface(self.address(), 10001) if not common.check_socket_listening(api_interface, timeout=180): raise Exception( "scylla manager agent interface %s:%s is not listening after 180 seconds, scylla manager agent may have failed to start." % (api_interface[0], api_interface[1]))
def start(self): # some configurations are set post initalization (cluster id) so # we are forced to update the config prior to calling start self._update_config() # check process is not running if self._pid: try: os.kill(self._pid, 0) return except OSError as err: pass log_file = os.path.join(self._get_path(),'scylla-manager.log') scylla_log = open(log_file, 'a') if os.path.isfile(self._get_pid_file()): os.remove(self._get_pid_file()) args=[os.path.join(self._get_path(),'bin','scylla-manager'), '--config-file',os.path.join(self._get_path(),'scylla-manager.yaml'), '--developer-mode'] self._process_scylla_manager = subprocess.Popen(args, stdout=scylla_log, stderr=scylla_log, close_fds=True) self._process_scylla_manager.poll() with open(self._get_pid_file(), 'w') as pid_file: pid_file.write(str(self._process_scylla_manager.pid)) api_interface = common.parse_interface(self._get_api_address(),9090) if not common.check_socket_listening(api_interface,timeout=180): raise Exception("scylla manager interface %s:%s is not listening after 180 seconds, scylla manager may have failed to start." % (api_interface[0], api_interface[1])) return self._process_scylla_manager
def validate(self, parser, options, args): Cmd.validate(self, parser, options, args, node_name=True, load_cluster=True, load_node=False) if options.itfs is None and (options.thrift_itf is None or options.storage_itf is None): print >> sys.stderr, 'Missing thrift and/or storage interfaces or jmx port' parser.print_help() exit(1) if options.thrift_itf is None: options.thrift_itf = options.itfs if options.storage_itf is None: options.storage_itf = options.itfs self.thrift = common.parse_interface(options.thrift_itf, 9160) self.storage = common.parse_interface(options.storage_itf, 7000) self.jmx_port = options.jmx_port self.initial_token = options.initial_token
def validate(self, parser, options, args): Cmd.validate(self, parser, options, args, node_name=True, load_cluster=True, load_node=False) if options.itfs is None and (options.thrift_itf is None or options.storage_itf is None or options.binary_itf is None): options.itfs = self.cluster.get_node_ip(len(self.cluster.nodelist())+1) if options.thrift_itf is None: options.thrift_itf = options.itfs if options.storage_itf is None: options.storage_itf = options.itfs if options.binary_itf is None: options.binary_itf = options.itfs self.thrift = common.parse_interface(options.thrift_itf, 9160) self.storage = common.parse_interface(options.storage_itf, 7000) self.binary = common.parse_interface(options.binary_itf, 9042) if self.binary[0] != self.thrift[0]: print_('Cannot set a binary address different from the thrift one', file=sys.stderr) sys.exit(1) used_binary_ips = [node.network_interfaces['binary'][0] for node in self.cluster.nodelist()] used_thrift_ips = [node.network_interfaces['thrift'][0] for node in self.cluster.nodelist()] used_storage_ips = [node.network_interfaces['storage'][0] for node in self.cluster.nodelist()] if self.binary[0] in used_binary_ips or self.thrift[0] in used_thrift_ips or self.storage[0] in used_storage_ips: print_("One of the ips is already in use choose another.", file=sys.stderr) parser.print_help() sys.exit(1) if options.jmx_port is None: options.jmx_port = self.cluster.get_node_jmx_port(len(self.cluster.nodelist())+1) used_jmx_ports = [node.jmx_port for node in self.cluster.nodelist()] if options.jmx_port in used_jmx_ports: print_("This JMX port is already in use. Choose another.", file=sys.stderr) parser.print_help() sys.exit(1) self.jmx_port = options.jmx_port self.remote_debug_port = options.remote_debug_port self.initial_token = options.initial_token