【问题标题】:Connection Refused - Why does zookeeper tries to connect to localhost instead of a server ipConnection Refused - 为什么 zookeeper 尝试连接到 localhost 而不是服务器 ip
【发布时间】:2013-08-24 20:46:30
【问题描述】:

我的 Reduce 任务失败,因为所有 namenode 都无法尝试连接到 localhost 而不是 10.10.187.170 ..

我的应用程序甚至尝试在代码中手动连接..

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");

我的 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>

错误:

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)

【问题讨论】:

  • 请尝试使用 ip-10-10-187-170.eu-west-1.compute.internal 代替 conf 对象中的 IP 地址。
  • @JtheRocker 试过了。不起作用.. namenodes 只是记录此错误消息,而不是记录对我调试有用的内容..
  • 你能展示你如何使用Configuration conf = HBaseConfiguration.create();吗?您是否使用conf 创建工作?

标签: hadoop hbase cloudera apache-zookeeper


【解决方案1】:

我终于知道为什么它连接到本地主机了。

我有多个配置对象来与 HBase 中的 2 个或多个表进行交互。仅对于 conf 对象之一,我正在设置 zookeeper 仲裁地址。没有为其他对象设置它。

通过为所有对象设置 zookeeper 仲裁地址就可以了。

编辑:只使用一个 conf 对象是更可取的(映射器或减速器)。并像使用它一样

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

上面的代码比拥有多个对象更容易理解,这减少了 HBase 访问时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-10
    • 1970-01-01
    • 2016-09-22
    • 2019-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多