public class ZkStateReader extends Object implements Closeable
| Constructor and Description |
|---|
ZkStateReader(SolrZkClient zkClient) |
ZkStateReader(String zkServerAddress,
int zkClientTimeout,
int zkClientConnectTimeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCollectionWatch(String coll) |
Boolean |
checkValid(String coll,
int version) |
void |
close() |
void |
createClusterStateWatchersAndUpdate() |
static Object |
fromJSON(byte[] utf8) |
Aliases |
getAliases() |
String |
getBaseUrlForNodeName(String nodeName)
Returns the baseURL corresponding to a given node's nodeName --
NOTE: does not (currently) imply that the nodeName (or resulting
baseURL) exists in the cluster.
|
Map |
getClusterProps() |
ClusterState |
getClusterState() |
static DocCollection |
getCollectionLive(ZkStateReader zkStateReader,
String coll) |
static String |
getCollectionPath(String coll) |
Replica |
getLeaderRetry(String collection,
String shard)
Get shard leader properties, with retry if none exist.
|
Replica |
getLeaderRetry(String collection,
String shard,
int timeout)
Get shard leader properties, with retry if none exist.
|
String |
getLeaderUrl(String collection,
String shard,
int timeout) |
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisCoreNodeName) |
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisCoreNodeName,
String mustMatchStateFilter) |
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisCoreNodeName,
String mustMatchStateFilter,
String mustNotMatchStateFilter) |
static String |
getShardLeadersPath(String collection,
String shardId)
Get path where shard leader properties live in zookeeper.
|
Object |
getUpdateLock() |
SolrZkClient |
getZkClient() |
String |
readConfigName(String collection)
Returns config set name for collection.
|
void |
removeZKWatch(String coll)
This is not a public API.
|
static byte[] |
toJSON(Object o) |
static byte[] |
toUTF8(org.noggit.CharArr out) |
void |
updateAliases() |
void |
updateClusterState(boolean immediate) |
void |
updateLiveNodes() |
public static final String BASE_URL_PROP
public static final String NODE_NAME_PROP
public static final String CORE_NODE_NAME_PROP
public static final String ROLES_PROP
public static final String STATE_PROP
public static final String CORE_NAME_PROP
public static final String COLLECTION_PROP
public static final String SHARD_ID_PROP
public static final String REPLICA_PROP
public static final String SHARD_RANGE_PROP
public static final String SHARD_STATE_PROP
public static final String SHARD_PARENT_PROP
public static final String NUM_SHARDS_PROP
public static final String LEADER_PROP
public static final String PROPERTY_PROP
public static final String PROPERTY_VALUE_PROP
public static final String MAX_AT_ONCE_PROP
public static final String MAX_WAIT_SECONDS_PROP
public static final String COLLECTIONS_ZKNODE
public static final String LIVE_NODES_ZKNODE
public static final String ALIASES
public static final String CLUSTER_STATE
public static final String CLUSTER_PROPS
public static final String REPLICATION_FACTOR
public static final String MAX_SHARDS_PER_NODE
public static final String AUTO_ADD_REPLICAS
public static final String ROLES
public static final String RECOVERING
public static final String RECOVERY_FAILED
public static final String ACTIVE
public static final String DOWN
public static final String SYNC
public static final String CONFIGS_ZKNODE
public static final String CONFIGNAME_PROP
public static final String LEGACY_CLOUD
public static final String URL_SCHEME
protected volatile ClusterState clusterState
public static final String LEADER_ELECT_ZKNODE
public static final String SHARD_LEADERS_ZKNODE
public ZkStateReader(SolrZkClient zkClient)
public ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout) throws InterruptedException, TimeoutException, IOException
public static byte[] toJSON(Object o)
public static byte[] toUTF8(org.noggit.CharArr out)
public static Object fromJSON(byte[] utf8)
public String readConfigName(String collection)
collection - to return config set name forpublic void updateClusterState(boolean immediate)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void updateLiveNodes()
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic Aliases getAliases()
public void createClusterStateWatchersAndUpdate()
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic ClusterState getClusterState()
public Object getUpdateLock()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic String getLeaderUrl(String collection, String shard, int timeout) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic Replica getLeaderRetry(String collection, String shard) throws InterruptedException
InterruptedExceptionpublic Replica getLeaderRetry(String collection, String shard, int timeout) throws InterruptedException
InterruptedExceptionpublic static String getShardLeadersPath(String collection, String shardId)
public List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName)
public List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, String mustMatchStateFilter)
public List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, String mustMatchStateFilter, String mustNotMatchStateFilter)
public SolrZkClient getZkClient()
public void updateAliases()
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic Map getClusterProps()
public String getBaseUrlForNodeName(String nodeName)
public static DocCollection getCollectionLive(ZkStateReader zkStateReader, String coll)
public void addCollectionWatch(String coll) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void removeZKWatch(String coll)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.