public class ZkClientClusterStateProvider extends Object implements ClusterStateProvider
| Constructor and Description |
|---|
ZkClientClusterStateProvider(Collection<String> zkHosts,
String chroot) |
ZkClientClusterStateProvider(String zkHost) |
ZkClientClusterStateProvider(ZkStateReader zkStateReader) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect() |
void |
downloadConfig(String configName,
Path downloadPath)
Download a named config from Zookeeper to a location on the filesystem
|
Map<String,String> |
getAliasProperties(String alias)
Return alias properties, or an empty map if the alias has no properties.
|
Map<String,Object> |
getClusterProperties()
Obtain cluster properties.
|
Object |
getClusterProperty(String propertyName)
Obtain a cluster property, or null if it doesn't exist.
|
<T> T |
getClusterProperty(String propertyName,
T def)
Obtain a cluster property, or the default value if it doesn't exist.
|
ClusterState |
getClusterState()
Obtain the current cluster state.
|
Set<String> |
getLiveNodes()
Obtain set of live_nodes for the cluster.
|
String |
getPolicyNameByCollection(String coll)
Get the collection-specific policy
|
ClusterState.CollectionRef |
getState(String collection)
Obtain the state of the collection (cluster status).
|
ZkStateReader |
getZkStateReader() |
boolean |
isClosed() |
List<String> |
resolveAlias(String alias)
Given a collection alias, returns a list of collections it points to, or returns a singleton list of the input if
it's not an alias.
|
String |
resolveSimpleAlias(String alias)
Given a collection alias, return a single collection it points to, or the original name if it's not an
alias.
|
String |
toString() |
void |
uploadConfig(Path configPath,
String configName)
Upload a set of config files to Zookeeper and give it a name
NOTE: You should only allow trusted users to upload configs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCollection, isRoutedAliaspublic ZkClientClusterStateProvider(ZkStateReader zkStateReader)
public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)
public ZkClientClusterStateProvider(String zkHost)
public ClusterState.CollectionRef getState(String collection)
ClusterStateProvidergetState in interface ClusterStateProviderpublic Set<String> getLiveNodes()
ClusterStateProvidergetLiveNodes in interface ClusterStateProviderpublic List<String> resolveAlias(String alias)
ClusterStateProviderresolveAlias in interface ClusterStateProviderpublic Map<String,String> getAliasProperties(String alias)
ClusterStateProvidergetAliasProperties in interface ClusterStateProviderpublic String resolveSimpleAlias(String alias) throws IllegalArgumentException
ClusterStateProviderresolveSimpleAlias in interface ClusterStateProviderIllegalArgumentException - if an alias points to more than 1 collection, either directly or indirectly.public Object getClusterProperty(String propertyName)
ClusterStateProvidergetClusterProperty in interface ClusterStateProviderpublic <T> T getClusterProperty(String propertyName, T def)
ClusterStateProvidergetClusterProperty in interface ClusterStateProviderpublic ClusterState getClusterState() throws IOException
ClusterStateProvidergetClusterState in interface ClusterStateProviderIOExceptionpublic Map<String,Object> getClusterProperties()
ClusterStateProvidergetClusterProperties in interface ClusterStateProviderpublic String getPolicyNameByCollection(String coll)
ClusterStateProvidergetPolicyNameByCollection in interface ClusterStateProviderpublic void downloadConfig(String configName, Path downloadPath) throws IOException
configName - the name of the configdownloadPath - the path to write config files toIOException - if an I/O exception occurspublic void uploadConfig(Path configPath, String configName) throws IOException
configPath - Path to the config filesconfigName - the name of the configIOException - if an IO error occurspublic void connect()
connect in interface ClusterStateProviderpublic ZkStateReader getZkStateReader()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
isClosed in interface SolrCloseableCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.