Support Questions

Find answers, ask questions, and share your expertise

Hiveserver2 listen on localhost only.

avatar
Rising Star

Is there a way to make Hiveserver2 listen to 127.0.0.1 or localhost? I am installing a separate hiveserver2 instance to be used by an application running on an edge node and I want to restrict access to that hiveserver2 instance to only queries coming from that application.

6 REPLIES 6

avatar
Super Guru

@Theyaa Matti,

You can do it by adding 'hive.server2.thrift.bind.host' in hive-site.xml and set it to localhost/127.0.0.1.

If you are using Ambari , go to

Hive -> Configs -> Advanced -> Custom hive-site.xml . Please refer the screenshot below

45408-screen-shot-2017-12-14-at-24810-pm.png

Thanks,

Aditya

avatar
Rising Star

@Aditya Sirna

I tried your suggestion but it does not seem to work at all. Hive Server2 is still listening on all hosts according to below. I wanted to listen to localhost/127.0.0.1 instead of the *.

LISTEN     0      50                        *:10001                    *:*      users:(("java",2232873,540))

avatar
Super Collaborator

did you restart the hive server after the change?

avatar
Super Guru

@Theyaa Matti,

I guess you are using 'http' transport mode for sending RPC messages. Can you please try changing it to binary and see if it works.

set 'hive.server2.thrift.bind.host' to 'localhost' and

'hive.server2.transport.mode' to 'binary' in hive-site.xml and restart Hive

Thanks,

Aditya

avatar
Super Collaborator

I have one more thought on this: when you enter 'localhost' in Ambari, it gets replaced with the hostname of the node. So in order to really create a binding only to the locale interface, try entering the IP 127.0.0.1 as the hostname.

avatar
Rising Star

I tried your suggestion and it seems to work when the transport mode is binary but it does not when transport mode is http. Is this a bug need to be reported? or there is a different config for the http transport mode?