连接HBase到HDFS时,Hbase Shell中的连接被拒绝

ano*_*non 5 hadoop hbase hdfs hadoop2 cloudera-cdh

我正在尝试将我的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:.*'
Run Code Online (Sandbox Code Playgroud)

以下是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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

核心的site.xml

<configuration>
<property>
   <name>fs.default.name</name>
   <value>hdfs://localhost:9000</value>
</property>
</configuration>
Run Code Online (Sandbox Code Playgroud)

Vit*_*t D 3

请检查 HDFS 是否可以从 shell 中使用:

  $ hdfs dfs -ls /hbase
Run Code Online (Sandbox Code Playgroud)

还要确保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
Run Code Online (Sandbox Code Playgroud)

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

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

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

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

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

<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>
Run Code Online (Sandbox Code Playgroud)