needlestack.cluster_managers package

Submodules

needlestack.cluster_managers.manager module

class needlestack.cluster_managers.manager.ClusterManager[source]

Bases: object

Maintains connection to cluster manager to keep track of other nodes

add_collections(collections)[source]
Return type

List[Collection]

cleanup()[source]
delete_collections(collection_names)[source]
Return type

List[str]

get_searchers(collection_name, shard_names=None)[source]

Get all active searches for specified shards in a collection. If no shards are provided then return all shards.

Return type

List[Tuple[str, List[str]]]

list_collections(collection_names=None, include_state=True)[source]
Return type

List[Collection]

list_local_collections(include_state=True)[source]
Return type

List[Collection]

list_nodes()[source]
Return type

List[Node]

register_merger()[source]
register_searcher()[source]
set_local_state(state, collection_name=None, shard_name=None)[source]

Set the state of local replica nodes

Return type

bool

set_state(state, collection_name=None, shard_name=None, hostport=None)[source]

Set the state of replica nodes

Return type

bool

shutdown()[source]
startup()[source]

needlestack.cluster_managers.zookeeper module

class needlestack.cluster_managers.zookeeper.ZookeeperClusterManager(cluster_name, hostport, hosts, zookeeper_root)[source]

Bases: needlestack.cluster_managers.manager.ClusterManager

A cluster manager that manages one cluster’s state and configurations with a Zookeeper ensemble via kazoo.

Below is the structure of the znodes:
/needlestack
/<CLUSTER_NAME_1>
/live_nodes

/<HOSTPORT_1> /<HOSTPORT_2> /<HOSTPORT_3> /<HOSTPORT_4> …

/collections
/<COLLECTION_NAME_1>
/shards
/<SHARD_NAME_1>
/replicas

/<HOSTPORT_2> /<HOSTPORT_4>

/<SHARD_NAME_2>
/replicas

/<HOSTPORT_1> /<HOSTPORT_3>

/<COLLECTION_NAME_2>

add_collections(collections)[source]

Configure a list of collections into Zookeeper

property base_znode
cleanup()[source]
collection_znode(collection_name)[source]
Return type

str

property collections_znode
commit_transaction(transaction)[source]

Commit a transaction and log the first exception after rollbacks

Return type

bool

delete_collections(collection_names)[source]
get_searchers(collection_name, shard_names=None)[source]

Get all active searches for specified shards in a collection. If no shards are provided then return all shards.

list_collections(collection_names=None, include_state=True)[source]
list_local_collections(include_state=True)[source]
list_nodes()[source]
property live_nodes_znode
register_merger()[source]
register_searcher()[source]
replica_znode(collection_name, shard_name, hostport=None)[source]
Return type

str

set_local_state(state, collection_name=None, shard_name=None)[source]

Set the state of local replica nodes

set_state(state, collection_name=None, shard_name=None, hostport=None)[source]

Set the state of replica nodes

shard_znode(collection_name, shard_name=None)[source]
Return type

str

shutdown()[source]
signal_listener(signum, frame)[source]
startup()[source]
property this_node_znode
zk_listener(state)[source]

Module contents