def delete_cluster(cluster_name, ip, filesystem=False):
        """
        Deletes a complete cluster
        :param cluster_name: Name of the cluster to remove
        :type cluster_name: str
        :param ip: IP address of the last node of a cluster
        :type ip: str
        :param filesystem: Indicates whether the configuration should be on the filesystem or in a configuration cluster
        :type filesystem: bool
        :return: None
        """
        ArakoonInstaller._logger.debug('Deleting cluster {0} on {1}'.format(cluster_name, ip))
        config = ArakoonClusterConfig(cluster_name, filesystem)
        config.load_config(ip)
        cluster_type = ArakoonInstaller.get_arakoon_metadata_by_cluster_name(cluster_name=config.cluster_id, filesystem=filesystem, ip=ip)['cluster_type']

        service_name = ArakoonInstaller.get_service_name_for_cluster(cluster_name=config.cluster_id)
        for node in config.nodes:
            try:
                ServiceManager.unregister_service(service_name=service_name, node_name=node.name)
            except:
                ArakoonInstaller._logger.exception('Un-registering service {0} on {1} failed'.format(service_name, ip))

        # Cleans up a complete cluster (remove services, directories and configuration files)
        for node in config.nodes:
            ArakoonInstaller._destroy_node(config, node, delay_unregistration=cluster_type == ServiceType.ARAKOON_CLUSTER_TYPES.CFG)
            config.delete_config(ip)

        ArakoonInstaller._logger.debug('Deleting cluster {0} on {1} completed'.format(cluster_name, ip))
    def shrink_cluster(deleted_node_ip, remaining_node_ips, cluster_name, offline_nodes=None, filesystem=False):
        """
        Removes a node from a cluster, the old node will become a slave
        :param deleted_node_ip: The ip of the node that should be deleted
        :type deleted_node_ip: str
        :param remaining_node_ips: The IPs of the remaining nodes
        :type remaining_node_ips: list
        :param cluster_name: The name of the cluster to shrink
        :type cluster_name: str
        :param offline_nodes: Storage Routers which are offline
        :type offline_nodes: list
        :param filesystem: Indicates whether the configuration should be on the filesystem or in a configuration cluster
        :type filesystem: bool
        :return: Remaining running arakoon IPs
        :rtype: list
        """
        ArakoonInstaller._logger.debug('Shrinking cluster {0} from {1}'.format(cluster_name, deleted_node_ip))
        config = ArakoonClusterConfig(cluster_name, filesystem)
        config.load_config(remaining_node_ips[0])
        cluster_type = ArakoonInstaller.get_arakoon_metadata_by_cluster_name(cluster_name=config.cluster_id, filesystem=filesystem, ip=remaining_node_ips[0])['cluster_type']

        if offline_nodes is None:
            offline_nodes = []

        removal_node = None
        for node in config.nodes[:]:
            if node.ip == deleted_node_ip:
                config.nodes.remove(node)
                removal_node = node
                if node.ip not in offline_nodes:
                    ArakoonInstaller._destroy_node(config, node, delay_unregistration=cluster_type == ServiceType.ARAKOON_CLUSTER_TYPES.CFG)
                    if filesystem is True:
                        config.delete_config(node.ip)
        ArakoonInstaller._deploy(config=config,
                                 filesystem=filesystem,
                                 offline_nodes=offline_nodes,
                                 delay_service_registration=cluster_type == ServiceType.ARAKOON_CLUSTER_TYPES.CFG)
        restart_ips = [node.ip for node in config.nodes if node.ip != deleted_node_ip and node.ip not in offline_nodes]
        ArakoonInstaller._logger.debug('Shrinking cluster {0} from {1} completed'.format(cluster_name, deleted_node_ip))

        ArakoonInstaller._logger.debug('Restart sequence (remove) for {0}'.format(cluster_name))
        ArakoonInstaller._logger.debug('Remaining ips: {0}'.format(', '.join(restart_ips)))
        for ip in restart_ips:
            client = SSHClient(ip, username='******')
            ArakoonInstaller.stop(cluster_name, client=client)
            ArakoonInstaller.start(cluster_name, client=client)
            ArakoonInstaller._logger.debug('  Restarted node {0} for cluster {1}'.format(client.ip, cluster_name))
            if len(restart_ips) > 2:  # A two node cluster needs all nodes running
                ArakoonInstaller.wait_for_cluster(cluster_name, restart_ips[0], filesystem)
        ArakoonInstaller.wait_for_cluster(cluster_name, restart_ips[0], filesystem)
        config = ArakoonClusterConfig(cluster_name, filesystem)
        config.load_config(restart_ips[0])
        arakoon_client = ArakoonInstaller.build_client(config)
        arakoon_client.set(ArakoonInstaller.INTERNAL_CONFIG_KEY, config.export_ini())
        if removal_node is not None:
            # noinspection PyUnresolvedReferences
            ServiceManager.unregister_service(node_name=removal_node.name,
                                              service_name=ArakoonInstaller.get_service_name_for_cluster(cluster_name=config.cluster_id))
        ArakoonInstaller._logger.debug('Restart sequence (remove) for {0} completed'.format(cluster_name))

        return restart_ips