public final class ZkController extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COLLECTION_PARAM_PREFIX |
static String |
CONFIGNAME_PROP |
static String |
CONFIGS_ZKNODE |
protected Overseer |
overseer |
Constructor and Description |
---|
ZkController(CoreContainer cc,
String zkServerAddress,
int zkClientTimeout,
int zkClientConnectTimeout,
String localHost,
String locaHostPort,
String localHostContext,
int leaderVoteWait,
int leaderConflictResolveWait,
boolean genericCoreNodeNames,
CurrentCoreDescriptorProvider registerOnReconnect) |
Modifier and Type | Method and Description |
---|---|
static void |
bootstrapConf(SolrZkClient zkClient,
CoreContainer cc,
String solrHome)
If in SolrCloud mode, upload config sets for each SolrCore in solr.xml.
|
static boolean |
checkChrootPath(String zkHost,
boolean create)
Validates if the chroot exists in zk (or if it is successfully created).
|
void |
checkOverseerDesignate() |
void |
close()
Closes the underlying ZooKeeper client.
|
boolean |
configFileExists(String collection,
String fileName)
Returns true if config file exists
|
void |
createCollection(String collection) |
void |
createCollectionZkNode(CloudDescriptor cd) |
static void |
downloadConfigDir(SolrZkClient zkClient,
String configName,
File dir) |
static void |
downloadFromZK(SolrZkClient zkClient,
String zkPath,
File dir) |
boolean |
ensureReplicaInLeaderInitiatedRecovery(String collection,
String shardId,
String replicaUrl,
ZkCoreNodeProps replicaCoreProps,
boolean forcePublishState)
When a leader receives a communication error when trying to send a request to a replica,
it calls this method to ensure the replica enters recovery when connectivity is restored.
|
String |
getBaseUrl() |
int |
getClientTimeout() |
ClusterState |
getClusterState() |
byte[] |
getConfigFileData(String zkConfigName,
String fileName)
Returns config file data (in bytes)
|
String |
getCoreNodeName(CoreDescriptor descriptor) |
String |
getHostName() |
String |
getHostPort() |
int |
getLeaderConflictResolveWait() |
String |
getLeaderInitiatedRecoveryState(String collection,
String shardId,
String coreNodeName) |
String |
getLeaderInitiatedRecoveryZnodePath(String collection,
String shardId) |
String |
getLeaderInitiatedRecoveryZnodePath(String collection,
String shardId,
String coreNodeName) |
ZkCoreNodeProps |
getLeaderProps(String collection,
String slice,
int timeoutms)
Get leader props directly from zk nodes.
|
ZkCoreNodeProps |
getLeaderProps(String collection,
String slice,
int timeoutms,
boolean failImmediatelyOnExpiration)
Get leader props directly from zk nodes.
|
int |
getLeaderVoteWait() |
String |
getNodeName() |
Overseer |
getOverseer() |
DistributedQueue |
getOverseerCollectionQueue() |
DistributedMap |
getOverseerCompletedMap() |
LeaderElector |
getOverseerElector() |
DistributedMap |
getOverseerFailureMap() |
DistributedQueue |
getOverseerJobQueue() |
DistributedMap |
getOverseerRunningMap() |
SolrZkClient |
getZkClient() |
String |
getZkServerAddress() |
ZkStateReader |
getZkStateReader() |
boolean |
isConnected() |
boolean |
isReplicaInRecoveryHandling(String replicaUrl) |
static void |
linkConfSet(SolrZkClient zkClient,
String collection,
String confSetName) |
boolean |
pathExists(String path)
Returns true if the path exists
|
void |
preRegister(CoreDescriptor cd) |
void |
publish(CoreDescriptor cd,
String state) |
void |
publish(CoreDescriptor cd,
String state,
boolean updateLastState) |
void |
publish(CoreDescriptor cd,
String state,
boolean updateLastState,
boolean forcePublish)
Publish core state to overseer.
|
void |
publishAndWaitForDownStates() |
String |
register(String coreName,
CoreDescriptor desc)
Register shard with ZooKeeper.
|
String |
register(String coreName,
CoreDescriptor desc,
boolean recoverReloadedCores,
boolean afterExpiration)
Register shard with ZooKeeper.
|
void |
rejoinOverseerElection(String electionNode,
boolean joinAtHead) |
void |
removeReplicaFromLeaderInitiatedRecoveryHandling(String replicaUrl) |
void |
throwErrorIfReplicaReplaced(CoreDescriptor desc) |
static String |
trimLeadingAndTrailingSlashes(String in)
Utility method for trimming and leading and/or trailing slashes from
it's input.
|
void |
unregister(String coreName,
CoreDescriptor cd) |
void |
uploadConfigDir(File dir,
String configName) |
static void |
uploadConfigDir(SolrZkClient zkClient,
File dir,
String configName) |
void |
uploadToZK(File dir,
String zkPath) |
static void |
uploadToZK(SolrZkClient zkClient,
File dir,
String zkPath) |
public static final String CONFIGS_ZKNODE
public static final String COLLECTION_PARAM_PREFIX
public static final String CONFIGNAME_PROP
protected volatile Overseer overseer
public ZkController(CoreContainer cc, String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout, String localHost, String locaHostPort, String localHostContext, int leaderVoteWait, int leaderConflictResolveWait, boolean genericCoreNodeNames, CurrentCoreDescriptorProvider registerOnReconnect) throws InterruptedException, TimeoutException, IOException
public int getLeaderVoteWait()
public int getLeaderConflictResolveWait()
public void close()
public boolean configFileExists(String collection, String fileName) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public ClusterState getClusterState()
public byte[] getConfigFileData(String zkConfigName, String fileName) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public String getHostName()
public String getHostPort()
public SolrZkClient getZkClient()
public String getZkServerAddress()
public void publishAndWaitForDownStates() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public static boolean checkChrootPath(String zkHost, boolean create) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public boolean isConnected()
public String getNodeName()
public boolean pathExists(String path) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public String register(String coreName, CoreDescriptor desc) throws Exception
Exception
public String register(String coreName, CoreDescriptor desc, boolean recoverReloadedCores, boolean afterExpiration) throws Exception
Exception
public ZkCoreNodeProps getLeaderProps(String collection, String slice, int timeoutms) throws InterruptedException
InterruptedException
public ZkCoreNodeProps getLeaderProps(String collection, String slice, int timeoutms, boolean failImmediatelyOnExpiration) throws InterruptedException
InterruptedException
public String getBaseUrl()
public void publish(CoreDescriptor cd, String state) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void publish(CoreDescriptor cd, String state, boolean updateLastState) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void publish(CoreDescriptor cd, String state, boolean updateLastState, boolean forcePublish) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void unregister(String coreName, CoreDescriptor cd) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedException
org.apache.zookeeper.KeeperException
public void createCollection(String collection) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void uploadToZK(File dir, String zkPath) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void uploadConfigDir(File dir, String configName) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void createCollectionZkNode(CloudDescriptor cd)
public ZkStateReader getZkStateReader()
public static void uploadToZK(SolrZkClient zkClient, File dir, String zkPath) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public static void downloadFromZK(SolrZkClient zkClient, String zkPath, File dir) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public String getCoreNodeName(CoreDescriptor descriptor)
public static void uploadConfigDir(SolrZkClient zkClient, File dir, String configName) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public static void downloadConfigDir(SolrZkClient zkClient, String configName, File dir) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void preRegister(CoreDescriptor cd)
public static void linkConfSet(SolrZkClient zkClient, String collection, String confSetName) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public static void bootstrapConf(SolrZkClient zkClient, CoreContainer cc, String solrHome) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public DistributedQueue getOverseerJobQueue()
public DistributedQueue getOverseerCollectionQueue()
public DistributedMap getOverseerRunningMap()
public DistributedMap getOverseerCompletedMap()
public DistributedMap getOverseerFailureMap()
public int getClientTimeout()
public Overseer getOverseer()
public LeaderElector getOverseerElector()
public static String trimLeadingAndTrailingSlashes(String in)
public void rejoinOverseerElection(String electionNode, boolean joinAtHead)
public void checkOverseerDesignate()
public boolean ensureReplicaInLeaderInitiatedRecovery(String collection, String shardId, String replicaUrl, ZkCoreNodeProps replicaCoreProps, boolean forcePublishState) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public boolean isReplicaInRecoveryHandling(String replicaUrl)
public void removeReplicaFromLeaderInitiatedRecoveryHandling(String replicaUrl)
public String getLeaderInitiatedRecoveryState(String collection, String shardId, String coreNodeName)
public String getLeaderInitiatedRecoveryZnodePath(String collection, String shardId)
public String getLeaderInitiatedRecoveryZnodePath(String collection, String shardId, String coreNodeName)
public void throwErrorIfReplicaReplaced(CoreDescriptor desc)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.