Apache ZooKeeper is a centralized service that facilitates the coordination of distributed applications using a simple hierarchal architecture. In addition to supporting centralized administration of configuration information, ZooKeeper offers a number of features out of the box, including naming, synchronization, and group services. ZooKeeper services can be replicated onto server clusters, called ensembles, which allow for a scalable environment with a high-level of availability. The driver supports retrieving connection information from Apache ZooKeeper services using the methods described in this section.

To retrieve connection information from an Apache ZooKeeper service:
  • Set the ZooKeeperDiscovery property to true (Enabled).
  • Set the ZooKeeperNamespace property to specify the name of the ZooKeeper name space to which you want to retrieve configuration information.
  • Set the ServerName connection property to specify a list of the member servers for the ZooKeeper ensemble to which you want to connect. The value for this property takes the following form:

    server_name:port_number | IP_address:port_number [, ...]

    Note: The driver will return an error if unable to connect to any of the ZooKeeper servers specified with the ServerName property.

The following example demonstrates a basic connection to Apache ZooKeeper:

Connection conn = DriverManager.getConnection
 ("jdbc:datadirect:hive://ZKServer1:10000,255.125.1.11:2818,ZKServer3:2828;
  ZooKeeperNamespace=mynamespace1;ZooKeeperDiscovery=true");
One of the primary benefits of ZooKeeper is that it provides centralized management of configuration settings. To take advantage of this feature, the driver transparently retrieves configuration information from the ZooKeeper service at connection. This information is then used to determine the behavior of the driver when establishing the session with the Hive server. However, as a result, settings for certain connection properties are overridden by those provided by the service. The following table describes the type of information typically retrieved by the driver and affected connection properties.
Table 1. Configuration information retrieved from Apache ZooKeeper
Retrieved Configuration Information Overridden Connection Properties
Server name ServerName
Port number PortNumber
Kerberos-related settings
Encryption-related settings EncryptionMethod
Transport mode related settings