hadoop hdfs 重新启动或者重新格式话,可能会出现一些数据丢失,报错hbase的。
我的是试验环境,所以需要重新清理这些数据。
首先要重新创建hbase在hdfs里面的文件夹:
并把赋予拥有者权限
$ sudo -u hdfs hadoop fs -mkdir /hbase $ sudo -u hdfs hadoop fs -chown hbase /hbase
清理hbase在zookeeper中的缓存数据,缓存的目录在hbase-site.xml中有。
hbase启动出现错误:
2016-05-11 10:01:23,124 ERROR org.apache.hadoop.hbase.master.HMasterCommandLine: Master exiting
java.lang.RuntimeException: HMaster Aborted
2016-05-11 10:01:23,007 INFO org.apache.hadoop.hbase.master.HMaster: Aborting 2016-05-11 10:01:23,007 DEBUG org.apache.hadoop.hbase.master.HMaster: Stopping service threads 2016-05-11 10:01:23,007 INFO org.apache.hadoop.ipc.HBaseServer: Stopping server on 60000 2016-05-11 10:01:23,007 INFO org.apache.hadoop.ipc.HBaseServer: REPL IPC Server handler 2 on 60000: exiting 2016-05-11 10:01:23,007 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 0 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: REPL IPC Server handler 0 on 60000: exiting 2016-05-11 10:01:23,007 INFO org.apache.hadoop.ipc.HBaseServer: REPL IPC Server handler 1 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 5 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.hbase.master.HMaster: Stopping infoServer 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 6 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: Stopping IPC Server listener on 60000 2016-05-11 10:01:23,009 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 8 on 60000: exiting 2016-05-11 10:01:23,009 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 7 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: Stopping IPC Server Responder 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 3 on 60000: exiting 2016-05-11 10:01:23,008 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 2 on 60000: exiting 2016-05-11 10:01:23,011 INFO org.apache.hadoop.ipc.HBaseServer: Stopping IPC Server Responder 2016-05-11 10:01:23,011 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 1 on 60000: exiting 2016-05-11 10:01:23,009 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 4 on 60000: exiting 2016-05-11 10:01:23,009 INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handler 9 on 60000: exiting 2016-05-11 10:01:23,013 INFO org.mortbay.log: Stopped [email protected]:60010 2016-05-11 10:01:23,124 INFO org.apache.zookeeper.ZooKeeper: Session: 0x3547fc1b0e5000b closed 2016-05-11 10:01:23,124 INFO org.apache.hadoop.hbase.master.HMaster: HMaster main thread exiting 2016-05-11 10:01:23,124 INFO org.apache.zookeeper.ClientCnxn: EventThread shut down 2016-05-11 10:01:23,124 ERROR org.apache.hadoop.hbase.master.HMasterCommandLine: Master exiting java.lang.RuntimeException: HMaster Aborted at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:160) at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:104) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:76) at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2124)
解决方法:http://stackoverflow.com/questions/28563167/hbase-master-not-starting-correctly
Step 1:stop Hbase.
Step 2:运行
hbase org.apache.hadoop.hbase.util.hbck.OfflineMetaRepair
//修复metadata
Step 3:运行zookeeper,这里会丢失旧的数据。
zkCli.sh
ls /
rmr
/hbase
Step 4:重启hbase
执行
[[email protected] bin]# sh zkCli.sh Connecting to localhost:2181 ... Welcome to ZooKeeper! ... [zk: localhost:2181(CONNECTED) 0] ls / [hbase, zookeeper] [zk: localhost:2181(CONNECTED) 1] rmr hbase Command failed: java.lang.IllegalArgumentException: Path must start with / character [zk: localhost:2181(CONNECTED) 2] rmr /hbase [zk: localhost:2181(CONNECTED) 3] ls / [zookeeper] [zk: localhost:2181(CONNECTED) 4]
时间: 2024-10-20 16:17:36