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
|
String |
getAlias(String alias)
Given an alias, returns the collection name that this alias points to
|
Object |
getClusterProperty(String propertyName)
Obtain a cluster property, or null if it doesn't exist.
|
Object |
getClusterProperty(String propertyName,
String def)
Obtain a cluster property, or the default value if it doesn't exist.
|
String |
getCollectionName(String name)
Given a name, returns the collection name if an alias by that name exists, or
returns the name itself, if no alias exists.
|
ClusterState.CollectionRef |
getState(String collection)
Obtain the state of the collection (cluster status).
|
ZkStateReader |
getZkStateReader() |
Set<String> |
liveNodes()
Obtain set of live_nodes for the cluster.
|
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.
|
public ZkClientClusterStateProvider(ZkStateReader zkStateReader)
public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)
public ZkClientClusterStateProvider(String zkHost)
public ClusterState.CollectionRef getState(String collection)
ClusterStateProvidergetState in interface ClusterStateProviderpublic ZkStateReader getZkStateReader()
public Set<String> liveNodes()
ClusterStateProviderliveNodes in interface ClusterStateProviderpublic String getAlias(String alias)
ClusterStateProvidergetAlias in interface ClusterStateProviderpublic Object getClusterProperty(String propertyName)
ClusterStateProvidergetClusterProperty in interface ClusterStateProviderpublic Object getClusterProperty(String propertyName, String def)
ClusterStateProvidergetClusterProperty in interface ClusterStateProviderpublic String getCollectionName(String name)
ClusterStateProvidergetCollectionName 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 void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2000-2017 Apache Software Foundation. All Rights Reserved.