org.apache.solr.common.cloud
Class ZkStateReader
java.lang.Object
org.apache.solr.common.cloud.ZkStateReader
public class ZkStateReader
- extends Object
Method Summary |
void |
close()
|
void |
createClusterStateWatchersAndUpdate()
|
static Object |
fromJSON(byte[] utf8)
|
CloudState |
getCloudState()
|
static String |
getCoreNodeName(String nodeName,
String coreName)
Get CoreNodeName for a core. |
ZkNodeProps |
getLeaderProps(String collection,
String shard)
Get shard leader properties. |
ZkNodeProps |
getLeaderProps(String collection,
String shard,
int timeout)
|
String |
getLeaderUrl(String collection,
String shard)
Get shard leader url. |
String |
getLeaderUrl(String collection,
String shard,
int timeout)
|
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName)
|
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName,
String mustMatchStateFilter)
|
List<ZkCoreNodeProps> |
getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName,
String mustMatchStateFilter,
String mustNotMatchStateFilter)
|
static String |
getShardLeadersPath(String collection,
String shardId)
Get path where shard leader properties live in zookeeper. |
Object |
getUpdateLock()
|
SolrZkClient |
getZkClient()
|
static byte[] |
toJSON(Object o)
|
static byte[] |
toUTF8(CharArr out)
|
void |
updateCloudState(boolean immediate)
|
void |
updateLiveNodes()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BASE_URL_PROP
public static final String BASE_URL_PROP
- See Also:
- Constant Field Values
NODE_NAME_PROP
public static final String NODE_NAME_PROP
- See Also:
- Constant Field Values
ROLES_PROP
public static final String ROLES_PROP
- See Also:
- Constant Field Values
STATE_PROP
public static final String STATE_PROP
- See Also:
- Constant Field Values
CORE_NAME_PROP
public static final String CORE_NAME_PROP
- See Also:
- Constant Field Values
COLLECTION_PROP
public static final String COLLECTION_PROP
- See Also:
- Constant Field Values
SHARD_ID_PROP
public static final String SHARD_ID_PROP
- See Also:
- Constant Field Values
NUM_SHARDS_PROP
public static final String NUM_SHARDS_PROP
- See Also:
- Constant Field Values
LEADER_PROP
public static final String LEADER_PROP
- See Also:
- Constant Field Values
COLLECTIONS_ZKNODE
public static final String COLLECTIONS_ZKNODE
- See Also:
- Constant Field Values
LIVE_NODES_ZKNODE
public static final String LIVE_NODES_ZKNODE
- See Also:
- Constant Field Values
CLUSTER_STATE
public static final String CLUSTER_STATE
- See Also:
- Constant Field Values
RECOVERING
public static final String RECOVERING
- See Also:
- Constant Field Values
RECOVERY_FAILED
public static final String RECOVERY_FAILED
- See Also:
- Constant Field Values
ACTIVE
public static final String ACTIVE
- See Also:
- Constant Field Values
DOWN
public static final String DOWN
- See Also:
- Constant Field Values
SYNC
public static final String SYNC
- See Also:
- Constant Field Values
LEADER_ELECT_ZKNODE
public static final String LEADER_ELECT_ZKNODE
- See Also:
- Constant Field Values
SHARD_LEADERS_ZKNODE
public static final String SHARD_LEADERS_ZKNODE
- See Also:
- Constant Field Values
ZkStateReader
public ZkStateReader(SolrZkClient zkClient)
ZkStateReader
public ZkStateReader(String zkServerAddress,
int zkClientTimeout,
int zkClientConnectTimeout)
throws InterruptedException,
TimeoutException,
IOException
- Throws:
InterruptedException
TimeoutException
IOException
toJSON
public static byte[] toJSON(Object o)
toUTF8
public static byte[] toUTF8(CharArr out)
fromJSON
public static Object fromJSON(byte[] utf8)
updateCloudState
public void updateCloudState(boolean immediate)
throws org.apache.zookeeper.KeeperException,
InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
updateLiveNodes
public void updateLiveNodes()
throws org.apache.zookeeper.KeeperException,
InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
createClusterStateWatchersAndUpdate
public void createClusterStateWatchersAndUpdate()
throws org.apache.zookeeper.KeeperException,
InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
getCloudState
public CloudState getCloudState()
- Returns:
- information about the cluster from ZooKeeper
getUpdateLock
public Object getUpdateLock()
close
public void close()
getLeaderUrl
public String getLeaderUrl(String collection,
String shard)
throws InterruptedException,
org.apache.zookeeper.KeeperException
- Get shard leader url.
- Throws:
InterruptedException
org.apache.zookeeper.KeeperException
getLeaderUrl
public String getLeaderUrl(String collection,
String shard,
int timeout)
throws InterruptedException,
org.apache.zookeeper.KeeperException
- Throws:
InterruptedException
org.apache.zookeeper.KeeperException
getLeaderProps
public ZkNodeProps getLeaderProps(String collection,
String shard)
throws InterruptedException
- Get shard leader properties.
- Throws:
InterruptedException
getLeaderProps
public ZkNodeProps getLeaderProps(String collection,
String shard,
int timeout)
throws InterruptedException
- Throws:
InterruptedException
getShardLeadersPath
public static String getShardLeadersPath(String collection,
String shardId)
- Get path where shard leader properties live in zookeeper.
getCoreNodeName
public static String getCoreNodeName(String nodeName,
String coreName)
- Get CoreNodeName for a core. This name is unique across the collection.
- Parameters:
nodeName
- in form: 127.0.0.1:54065_solr
getReplicaProps
public List<ZkCoreNodeProps> getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName)
getReplicaProps
public List<ZkCoreNodeProps> getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName,
String mustMatchStateFilter)
getReplicaProps
public List<ZkCoreNodeProps> getReplicaProps(String collection,
String shardId,
String thisNodeName,
String coreName,
String mustMatchStateFilter,
String mustNotMatchStateFilter)
getZkClient
public SolrZkClient getZkClient()
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.