Ejemplo n.º 1
0
        error_syncer = EtcdSynchronizer(CassandraFailedPlugin(
            key, dead_node_ip),
                                        dead_node_ip,
                                        etcd_ip=etcd_ip,
                                        force_leave=True)
    except ImportError:
        print "You must run mark_node_failed on a node that has Cassandra installed to remove a node from a Cassandra cluster"
        sys.exit(1)
else:
    error_syncer = EtcdSynchronizer(NullPlugin(key),
                                    dead_node_ip,
                                    etcd_ip=etcd_ip,
                                    force_leave=True)

# Check that the dead node is even a member of the cluster
etcd_result, idx = error_syncer.read_from_etcd(wait=False, timeout=10)

if etcd_result is None:
    print "Failed to contact etcd cluster on '{}' - node not removed".format(
        etcd_ip)
    sys.exit(1)

cluster_info = ClusterInfo(etcd_result)

if cluster_info.local_state(dead_node_ip) is None:
    print "Not in cluster - no work required"
    sys.exit(0)

print "Marking node as failed and removing it from the cluster - will take at least 30 seconds"
# Move the dead node into ERROR state to allow in-progress operations to
# complete
Ejemplo n.º 2
0
key = make_key(site, node_type, datastore, etcd_key)
_log.info("Using etcd key %s" % (key))

if datastore == "cassandra":
  try:
    sys.path.append("/usr/share/clearwater/clearwater-cluster-manager/failed_plugins")
    from cassandra_failed_plugin import CassandraFailedPlugin
    error_syncer = EtcdSynchronizer(CassandraFailedPlugin(key, dead_node_ip), dead_node_ip, etcd_ip=etcd_ip, force_leave=True)
  except ImportError:
    print "You must run mark_node_failed on a node that has Cassandra installed to remove a node from a Cassandra cluster"
    sys.exit(1)
else:
  error_syncer = EtcdSynchronizer(NullPlugin(key), dead_node_ip, etcd_ip=etcd_ip, force_leave=True)

# Check that the dead node is even a member of the cluster
etcd_result, idx = error_syncer.read_from_etcd(wait=False, timeout=10)

if etcd_result is None:
    print "Failed to contact etcd cluster on '{}' - node not removed".format(etcd_ip)
    sys.exit(1)

cluster_info = ClusterInfo(etcd_result)

if cluster_info.local_state(dead_node_ip) is None:
    print "Not in cluster - no work required"
    sys.exit(0)

print "Marking node as failed and removing it from the cluster - will take at least 30 seconds"
# Move the dead node into ERROR state to allow in-progress operations to
# complete
error_syncer.mark_node_failed()