This is the documentation for Cloudera 5.3.x. Documentation for other versions is available at Cloudera Documentation.

Configuring HiveServer2

You must make the following configuration changes before using HiveServer2. Failure to do so may result in unpredictable behavior.
  Warning: HiveServer1 is deprecated in CDH 5.3, and will be removed in a future release of CDH. Users of HiveServer1 should upgrade to HiveServer2 as soon as possible.

HiveServer2 Memory Requirements

Table 1. Hive Heap Size Recommendations
Cluster Size HiveServer2 Heap Size Hive Metastore Heap Size
100 nodes or larger 24 GB 24 GB
50-99 nodes 12 GB 12 GB
11-49 nodes 6 GB 6 GB
2-10 nodes 2 GB 2 GB
1 node 256 MB 256 MB

For information on configuring heap for HiveServer2, as well as Hive MetaStore and Hive clients, see Configuring Heap Size and Garbage Collection for Hive Components.

Table Lock Manager (Required)

You must properly configure and enable Hive's Table Lock Manager. This requires installing ZooKeeper and setting up a ZooKeeper ensemble; see ZooKeeper Installation.


Failure to do this will prevent HiveServer2 from handling concurrent query requests and may result in data corruption.

Enable the lock manager by setting properties in /etc/hive/conf/hive-site.xml as follows (substitute your actual ZooKeeper node names for those in the example):

  <description>Enable Hive's Table Lock Manager Service</description>

  <description>Zookeeper quorum used by Hive's Table Lock Manager</description>

Enabling the Table Lock Manager without specifying a list of valid Zookeeper quorum nodes will result in unpredictable behavior. Make sure that both properties are properly configured.

(The above settings are also needed if you are still using HiveServer1. HiveServer1 is deprecated; migrate to HiveServer2 as soon as possible.)


If ZooKeeper is not using the default value forClientPort, you need to sethive.zookeeper.client.portin /etc/hive/conf/hive-site.xml to the same value that ZooKeeper is using. Check /etc/zookeeper/conf/zoo.cfg to find the value forClientPort. IfClientPortis set to any value other than 2181 (the default), sethive.zookeeper.client.portto the same value. For example, ifClientPortis set to 2222, sethive.zookeeper.client.portto 2222 as well:

  The port at which the clients will connect.

JDBC driver

The connection URL format and the driver class are different for HiveServer2 and HiveServer1:

HiveServer version

Connection URL

Driver Class






HiveServer2 can be configured to authenticate all connections; by default, it allows any client to connect. HiveServer2 supports either Kerberos or LDAP authentication; configure this in the hive.server2.authentication property in the hive-site.xml file. You can also configure Pluggable Authentication, which allows you to use a custom authentication provider for HiveServer2; and HiveServer2 Impersonation, which allows users to execute queries and access HDFS files as the connected user rather than the super user who started the HiveServer2 daemon. For more information, see Hive Security Configuration.

Running HiveServer2 and HiveServer Concurrently


Cloudera strongly recommends running HiveServer2 instead of the original HiveServer (HiveServer1) package; HiveServer1 is deprecated.

HiveServer2 and HiveServer1 can be run concurrently on the same system, sharing the same data sets. This allows you to run HiveServer1 to support, for example, Perl or Python scripts that use the native HiveServer1 Thrift bindings.

Both HiveServer2 and HiveServer1 bind to port 10000 by default, so at least one of them must be configured to use a different port. You can set the port for HiveServer2 in hive-site.xml by means of the hive.server2.thrift.port property. For example:
  <description>TCP port number to listen on, default 10000</description>

You can also specify the port (and the host IP address in the case of HiveServer2) by setting these environment variables:

HiveServer version


Host Address






< Host bindings cannot be specified >