The error message indicates that Beeline is unable to connect to HiveServer2 at localhost:10000, resulting in a "Connection refused" error. This issue can arise due to several reasons. Here's how you can troubleshoot and resolve it:
1. Verify HiveServer2 is Running:
-
Check if HiveServer2 is Active:
Run the following command to see if HiveServer2 is running:
ps aux | grep HiveServer2
If HiveServer2 is not listed, it means it's not running.
-
Start HiveServer2:
If it's not running, start it using:
$HIVE_HOME/bin/hiveserver2 &
This will start HiveServer2 in the background.
2. Check Network Binding Configuration:
- Review
hive-site.xml:
Open the hive-site.xml file located in $HIVE_HOME/conf/ and look for the property hive.server2.thrift.bind.host.
<property>
hive.server2.thrift.bind.host
localhost
```
If the value is set to localhost, HiveServer2 binds only to the loopback interface, making it inaccessible from external hosts.
- Modify Binding Host:
To allow connections from other machines, change the value to
0.0.0.0:
<property>
hive.server2.thrift.bind.host
0.0.0.0
```
This configuration allows HiveServer2 to accept connections on all network interfaces.
3. Verify Port Availability:
-
Check Listening Ports:
Ensure that HiveServer2 is listening on the correct port (default is 10000):
netstat -anop | grep 10000
You should see an entry indicating that the port is open and listening.
-
Address Port Conflicts:
If another process is using port 10000, either stop that process or configure HiveServer2 to use a different port by modifying the hive.server2.thrift.port property in hive-site.xml.