Issue:
At hiveserver2 node, could connect hiveserver2 via localhost/127.0.0.1, but connection refused when using ip.
At other node, could not access hiveserver2 via ip
Connect command is like:
/opt/hive/bin/beeline -ujdbc:hive2://hostname:10000/datacenter_huke_firstp2p -nhadoop -phadoop
How-to-trace issue:
- netstat -nltp | grep 10000
tcp 0 0 127.0.0.1:10000 0.0.0.0:* LISTEN 5810/java
which means, just port 10000 is binded with 127.0.0.1. Just 127.0.0.1 and localhost could access this port. Here is the setting in /etc/hosts:
127.0.0.1 localhost - In hive-site.xml file, check hive.server2.thrift.bind.host
<property>
<name>hive.server2.thrift.bind.host</name>
<value>localhost</value>
<description>Bind host on which to run the HiveServer2 Thrift interface.
Can be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST</description>
</property>
That is the point, the value should be 0.0.0.0, which means every ip style could access this port.(including ip, hostname, 127.0.0.1, localhost) - After setting this property to "0.0.0.0". Hiveserver2 could be connected now.