Package org.apache.accumulo.core.client
Class ZooKeeperInstance
java.lang.Object
org.apache.accumulo.core.client.ZooKeeperInstance
- All Implemented Interfaces:
Instance
- Direct Known Subclasses:
MiniAccumuloInstance
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 Summary
ConstructorDescriptionZooKeeperInstance
(String instanceName, String zooKeepers) ZooKeeperInstance
(String instanceName, String zooKeepers, int sessionTimeout) Deprecated.ZooKeeperInstance
(UUID instanceId, String zooKeepers) Deprecated.since 1.6.0; UseZooKeeperInstance(ClientConfiguration)
instead.ZooKeeperInstance
(UUID instanceId, String zooKeepers, int sessionTimeout) Deprecated.since 1.6.0; UseZooKeeperInstance(ClientConfiguration)
instead.ZooKeeperInstance
(ClientConfiguration config) ZooKeeperInstance
(org.apache.commons.configuration.Configuration config) Deprecated.since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API; useZooKeeperInstance(ClientConfiguration)
instead. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.accumulo.core.conf.AccumuloConfiguration
Deprecated.getConnector
(String principal, byte[] pass) Deprecated.getConnector
(String user, CharSequence pass) Deprecated.getConnector
(String user, ByteBuffer pass) Deprecated.getConnector
(String principal, AuthenticationToken token) Returns a connection to this instance of accumulo.Returns a unique string that identifies this instance of accumulo.Returns the instance name given at system initialization time.Returns the location(s) of the accumulo master and any redundant servers.Returns the location of the tablet server that is serving the root tablet.Returns a comma-separated list of zookeeper servers the instance is using.int
Returns the zookeeper connection timeout.static String
lookupInstanceName
(org.apache.accumulo.fate.zookeeper.ZooCache zooCache, UUID instanceId) Deprecated.since 1.7.0ZooCache
is not part of the public API, but its a parameter to this method.void
setConfiguration
(org.apache.accumulo.core.conf.AccumuloConfiguration conf) Deprecated.toString()
-
Constructor Details
-
ZooKeeperInstance
- Parameters:
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.
-
ZooKeeperInstance
Deprecated.since 1.6.0; UseZooKeeperInstance(ClientConfiguration)
instead.- Parameters:
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.
-
ZooKeeperInstance
Deprecated.since 1.6.0; UseZooKeeperInstance(ClientConfiguration)
instead.- Parameters:
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.
-
ZooKeeperInstance
Deprecated.since 1.6.0; UseZooKeeperInstance(ClientConfiguration)
instead.- Parameters:
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.
-
ZooKeeperInstance
Deprecated.since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API; useZooKeeperInstance(ClientConfiguration)
instead.- Parameters:
config
- Client configuration for specifying connection options. SeeClientConfiguration
which extends Configuration with convenience methods specific to Accumulo.- Since:
- 1.6.0
-
ZooKeeperInstance
- Parameters:
config
- Client configuration for specifying connection options. SeeClientConfiguration
which extends Configuration with convenience methods specific to Accumulo.- Since:
- 1.9.0
-
-
Method Details
-
getInstanceID
Description copied from interface:Instance
Returns a unique string that identifies this instance of accumulo.- Specified by:
getInstanceID
in interfaceInstance
- Returns:
- a UUID
-
getMasterLocations
Description copied from interface:Instance
Returns the location(s) of the accumulo master and any redundant servers.- Specified by:
getMasterLocations
in interfaceInstance
- Returns:
- a list of locations in "hostname:port" form
-
getRootTabletLocation
Description copied from interface:Instance
Returns the location of the tablet server that is serving the root tablet.- Specified by:
getRootTabletLocation
in interfaceInstance
- Returns:
- location in "hostname:port" form
-
getInstanceName
Description copied from interface:Instance
Returns the instance name given at system initialization time.- Specified by:
getInstanceName
in interfaceInstance
- Returns:
- current instance name
-
getZooKeepers
Description copied from interface:Instance
Returns a comma-separated list of zookeeper servers the instance is using.- Specified by:
getZooKeepers
in interfaceInstance
- Returns:
- the zookeeper servers this instance is using in "hostname:port" form
-
getZooKeepersSessionTimeOut
public int getZooKeepersSessionTimeOut()Description copied from interface:Instance
Returns the zookeeper connection timeout.- Specified by:
getZooKeepersSessionTimeOut
in interfaceInstance
- Returns:
- the configured timeout to connect to zookeeper
-
getConnector
@Deprecated public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException Deprecated.Description copied from interface:Instance
Returns a connection to this instance of accumulo.- Specified by:
getConnector
in interfaceInstance
- Parameters:
user
- a valid accumulo userpass
- If a mutable CharSequence is passed in, it may be cleared after this call.- Returns:
- the accumulo Connector
- Throws:
AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalid
-
getConnector
@Deprecated public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException Deprecated.Description copied from interface:Instance
Returns a connection to accumulo.- Specified by:
getConnector
in interfaceInstance
- Parameters:
user
- a valid accumulo userpass
- A UTF-8 encoded password. The password may be cleared after making this call.- Returns:
- the accumulo Connector
- Throws:
AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalid
-
getConnector
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException Description copied from interface:Instance
Returns a connection to this instance of accumulo.- Specified by:
getConnector
in interfaceInstance
- Parameters:
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 usePasswordToken
- Throws:
AccumuloException
AccumuloSecurityException
-
getConnector
@Deprecated public Connector getConnector(String principal, byte[] pass) throws AccumuloException, AccumuloSecurityException Deprecated.Description copied from interface:Instance
Returns a connection to accumulo.- Specified by:
getConnector
in interfaceInstance
- Parameters:
principal
- a valid accumulo userpass
- A UTF-8 encoded password. The password may be cleared after making this call.- Returns:
- the accumulo Connector
- Throws:
AccumuloException
- when a generic exception occursAccumuloSecurityException
- when a user's credentials are invalid
-
getConfiguration
Deprecated.Description copied from interface:Instance
Returns the AccumuloConfiguration to use when interacting with this instance.- Specified by:
getConfiguration
in interfaceInstance
- Returns:
- the AccumuloConfiguration that specifies properties related to interacting with this instance
- See Also:
-
setConfiguration
Deprecated.Description copied from interface:Instance
Set the AccumuloConfiguration to use when interacting with this instance.- Specified by:
setConfiguration
in interfaceInstance
- Parameters:
conf
- accumulo configuration- See Also:
-
lookupInstanceName
@Deprecated public static String lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache zooCache, UUID instanceId) Deprecated.since 1.7.0ZooCache
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.Given a zooCache and instanceId, look up the instance name. -
toString
-
ZooKeeperInstance(ClientConfiguration)
instead.