needlestack.cluster_managers package¶
Submodules¶
needlestack.cluster_managers.manager module¶
-
class
needlestack.cluster_managers.manager.ClusterManager[source]¶ Bases:
objectMaintains connection to cluster manager to keep track of other nodes
-
add_collections(collections)[source]¶ - Return type
List[Collection]
-
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]
-
set_local_state(state, collection_name=None, shard_name=None)[source]¶ Set the state of local replica nodes
- Return type
bool
-
needlestack.cluster_managers.zookeeper module¶
-
class
needlestack.cluster_managers.zookeeper.ZookeeperClusterManager(cluster_name, hostport, hosts, zookeeper_root)[source]¶ Bases:
needlestack.cluster_managers.manager.ClusterManagerA 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>
…
-
property
base_znode¶
-
property
collections_znode¶
-
commit_transaction(transaction)[source]¶ Commit a transaction and log the first exception after rollbacks
- Return type
bool
-
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.
-
property
live_nodes_znode¶
-
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
-
property
this_node_znode¶