org.apache.accumulo.core.client
Class ZooKeeperInstance

java.lang.Object
  extended by org.apache.accumulo.core.client.ZooKeeperInstance
All Implemented Interfaces:
Instance

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 Summary
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.
 
Method Summary
 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(ZooCache zooCache, UUID instanceId)
          Given a zooCache and instanceId, look up the instance name.
 void setConfiguration(AccumuloConfiguration conf)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZooKeeperInstance

public ZooKeeperInstance(String instanceName,
                         String zooKeepers)
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
public ZooKeeperInstance(String instanceName,
                                    String zooKeepers,
                                    int sessionTimeout)
Deprecated. since 1.6.0; Use ZooKeeperInstance(Configuration) 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
public ZooKeeperInstance(UUID instanceId,
                                    String zooKeepers)
Deprecated. since 1.6.0; Use ZooKeeperInstance(Configuration) 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
public ZooKeeperInstance(UUID instanceId,
                                    String zooKeepers,
                                    int sessionTimeout)
Deprecated. since 1.6.0; Use ZooKeeperInstance(Configuration) 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

public ZooKeeperInstance(org.apache.commons.configuration.Configuration config)
Parameters:
config - Client configuration for specifying connection options. See ClientConfiguration which extends Configuration with convenience methods specific to Accumulo.
Since:
1.6.0
Method Detail

getInstanceID

public String getInstanceID()
Description copied from interface: Instance
Returns a unique string that identifies this instance of accumulo.

Specified by:
getInstanceID in interface Instance
Returns:
a UUID

getMasterLocations

public List<String> getMasterLocations()
Description copied from interface: Instance
Returns the location(s) of the accumulo master and any redundant servers.

Specified by:
getMasterLocations in interface Instance
Returns:
a list of locations in "hostname:port" form

getRootTabletLocation

public String getRootTabletLocation()
Description copied from interface: Instance
Returns the location of the tablet server that is serving the root tablet.

Specified by:
getRootTabletLocation in interface Instance
Returns:
location in "hostname:port" form

getInstanceName

public String getInstanceName()
Description copied from interface: Instance
Returns the instance name given at system initialization time.

Specified by:
getInstanceName in interface Instance
Returns:
current instance name

getZooKeepers

public String getZooKeepers()
Description copied from interface: Instance
Returns a comma-separated list of zookeeper servers the instance is using.

Specified by:
getZooKeepers in interface Instance
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 interface Instance
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 interface Instance
Parameters:
user - a valid accumulo user
pass - If a mutable CharSequence is passed in, it may be cleared after this call.
Returns:
the accumulo Connector
Throws:
AccumuloException - when a generic exception occurs
AccumuloSecurityException - 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 interface Instance
Parameters:
user - a valid accumulo user
pass - A UTF-8 encoded password. The password may be cleared after making this call.
Returns:
the accumulo Connector
Throws:
AccumuloException - when a generic exception occurs
AccumuloSecurityException - 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 interface Instance
Parameters:
principal - a valid accumulo user
token - Use the token type configured for the Accumulo instance you are connecting to. An Accumulo instance with default configurations will use PasswordToken
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 interface Instance
Parameters:
principal - a valid accumulo user
pass - A UTF-8 encoded password. The password may be cleared after making this call.
Returns:
the accumulo Connector
Throws:
AccumuloException - when a generic exception occurs
AccumuloSecurityException - when a user's credentials are invalid

getConfiguration

@Deprecated
public AccumuloConfiguration getConfiguration()
Deprecated. 

Description copied from interface: Instance
Returns the AccumuloConfiguration to use when interacting with this instance.

Specified by:
getConfiguration in interface Instance
Returns:
the AccumuloConfiguration that specifies properties related to interacting with this instance
See Also:
for client-side reading of the server-side configuration.

setConfiguration

@Deprecated
public void setConfiguration(AccumuloConfiguration conf)
Deprecated. 

Description copied from interface: Instance
Set the AccumuloConfiguration to use when interacting with this instance.

Specified by:
setConfiguration in interface Instance
Parameters:
conf - accumulo configuration
See Also:
InstanceOperations.setProperty(String, String)

lookupInstanceName

public static String lookupInstanceName(ZooCache zooCache,
                                        UUID instanceId)
Given a zooCache and instanceId, look up the instance name.



Copyright © 2015 Apache Accumulo Project. All rights reserved.