def stop(self, args, config, connection): status = self.status(args, config, connection, internal=True) if status == 'down': print("MarkLogic server on {0} appears to be {1}.".format( connection.host, status)) else: if 'cluster' in args: hostname = connection.host if hostname == 'localhost': hostname = socket.gethostname() cluster = LocalCluster(connection=connection).read() print("Shutting down cluster...") cluster.shutdown() else: hostname = connection.host if hostname == 'localhost': hostname = socket.gethostname() host = Host(hostname, connection=connection).read() if host.group_name() is None: ml = MarkLogic(connection) if len(ml.hosts()) == 1: host = Host(ml.hosts()[0], connection=connection).read() else: print("Failed to identify host:", ml.hosts()) sys.exit(1) print("Shutting down host: " + host.host_name()) host.shutdown() status = self.status(args, config, connection, internal=True) while status == 'up': time.sleep(2) status = self.status(args, config, connection, internal=True)
def stop(self, args, config, connection): status = self.status(args, config, connection, internal=True) if status == 'down': print("MarkLogic server on {0} appears to be {1}." .format(connection.host, status)) else: if 'cluster' in args: hostname = connection.host if hostname == 'localhost': hostname = socket.gethostname() cluster = LocalCluster(connection=connection).read() print("Shutting down cluster...") cluster.shutdown() else: hostname = connection.host if hostname == 'localhost': hostname = socket.gethostname() host = Host(hostname,connection=connection).read() if host.group_name() is None: ml = MarkLogic(connection) if len(ml.hosts()) == 1: host = Host(ml.hosts()[0], connection=connection).read() else: print("Failed to identify host:",ml.hosts()) sys.exit(1) print("Shutting down host: " + host.host_name()) host.shutdown() status = self.status(args,config,connection,internal=True) while status == 'up': time.sleep(2) status = self.status(args,config,connection,internal=True)
def add_host(self, host, connection=None): if connection is None: connection = self.connection if isinstance(host, str): host = Host(host) xml = host._get_server_config() cfgzip = self._post_server_config(xml,connection) host_connection = Connection(host.host_name(), connection.auth) host._post_cluster_config(cfgzip,host_connection)