【问题标题】:Connection refused in Hbase Shell while Connecting HBase to HDFS将 HBase 连接到 HDFS 时,Hbase Shell 中的连接被拒绝
【发布时间】:2015-03-17 20:49:24
【问题描述】:

我正在尝试将我的 HBase 连接到 HDFS。我的 hdfs namenode(bin/hdfs namenode) 和 datnode(/bin/hdfs datanode) 正在运行。我还可以启动我的 Hbase (sudo ./bin/start-hbase.sh) 和本地区域服务器 (sudo ./bin/local-regionservers.sh start 1 2)。但是当我尝试从 Hbase shell 执行命令时,会出现以下错误:

cis655stu@cis655stu-VirtualBox:/teaching/14f-cis655/proj-dtracing/hbase/hbase-0.99.0-SNAPSHOT$ ./bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.99.0-SNAPSHOT, rUnknown, Sat Aug  9 08:59:57 EDT 2014

hbase(main):001:0> list
TABLE                                                                                                    
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/teaching/14f-cis655/proj-dtracing/hbase/hbase-0.99.0-SNAPSHOT/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/teaching/14f-cis655/proj-dtracing/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
2015-01-19 13:33:07,179 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

ERROR: Connection refused

Here is some help for this command:
List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:

  hbase> list
  hbase> list 'abc.*'
  hbase> list 'ns:abc.*'
  hbase> list 'ns:.*'

以下是我的 HBase 和 Hadoop 配置文件:

HBase-site.xml

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

    <!--for psuedo-distributed execution-->
    <property>
      <name>hbase.cluster.distributed</name>
      <value>true</value>
    </property>
    <property>
      <name>hbase.master.wait.on.regionservers.mintostart</name>
      <value>1</value>
    </property>
      <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/teaching/14f-cis655/tmp/zk-deploy</value>
      </property>

    <!--for enabling collection of traces
    -->
    <property>
      <name>hbase.trace.spanreceiver.classes</name>
      <value>org.htrace.impl.LocalFileSpanReceiver</value>
    </property>
    <property>
      <name>hbase.local-file-span-receiver.path</name>
      <value>/teaching/14f-cis655/tmp/server-htrace.out</value>
    </property>
    </configuration>

hdfs-site.xml

<configuration>
<property>
   <name>dfs.replication</name>
   <value>1</value>
 </property>
 <property>
   <name>dfs.namenode.name.dir</name>
   <value>file:/teaching/14f-cis655/proj-dtracing/hadoop-2.6.0/yarn/yarn_data/hdfs/namenode</value>
 </property>
 <property>
   <name>dfs.datanode.data.dir</name>
   <value>file:/teaching/14f-cis655/proj-dtracing/hadoop-2.6.0/yarn/yarn_data/hdfs/datanode</value>
 </property>
 <property>
    <name>hadoop.trace.spanreceiver.classes</name>
    <value>org.htrace.impl.LocalFileSpanReceiver</value>
  </property>
  <property>
    <name>hadoop.local-file-span-receiver.path</name>
    <value>/teaching/14f-cis655/proj-dtracing/hadoop-2.6.0/logs/htrace.out</value>
  </property>
</configuration>

核心站点.xml

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

【问题讨论】:

  • 您解决了这个问题吗?如果是,请您分享解决方案。
  • 尝试删除zookeeper写入数据的目录。然后重启你的 HBase
  • 在我的例子中,目录是 /teaching/14f-cis655/tmp/zk-deploy

标签: hadoop hbase hdfs hadoop2 cloudera-cdh


【解决方案1】:

请检查你的 HDFS 是否可以从 shell 获得:

  $ hdfs dfs -ls /hbase

还要确保您在 hdfs-env.sh 文件中拥有所有环境变量:

HADOOP_CONF_LIB_NATIVE_DIR="/hadoop/lib/native"
HADOOP_OPTS="-Djava.library.path=/hadoop/lib"
HADOOP_HOME=/hadoop
YARN_HOME=/hadoop
HBASE_HOME=/hbase
HADOOP_HDFS_HOME=/hadoop
HBASE_MANAGES_ZK=true

您是否使用相同的操作系统用户运行 Hadoop 和 HBase?如果您使用单独的用户,请检查是否允许HBase用户访问HDFS。

确保您在 ${HBASE_HOME}/ 中拥有 hdfs-site.xmlcore-stie.xml(或符号链接)文件的副本conf 目录。

此外,YARN 不推荐使用 fs.default.name 选项(但它必须仍然有效),您必须考虑改用 fs.defaultFS

你使用 Zookeeper 吗?因为您指定了 hbase.zookeeper.property.dataDir 选项,但那里没有 hbase.zookeeper.quorum 和其他重要选项。请阅读http://hbase.apache.org/book.html#zookeeper了解更多信息。

请在 hdfs-site.xml 中添加下一个选项以使 HBase 正常工作(由您的系统用户替换用于运行 HBase 的 $HBASE_USER 变量):

<property>
  <name>hadoop.proxyuser.$HBASE_USER.groups</name>
  <value>*</value>
</property>
<property>
  <name>hadoop.proxyuser.$HBASE_USER.hosts</name>
  <value>*</value>
</property>
<property>
  <name>dfs.support.append</name>
  <value>true</value>
</property>

【讨论】:

  • 是的,所以问题是 zookeeper quorum 进程没有运行。在我删除删除 HBase 保存其临时数据的目录后,它已修复。现在可以正常使用了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-05-15
  • 2018-07-06
  • 2022-10-24
  • 1970-01-01
  • 2021-03-29
  • 2017-08-08
  • 2023-02-06
相关资源
最近更新 更多