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.
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
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))
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
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.
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?