当我把hadoop、hbase安装配置(具体参考这里)好了之后,启动hbase的shell交互模式,输入命令却出现了下面这样的错误:
ERROR: org.apache.hadoop.hbase.MasterNotRunningException: Retried 7 times
这是为什么呢,Master为什么没有启动起来呢?
查看logs目录下的Master日志,发现有以下信息:
2012-02-01 14:41:52,867 FATAL org.apache.hadoop.hbase.master.HMaster: Unhandled exception. Starting shutdown.
org.apache.hadoop.ipc.RPC$VersionMismatch: Protocol org.apache.hadoop.hdfs.protocol.ClientProtocol version mismatch. (client = 42, server = 41)
at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:364)
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:363)
at org.apache.hadoop.hbase.master.MasterFileSystem.<init>(MasterFileSystem.java:81)
at org.apache.hadoop.hbase.master.HMaster.finishInitialization(HMaster.java:342)
at org.apache.hadoop.hbase.master.HMaster.run(HMaster.java:279)
2012-02-01 14:41:52,870 INFO org.apache.hadoop.hbase.master.HMaster: Aborting
2012-02-01 14:41:52,870 DEBUG org.apache.hadoop.hbase.master.HMaster: Stopping service threads
很明显,日志中说RPC协议不一致所造成的,恍然见明白因为我在hbase的配置文件中将rootdir设置为hdfs,如果这两者的RPC协议不一致就会导致这个问题。
解决方法:
将hbase/lib目录下的hadoop-core的jar文件删除,将hadoop目录下的hadoop-0.20.2-core.jar拷贝到hbase/lib下面,然后重新启动hbase即可。