C.A
C.A

Reputation: 620

Hiveserver2 not responding

I have a hiveserver(hiveserver2) running on port 10000. If I run command:

netstat -nl | grep 10000

I get:

tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN

so the server is up and running.

My hive-site.xml settings:

<property>
 <name>hive.server2.thrift.port</name>
 <value>10000</value>
</property>

My code:

public class ThriftAgent {

private static final String HOST = "localhost";
private static final int PORT = 10000;


public static void main(String[] args) throws Exception {
    TSocket transport = new TSocket(HOST, PORT);
    transport.open();
    TBinaryProtocol protocol = new TBinaryProtocol(transport);
    Client client = new ThriftHive.Client(protocol);
    client.execute("show tables");
    final List<String> results = client.fetchAll();
    for (String result : results) {
        System.out.println(result);
    }
    transport.close();
}
}

I have tried different URL combos but it freezes at client.execute() and does not go any further than that. It does not throw any exceptions either. I have also tried to disable authentication but that did not help either as per thread Requests hang when using Hiveserver2 Thrift Java client

If I connect through JDBC to same host it works.

Also if I start HiveServer (not hiveserver2) it works so something is fishy with hiveserver2.

Upvotes: 2

Views: 4468

Answers (2)

Paulo Fidalgo
Paulo Fidalgo

Reputation: 22296

Check if you have IPv6 disabled or in your environment settings make sure you add this to your java options:

-Djava.net.preferIPv4Stack=true

For the first one you should set this parameters on your /etc/sysctl.conf file:

#disable ipv6  
net.ipv6.conf.all.disable_ipv6 = 1  
net.ipv6.conf.default.disable_ipv6 = 1   
net.ipv6.conf.lo.disable_ipv6 = 1  

After a reboot check if it's disabled with:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

For the second one you can add this in you hadoop-env.sh

export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true

or in your .bashrc file:

alias java="java -Djava.net.preferIPv4Stack=true"

Upvotes: 1

suiterdev
suiterdev

Reputation: 691

Well, with no error output to guide us, it could be several things.

It's been a while since I set up a Hive2 Server, but, you may want to define the IP address(or host) in the hive-site.xml using the hive.server2.thrift.bind.host property.

If you set the property above to 'localhost' you'll need to make certain the /etc/hosts file is set to resolve you properly, and if it's on another machine and you use the name, same thing. I would recommend testing with an IP address, and then move to name.

The comment requesting more information is a good one though, there is not much to go on here. What version of Hive2 are you using? What Hadoop distro? There will be differences affecting your solution depending on the answers.

Upvotes: 1

Related Questions