Connection Refused - 為什麼 zookeeper 嘗試連接到 localhost 而不是服務器 ip (Connection Refused - Why does zookeeper tries to connect to localhost instead of a server ip)


問題描述

Connection Refused ‑ 為什麼 zookeeper 嘗試連接到 localhost 而不是服務器 ip (Connection Refused ‑ Why does zookeeper tries to connect to localhost instead of a server ip)

My Reduce Tasks fail because all the namenode fails trying to connect to localhost instead of 10.10.187.170 ..

My application even tries to connect manually in the code..

Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "10.10.187.170");
conf.set("hbase.zookeeper.property.clientPort","2181");
conf.set("hbase.master","10.10.187.170");

My hbase‑site.xml:

<?xml version="1.0" encoding="UTF‑8"?>

<!‑‑Autogenerated by Cloudera CM on 2013‑08‑14T06:27:30.291Z‑‑>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://ip‑10‑10‑187‑170.eu‑west‑1.compute.internal:8020/hbase</value>
</property>
<property>
<name>hbase.client.write.buffer</name>
<value>2097152</value>
</property>
<property>
<name>hbase.client.pause</name>
<value>1000</value>
</property>
<property>
<name>hbase.client.retries.number</name>
<value>10</value>
</property>
<property>
<name>hbase.client.scanner.caching</name>
<value>1</value>
</property>
<property>
<name>hbase.client.keyvalue.maxsize</name>
<value>10485760</value>
</property>
<property>
<name>hbase.rpc.timeout</name>
<value>60000</value>
</property>
<property>
<name>hbase.security.authentication</name>
<value>simple</value>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>60000</value>
</property>
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value>
</property>
<property>
<name>zookeeper.znode.rootserver</name>
<value>root‑region‑server</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>ip‑10‑10‑187‑170.eu‑west‑1.compute.internal</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>

Error:

2013‑08‑24 20:05:36,213 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
2013‑08‑24 20:05:36,213 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 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.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)

參考解法

方法 1:

I finally found out why it was connecting to the localhost.

I was having more than one configuration object to interact with 2 or more tables in HBase. Only for one of the conf object, i was setting the zookeeper quorum address. Didn't set it for the other objects.

By setting the zookeeper quorum address for all the objects did the trick.

Edit : Using only one conf object is more desirable(mapper or reducer). And by using it like 

public void setup(Configuration conf) {
    conf.set("hbase.zookeeper.quorum", "xxxxx");
}

The above code is easier to follow than having multiple objects which reduces HBase access time.

(by PavanPavan)

參考文件

  1. Connection Refused ‑ Why does zookeeper tries to connect to localhost instead of a server ip (CC BY‑SA 3.0/4.0)

#hadoop #hbase #apache-zookeeper #cloudera






相關問題

hadoop -libjars dan ClassNotFoundException (hadoop -libjars and ClassNotFoundException)

基於感興趣的日期範圍作為參數輸入限制在 Pig Latin 中加載日誌文件 (Restricting loading of log files in Pig Latin based on interested date range as parameter input)

選擇 MapReduce 設計模式 (Choosing a MapReduce Design Pattern)

Lỗi phân vùng tùy chỉnh (Custom Partitioner Error)

Connection Refused - 為什麼 zookeeper 嘗試連接到 localhost 而不是服務器 ip (Connection Refused - Why does zookeeper tries to connect to localhost instead of a server ip)

現有表的 Hive 分桶和分區 (Hive bucketing and partition for existing table)

如何在 R 中讀取 HDFS 中的文件而不會丟失列名和行名 (How to read files in HDFS in R without loosing column and row names)

CDH 網絡接口速度抑制 (CDH Network Interface Speed Suppress)

Apache Apex 是依賴 HDFS 還是有自己的文件系統? (Does Apache Apex rely on HDFS or does it have its own file system?)

java.io.IOException:作業失敗!使用 hadoop-0.19.1 在我的 osx 上運行示例應用程序時 (java.io.IOException: Job failed! when running a sample app on my osx with hadoop-0.19.1)

如何使用 PIG 腳本驗證列表 (How to validate a list using PIG script)

使用 spark-submit 為 Spark Job 設置 HBase 屬性 (set HBase properties for Spark Job using spark-submit)







留言討論