使用hiveserver2之间你必须做如下的配置变动,配置如果失败将产生不可预料的行为 。
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
Number of Concurrent Connections | HiveServer2 Heap Size Recommended Range | Hive Metastore Heap Size Recommended Range |
---|---|---|
Up to 40 concurrent connections Cloudera recommends splitting HiveServer2 into multiple instances and load-balancing once you start allocating over 16 GB to HiveServer2. This reduces the impact of Java garbage collection on active processing by the service. | 12 - 16 GB | 12 - 16 GB |
Up to 20 concurrent connections | 6 - 12 GB | 10 - 12 GB |
Up to 10 concurrent connections | 4 - 6 GB | 4 - 10 GB |
One connection | 4 GB | 4 GB |
Table Lock Manager (必须)
You must properly configure and enable Hive's 表锁管理者. This requires 安装ZooKeeper and setting up a ZooKeeper ensemble; see ZooKeeper Installation.
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):
<property> <name>hive.support.concurrency</name> <description>Enable Hive's Table Lock Manager Service</description> <value>true</value> </property> <property> <name>hive.zookeeper.quorum</name> <description>Zookeeper quorum used by Hive's Table Lock Manager</description> <value>zk1.myco.com,zk2.myco.com,zk3.myco.com</value> </property>
hive.zookeeper.client.port
If ZooKeeper is not using the 默认值for ClientPort , you need to set hive.zookeeper.client.port in /etc/hive/conf/hive-site.xml to the same value that ZooKeeper is using. Check /etc/zookeeper/conf/zoo.cfg 找到值 ---- ClientPort . 如果 ClientPort 不是2181 (默认值), set hive.zookeeper.client.port to the same value. For example, if ClientPort is set to 2222, set hive.zookeeper.client.port to 2222 as well:
<property> <name>hive.zookeeper.client.port</name> <value>2222</value> <description> The port at which the clients will connect. </description> </property>
JDBC driver
The connection URL 格式and the driver 类名称不同for HiveServer2 and HiveServer1:
HiveServer version | Connection URL | Driver Class |
---|---|---|
HiveServer2 | jdbc:hive2://<host>:<port> | org.apache.hive.jdbc.HiveDriver |
HiveServer1 | jdbc:hive://<host>:<port> | org.apache.hadoop.hive.jdbc.HiveDriver |
Authentication授权
HiveServer2 can be configured to 授权所有的连接 ; 默认情况, 它允许任何客户端连接. HiveServer2 支持 Kerberos or LDAP 授权; configure this in the hive.server2.authentication property in the hive-site.xml 文件. 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.