0
votes

I am running an hdfs instance in pseudo-distributed mode, and tried to make another hbase instance connected to it on the same server. Logs in hadoop are fine, but I constantly got the connection failure in hbase' log

==================================================================================

2012-05-01 10:49:07,212 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
2012-05-01 10:49:07,213 WARN org.apache.zookeeper.ClientCnxn: Session 0x13708dc552d0001 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)

2012-05-01 10:49:08,882 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
2012-05-01 10:49:08,882 WARN org.apache.zookeeper.ClientCnxn: Session 0x13708dc552d0001 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)

==================================================================================

Configuration of core-site.xml@hadoop

<configuration>

<property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
</property>

</configuration>

Configuration of hbase-site.xml@hbase

<configuration>
<property>
   <name>hbase.rootdir</name>
   <value>hdfs://localhost:9000/hbase</value>
</property>
<property>
   <name>dfs.replication</name>
   <value>1</value>
</property>
</configuration>

I also tried to replace localhost with the actual ip of the server, but got the same error.

4
Looks like a problem with ZooKeeper.Donald Miner

4 Answers

1
votes
  • First, you need to make sure your hbase master node is running, you can use jps to check.

If it is not running, you can run it by start-hbase.sh command or hbase master start. And then check its status by other commands, like netstat -an | grep 9000

  • Second, if the previous method does not work, check your firewall configuration such as iptables and SELinux. Use sudo iptables -L to check your iptables configuration. You can disable the iptables by sudo service iptables stop command under redhat based linux systems.

Use getenforce to check if SElinux is in enforcing mode.

  • Third, check the system configuration, for example, ssh etc.
1
votes

You need to replace the core hadoop jar in the $HBASE_HOME/bin/lib/hadoop-{{version}}core.jar with the one in the $HADOOP_HOME/hadoop-{{version}}core.jar I was running into the same problem when I tried to install hbase 0.92 from hbase 0.90-xxx which was working fine, i replaced the hbase-env.sh and hbase-site.xml from the old hbase to the new but forgot to copy the hadoop core jar.

1
votes

I'm always suspicious when I see localhost in a config. Also when you use localhost, then it becomes very difficult (to impossible) to access any services from the psuedo distributed system from a host other than the one you are running on.

You did say you tried the IP address, but you might want to make sure its the IP address that the node really thinks its at.

Check the zookeeper logs from when it starts up and see what IP address it "thinks" its at. There should be a line like:

2012-01-31 09:32:46,083 - INFO  [main:Environment@97] - Server environment:host.name=ip-10-8-127-58.ec2.internal

Then use the value of host.name as the value for all places in ALL Hadodop, HBase, Hive, Zookeeper, etc config files that need a hostname (assuming they are all on the same machine as you said you are in psuedo-distributed mode)

Also you did not show your hbase.zookeeper.quorum setting in hbase-site.xml. That is where hbase gets its knowledge of the zookeeper's address

  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>ip-10-8-127-58.ec2.internal</value>
  </property>
0
votes

I think Hbase cannot find the zookeeper quorum, you have to set the hbase.zookeeper.quorum property in hbase-site.xml. Also check if classpath is set properly or not, check this doc out http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/mapreduce/package-summary.html#classpath