无法以伪分布式模式启动 HBase 抛出 "Failed construction RegionServer"

Fail to start HBase in Pseudo-Distributed mode throws "Failed construction RegionServer"

我正在尝试 运行 HBase 伪分布在 ubuntu 的 docker 映像中。

启动后-hbase.sh,HMaster和RegionServer没有正常运行。

RegionServer和Master日志均显示:

ERROR [main] regionserver.HRegionServer: Failed construction RegionServer
java.io.IOException: Couldn't create proxy provider class org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
        at org.apache.hadoop.hdfs.NameNodeProxiesClient.createFailoverProxyProvider(NameNodeProxiesClient.java:261)
        at org.apache.hadoop.hdfs.NameNodeProxiesClient.createFailoverProxyProvider(NameNodeProxiesClient.java:224)
        at org.apache.hadoop.hdfs.NameNodeProxiesClient.createProxyWithClientProtocol(NameNodeProxiesClient.java:134)
        at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:374)
        at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:308)
        at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:184)
        at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3414)
        at org.apache.hadoop.fs.FileSystem.access0(FileSystem.java:158)
        at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3474)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3442)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:524)
        at org.apache.hadoop.hbase.fs.HFileSystem.<init>(HFileSystem.java:91)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.initializeFileSystem(HRegionServer.java:763)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:653)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.constructRegionServer(HRegionServer.java:3155)
        at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.start(HRegionServerCommandLine.java:63)
        at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.run(HRegionServerCommandLine.java:87)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.main(HRegionServer.java:3173)

jps 显示:

31168 HQuorumPeer
14801 NodeManager
2049 Jps
12435 SecondaryNameNode
12105 NameNode
14699 ResourceManager
14141 DataNode

核心-site.xml 是:

<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/bigdata/hadoop/tmp</value>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

hdfs-site.xml显示:

<configuration>
   <property>
<name>dfs.replication</name>
<value>1</value>
</property>

<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/namenode</value>
</property>

<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/datanode</value>
</property>

<property>
<name>dfs.namenode.http-address</name>
<value>localhost:50070</value>
</property>
<configuration>

    <property>
        <name>dfs.client.failover.proxy.provider.hdfscluster</name>
        <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
    </property>
</configuration>
</configuration>

这两个配置文件都是从 hadoop/etc/hadoop/ 软链接的 我不知道如何根据日志解决此问题。感谢您的帮助!


更新: 修复 hdfs-site.xml 中 majid 指出的语法错误后。

"ERROR [main] regionserver.HRegionServer: Failed construction RegionServer
java.lang.IllegalArgumentException: java.net.UnknownHostException: hdfs
        at org.apache.hadoop.security.SecurityUtil.buildTokenService(SecurityUtil.java:448)
        at org.apache.hadoop.hdfs.NameNodeProxiesClient.createProxyWithClientProtocol(NameNodeProxiesClient.java:139)" 

您的 hdfs-site.xml 格式不正确。 应该是:

<configuration>
 <property>
    <name>dfs.nameservices</name>
    <value>hdfscluster</value>
 </property>

<property>
  <name>dfs.replication</name>
  <value>1</value>
</property>

<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/namenode</value>
</property>

<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/datanode</value>
</property>

<property>
<name>dfs.namenode.http-address</name>
<value>localhost:50070</value>
</property>
<property>
  <name>dfs.client.failover.proxy.provider.hdfscluster</name>
  <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
</configuration>

或者删除dfs.client.failover.proxy.provider.hdfscluster 属性和hdfs-site.xml应该是

<configuration>
   <property>
<name>dfs.replication</name>
<value>1</value>
</property>

<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/namenode</value>
</property>

<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/yarn_data/hdfs/datanode</value>
</property>

<property>
<name>dfs.namenode.http-address</name>
<value>localhost:50070</value>
</property>
</configuration>

确保在启动 HBase 之前格式化 namenode。