Support Questions

Find answers, ask questions, and share your expertise

(hive) Enable HTTP & Binary transport modes in HiveServer2?

avatar

What do you recommend for enabling both HTTP & Binary transport mode for HiveServer2?

This is needed to support Knox, which requires HTTP, and clients which only support Binary mode, such as the Hive Ambari View.

1 ACCEPTED SOLUTION

avatar

Glad to hear that HIVE-5312 will allow a single HS2 instance to run both modes simultaneously. In the meantime you have a couple options...

  1. Two HS2 instances on a single host, different modes on different ports
  2. Two HS2 instances on different hosts, different modes on different or same port

Two HS2 instances on a single host

Note: the second instance will not be managed by Ambari

Start HS2 manually, and override transport mode and port properties:

su - hive /usr/hdp/current/hive-server2/bin/hiveserver2 \
-hiveconf hive.metastore.uris=' ' \
-hiveconf hive.server2.transport.mode=http \
-hiveconf hive.server2.thrift.http.port=10001 \
>/var/log/hive/hiveserver2.out 2> /var/log/hive/hiveserver2.log &

Alternatively, you may duplicate the config directory[1] and set environment variable HIVE_CONF_DIR instead of overriding the hive.server2 properties with -hiveconf.

[1] HDP 2.3+: /etc/hive/conf/conf.server | HDP < 2.3: /etc/hive/conf.server

Two HS2 instances on different hosts

Note: using Ambari is preferable, however you can apply the manual steps from the previous section for clusters managed by Ambari 1.x or without Ambari

  1. Add a HS2 instance to the desired host using Ambari
  2. Add a new Hive config group for the host where the new HS2 instance was deployed
  3. Modify the config group properties: hive.server2.transport.mode & hive.server2.thrift.http.port
  4. Manage the new HS2 component using Ambari

Standard values:

  • hive.server2.transport.mode=binary & hive.server2.thrift.port=10000
  • hive.server2.transport.mode=http & hive.server2.thrift.http.port=10001

View solution in original post

10 REPLIES 10

avatar

As per my understanding the property hive.server2.transport.mode in hive-site.xml is used to control the transport mode, you can set it to either http or binary. You could potentially run two HiveServer2 services each using its own config property value for hive.server2.transport.mode one running in binary mode and the other in http.

avatar

Found that there is working being done to allow both in the same HiveServer2: https://issues.apache.org/jira/browse/HIVE-5312

avatar

Hello

There currently is work undertaken to help on this situation: https://issues.apache.org/jira/browse/HIVE-5312

In mean time a way about this might be mutiple Hiveserver2's, in your case two,configured one for http and one for binary. In hive-site.xml editing the hive.server2.transport.mode config

avatar

Glad to hear that HIVE-5312 will allow a single HS2 instance to run both modes simultaneously. In the meantime you have a couple options...

  1. Two HS2 instances on a single host, different modes on different ports
  2. Two HS2 instances on different hosts, different modes on different or same port

Two HS2 instances on a single host

Note: the second instance will not be managed by Ambari

Start HS2 manually, and override transport mode and port properties:

su - hive /usr/hdp/current/hive-server2/bin/hiveserver2 \
-hiveconf hive.metastore.uris=' ' \
-hiveconf hive.server2.transport.mode=http \
-hiveconf hive.server2.thrift.http.port=10001 \
>/var/log/hive/hiveserver2.out 2> /var/log/hive/hiveserver2.log &

Alternatively, you may duplicate the config directory[1] and set environment variable HIVE_CONF_DIR instead of overriding the hive.server2 properties with -hiveconf.

[1] HDP 2.3+: /etc/hive/conf/conf.server | HDP < 2.3: /etc/hive/conf.server

Two HS2 instances on different hosts

Note: using Ambari is preferable, however you can apply the manual steps from the previous section for clusters managed by Ambari 1.x or without Ambari

  1. Add a HS2 instance to the desired host using Ambari
  2. Add a new Hive config group for the host where the new HS2 instance was deployed
  3. Modify the config group properties: hive.server2.transport.mode & hive.server2.thrift.http.port
  4. Manage the new HS2 component using Ambari

Standard values:

  • hive.server2.transport.mode=binary & hive.server2.thrift.port=10000
  • hive.server2.transport.mode=http & hive.server2.thrift.http.port=10001

avatar

To start HS2 manually, recommendation is to start with the option "-hiveconf hive.metastore.uris=' '", basically starts . Also make sure that you either set HIVE_CONF_DIR to point to your new configs before running hiveserver2 command or pass the two overriding parameter as hiveconf arguments to hiveserver2 command. For Standard values you probably meant to say "hive.server2.transport.mode=binary & hive.server2.thrift.port=10000"

avatar

Good catch, thanks. It's corrected now.

avatar

Now that you mention my omission of HIVE_CONF_DIR, I realize it's simpler to override the hive.server2 properties rather than duplicate the entire configs. "Two HS2 instances on a single host" has been updated with this change.

avatar

You need to correct the hiveconf settings in the hiveserver2 start command, you mixed binary with http port.

avatar

Fixed, thank you