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, wait
getCollection, isRoutedAlias
public ZkClientClusterStateProvider(ZkStateReader zkStateReader)
public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)
public ZkClientClusterStateProvider(String zkHost)
public ClusterState.CollectionRef getState(String collection)
ClusterStateProvider
getState
in interface ClusterStateProvider
public Set<String> getLiveNodes()
ClusterStateProvider
getLiveNodes
in interface ClusterStateProvider
public List<String> resolveAlias(String alias)
ClusterStateProvider
resolveAlias
in interface ClusterStateProvider
public Map<String,String> getAliasProperties(String alias)
ClusterStateProvider
getAliasProperties
in interface ClusterStateProvider
public String resolveSimpleAlias(String alias) throws IllegalArgumentException
ClusterStateProvider
resolveSimpleAlias
in interface ClusterStateProvider
IllegalArgumentException
- if an alias points to more than 1 collection, either directly or indirectly.public Object getClusterProperty(String propertyName)
ClusterStateProvider
getClusterProperty
in interface ClusterStateProvider
public <T> T getClusterProperty(String propertyName, T def)
ClusterStateProvider
getClusterProperty
in interface ClusterStateProvider
public ClusterState getClusterState() throws IOException
ClusterStateProvider
getClusterState
in interface ClusterStateProvider
IOException
public Map<String,Object> getClusterProperties()
ClusterStateProvider
getClusterProperties
in interface ClusterStateProvider
public String getPolicyNameByCollection(String coll)
ClusterStateProvider
getPolicyNameByCollection
in interface ClusterStateProvider
public 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 ClusterStateProvider
public ZkStateReader getZkStateReader()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isClosed()
isClosed
in interface SolrCloseable
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.