public class ZooKeeperInstance extends Object implements Instance
An implementation of instance that looks in zookeeper to find information needed to connect to an instance of accumulo.
The advantage of using zookeeper to obtain information about accumulo is that zookeeper is highly available, very responsive, and supports caching.
Because it is possible for multiple instances of accumulo to share a single set of zookeeper servers, all constructors require an accumulo instance name. If you do not know the instance names then run accumulo org.apache.accumulo.server.util.ListInstances on an accumulo server.
Constructor and Description |
---|
ZooKeeperInstance(org.apache.commons.configuration.Configuration config) |
ZooKeeperInstance(String instanceName,
String zooKeepers) |
ZooKeeperInstance(String instanceName,
String zooKeepers,
int sessionTimeout)
Deprecated.
since 1.6.0; Use
ZooKeeperInstance(Configuration) instead. |
ZooKeeperInstance(UUID instanceId,
String zooKeepers)
Deprecated.
since 1.6.0; Use
ZooKeeperInstance(Configuration) instead. |
ZooKeeperInstance(UUID instanceId,
String zooKeepers,
int sessionTimeout)
Deprecated.
since 1.6.0; Use
ZooKeeperInstance(Configuration) instead. |
Modifier and Type | Method and Description |
---|---|
org.apache.accumulo.core.conf.AccumuloConfiguration |
getConfiguration()
Deprecated.
|
Connector |
getConnector(String principal,
AuthenticationToken token)
Returns a connection to this instance of accumulo.
|
Connector |
getConnector(String principal,
byte[] pass)
Deprecated.
|
Connector |
getConnector(String user,
ByteBuffer pass)
Deprecated.
|
Connector |
getConnector(String user,
CharSequence pass)
Deprecated.
|
String |
getInstanceID()
Returns a unique string that identifies this instance of accumulo.
|
String |
getInstanceName()
Returns the instance name given at system initialization time.
|
List<String> |
getMasterLocations()
Returns the location(s) of the accumulo master and any redundant servers.
|
String |
getRootTabletLocation()
Returns the location of the tablet server that is serving the root tablet.
|
String |
getZooKeepers()
Returns a comma-separated list of zookeeper servers the instance is using.
|
int |
getZooKeepersSessionTimeOut()
Returns the zookeeper connection timeout.
|
static String |
lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache zooCache,
UUID instanceId)
Deprecated.
since 1.7.0
ZooCache is not part of the public API, but its a parameter to this method. Therefore code that uses this method is not
guaranteed to be stable. This method was deprecated to discourage its use. |
void |
setConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration conf)
Deprecated.
|
String |
toString() |
public ZooKeeperInstance(String instanceName, String zooKeepers)
instanceName
- The name of specific accumulo instance. This is set at initialization time.zooKeepers
- A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.@Deprecated public ZooKeeperInstance(String instanceName, String zooKeepers, int sessionTimeout)
ZooKeeperInstance(Configuration)
instead.instanceName
- The name of specific accumulo instance. This is set at initialization time.zooKeepers
- A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.sessionTimeout
- zoo keeper session time out in milliseconds.@Deprecated public ZooKeeperInstance(UUID instanceId, String zooKeepers)
ZooKeeperInstance(Configuration)
instead.instanceId
- The UUID that identifies the accumulo instance you want to connect to.zooKeepers
- A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.@Deprecated public ZooKeeperInstance(UUID instanceId, String zooKeepers, int sessionTimeout)
ZooKeeperInstance(Configuration)
instead.instanceId
- The UUID that identifies the accumulo instance you want to connect to.zooKeepers
- A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.sessionTimeout
- zoo keeper session time out in milliseconds.public ZooKeeperInstance(org.apache.commons.configuration.Configuration config)
config
- Client configuration for specifying connection options. See ClientConfiguration
which extends Configuration with convenience methods
specific to Accumulo.public String getInstanceID()
Instance
getInstanceID
in interface Instance
public List<String> getMasterLocations()
Instance
getMasterLocations
in interface Instance
public String getRootTabletLocation()
Instance
getRootTabletLocation
in interface Instance
public String getInstanceName()
Instance
getInstanceName
in interface Instance
public String getZooKeepers()
Instance
getZooKeepers
in interface Instance
public int getZooKeepersSessionTimeOut()
Instance
getZooKeepersSessionTimeOut
in interface Instance
@Deprecated public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException
Instance
getConnector
in interface Instance
user
- a valid accumulo userpass
- If a mutable CharSequence is passed in, it may be cleared after this call.AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalid@Deprecated public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException
Instance
getConnector
in interface Instance
user
- a valid accumulo userpass
- A UTF-8 encoded password. The password may be cleared after making this call.AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalidpublic Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException
Instance
getConnector
in interface Instance
principal
- a valid accumulo usertoken
- Use the token type configured for the Accumulo instance you are connecting to. An Accumulo instance with default configurations will use
PasswordToken
AccumuloException
AccumuloSecurityException
@Deprecated public Connector getConnector(String principal, byte[] pass) throws AccumuloException, AccumuloSecurityException
Instance
getConnector
in interface Instance
principal
- a valid accumulo userpass
- A UTF-8 encoded password. The password may be cleared after making this call.AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalid@Deprecated public org.apache.accumulo.core.conf.AccumuloConfiguration getConfiguration()
Instance
getConfiguration
in interface Instance
for client-side reading of the server-side configuration.
@Deprecated public void setConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration conf)
Instance
setConfiguration
in interface Instance
conf
- accumulo configurationInstanceOperations.setProperty(String, String)
@Deprecated public static String lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache zooCache, UUID instanceId)
ZooCache
is not part of the public API, but its a parameter to this method. Therefore code that uses this method is not
guaranteed to be stable. This method was deprecated to discourage its use.Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.