Created 12-14-2017 12:17 AM
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.
Created on 12-14-2017 09:24 AM - edited 08-17-2019 06:10 PM
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
Thanks,
Aditya
Created 12-14-2017 04:31 PM
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))
Created 12-15-2017 11:17 AM
did you restart the hive server after the change?
Created 12-15-2017 11:51 AM
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
Created 12-15-2017 03:35 PM
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.
Created 12-15-2017 06:01 PM
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?