1、出现版本不一致错误
如果启动时出现版本不一致的错误,如下所示:2012-01-06 21:27:18,384 FATAL org.apache.Hadoop.hbase.master.HMaster: Unhandled exception. Starting shutdown. org.apache.hadoop.ipc.RemoteException: Server IPC version 5 cannot communicate with client version 3 at org.apache.hadoop.ipc.Client.call(Client.java:740) at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:220) at $Proxy5.getProtocolVersion(Unknown Source) at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:359) at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:113) at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:215) at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:177) at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:82) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1378) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1390) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:196) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:175) at org.apache.hadoop.hbase.util.FSUtils.getRootDir(FSUtils.java:364) at org.apache.hadoop.hbase.master.MasterFileSystem.<init>(MasterFileSystem.java:81) at org.apache.hadoop.hbase.master.HMaster.finishInitialization(HMaster.java:346) at org.apache.hadoop.hbase.master.HMaster.run(HMaster.java:282) 2012-01-02 21:27:18,384 INFO org.apache.hadoop.hbase.master.HMaster: Aborting
这就是说明Hadoop和HBase版本不匹配,仔细阅读文档,你会在发现,解释如下所示:Because HBase depends on Hadoop, it bundles an instance of the Hadoop jar under its lib directory. The bundled jar is ONLY for use in standalone mode. In distributed mode, it is critical that the version of Hadoop that is out on your cluster match what is under HBase. Replace the hadoop jar found in the HBase lib directory with the hadoop jar you are running on your cluster to avoid version mismatch issues. Make sure you replace the jar in HBase everywhere on your cluster. Hadoop version mismatch issues have various manifestations but often all looks like its hung up.
将HBase解压缩包中lib的Hadoop Core jar文件替换为当前你所使用的Hadoop版本即可。
2、HBase集群启动以后,执行相关操作时抛出异常
如果HBase集群正常启动,但是在想要创建一个table的时候,出现如下异常,如下所示:ERROR: org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException: org.apache.hadoop.hbase.NotAllMetaRegionsOnlineException: Timed out (10000ms) at org.apache.hadoop.hbase.catalog.CatalogTracker.waitForMeta(CatalogTracker.java:334) at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:769) at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:743) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:570) at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039)
解决方法就是,修改/etc/hosts文件,修改内容以master为例,如下所示:
#127.0.0.1 localhost 192.168.0.180 master 192.168.0.191 slave-01 192.168.0.190 slave-02 192.168.0.189 slave-03 # The following lines are desirable for IPv6 capable hosts #::1 ip6-localhost ip6-loopback #fe00::0 ip6-localnet #ff00::0 ip6-mcastprefix #ff02::1 ip6-allnodes #ff02::2 ip6-allrouters