解决HBase创建表报错:PleaseHoldException: Master is initializing

Hadoop 潘老师 2个月前 (04-30) 203 ℃ (0) 扫码查看

在HBase完全分布式环境下连上HBase服务器,发现list查看表没有问题,但是执行创建表时就报错如下:

hbase:001:0> create 'table2', 'cf1'

ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
    at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:2729)
    at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:1985)
    at org.apache.hadoop.hbase.master.MasterRpcServices.createTable(MasterRpcServices.java:705)
    at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java)
    at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:395)
    at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:133)
    at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:338)
    at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:318)

解决办法:
1)该种异常的可能原因是主节点和从节点之间的的时间同步出现了问题,我们可以参考如下文章先将主从节点的服务器时间进行同步(你可能会发现虽然主从服务器都用的network time但是还是会出现零点几秒的偏差):
NTP方式同步服务器时间,解决org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container

文章目录[隐藏] 一、存在的问题 二、解决步骤: 一、存在的问题 Hadoop在完全分布式下多个虚拟主机协同运 […]


同步完成之后,我们重启hadoop、ZooKeeper和hbase,再去试下是否能够创建表,如果成功,那就ok,如果还是不行,就继续往下看。

2)我这里发现同步之后还是有问题,于是查看了master主节点上的hadoop中logs下datanode节点日志:

cat hadoop-root-datanode-master.log | tail -200

发现报错如下:

java.net.ConnectException: Call From master1/192.168.32.101 to master1:9820 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:833)
    at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:757)
    at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1549)
    at org.apache.hadoop.ipc.Client.call(Client.java:1491)
    at org.apache.hadoop.ipc.Client.call(Client.java:1388)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:233)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:118)
    at com.sun.proxy.$Proxy16.sendHeartbeat(Unknown Source)
    at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB.sendHeartbeat(DatanodeProtocolClientSideTranslatorPB.java:168)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.sendHeartBeat(BPServiceActor.java:517)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.offerService(BPServiceActor.java:648)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:849)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:533)
    at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:700)
    at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:804)
    at org.apache.hadoop.ipc.Client$Connection.access$3800(Client.java:421)
    at org.apache.hadoop.ipc.Client.getConnection(Client.java:1606)
    at org.apache.hadoop.ipc.Client.call(Client.java:1435)
    ... 9 more

出现了服务器连接问题,我这里的解决办法是:

a)停掉hbase和hadoop,ZooKeeper不用停掉

b)从zookeeper中删除hbase元数据节点

deleteall /hbase

c)删除hadoop所有节点的hadoopdata目录,即core-site.xmlhadoop.tmp.dir配置的目录

d)重新格式化hdfs

hdfs namenode -format

e)重启hadoop,ZooKeeper已经为启动状态,最后启动hbase,再去操作创建表,发现就ok了


版权声明:本站所有文章,如无特殊说明,均为本站原创。全部下载资源版权归原作者所有。任何个人或组织,若未征得本站同意,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系潘老师进行处理。
喜欢 (3)
请潘老师喝杯Coffee吧!】
分享 (0)

您必须 微信登录 才能发表评论!