Hbase启动命令以及错误处理

前提:分布式集群,三个节点,Master,Slave1和Slave2节点,用的是自己安装的zookeeper-3.4.6,hbase版本为:hbase-0.98.6-hadoop2,hadoop-2.6.0.

1. 启动顺序 Hadoop -> Zookeeper -> Hbase

① 启动hadoop,在我的另一篇博客里有

http://blog.csdn.net/gou290966707/article/details/76546450

② 启动 Zookeeper 一定要记得在每个机器上的zookeeper路径下都执行

bin/zkServer.sh start

bin/zkServer.sh status 这个命令是查看状态


③ 在master节点上启动Hbase

bin/start-hbase


此时,在master节点上执行jps命令

[root@Master 桌面]# jps
4647 Jps
3931 HMaster
3196 DataNode
3599 JobHistoryServer
3069 NameNode
3434 NodeManager
3699 QuorumPeerMain
4216 Main

可以看出少了HRegionServer进程,

执行bin/hbase shell启动Hbase,然后执行,

hbase(main):004:0> create 'test','id'
报错如下:

ERROR: java.io.IOException: Table Namespace Manager not ready yet, try again later
	at org.apache.hadoop.hbase.master.HMaster.getNamespaceDescriptor(HMaster.java:3171)
	at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:1727)
	at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:1766)
	at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java:40470)
	at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2027)
	at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:108)
	at org.apache.hadoop.hbase.ipc.FifoRpcScheduler$1.run(FifoRpcScheduler.java:74)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

Here is some help for this command:
Creates a table. Pass a table name, and a set of column family
specifications (at least one), and, optionally, table configuration.
Column specification can be a simple string (name), or a dictionary
(dictionaries are described below in main help output), necessarily 
including NAME attribute. 
Examples:

Create a table with namespace=ns1 and table qualifier=t1
  hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => 5}

Create a table with namespace=default and table qualifier=t1
  hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
  hbase> # The above in shorthand would be the following:
  hbase> create 't1', 'f1', 'f2', 'f3'
  hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
  hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}}
  
Table configuration options can be put at the end.
Examples:

  hbase> create 'ns1:t1', 'f1', SPLITS => ['10', '20', '30', '40']
  hbase> create 't1', 'f1', SPLITS => ['10', '20', '30', '40']
  hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
  hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, METADATA => { 'mykey' => 'myvalue' }
  hbase> # Optionally pre-split the table into NUMREGIONS, using
  hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
  hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}
  hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}}

You can also keep around a reference to the created table:

  hbase> t1 = create 't1', 'f1'

Which gives you a reference to the table named 't1', on which you can then
call methods.

查看habse-root-master-Master.log日志信息如下:

master.AssignmentManager: Unable to determine a plan to assign {ENCODED => 1588230740, NAME => 'hbase:meta,,1', STARTKEY => '', ENDKEY => ''}
2017-08-15 16:20:17,784 DEBUG [master:Master:60000] master.ServerManager: Removing dead but not expired server: Master,60020,1502784623759 from eligible server pool.
2017-08-15 16:20:17,784 DEBUG [master:Master:60000] master.ServerManager: Removing dead but not expired server: Slave2,60020,1502784631895 from eligible server pool.
2017-08-15 16:20:17,784 DEBUG [master:Master:60000] master.ServerManager: Removing dead but not expired server: Slave1,60020,1502784631889 from eligible server pool.
2017-08-15 16:20:17,784 WARN  [master:Master:60000] master.AssignmentManager: Can't move 1588230740, there is no destination server available.

查看 habse-root-regionserver-Master.log日志信息如下:

2017-08-15 16:10:35,423 INFO  [regionserver60020] regionserver.HRegionServer: STOPPED: Failed initialization
2017-08-15 16:10:35,425 ERROR [regionserver60020] regionserver.HRegionServer: Failed init
java.lang.NoClassDefFoundError: org/htrace/Trace
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:214)
	at com.sun.proxy.$Proxy14.getFileInfo(Unknown Source)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:752)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
	at com.sun.proxy.$Proxy15.getFileInfo(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.hadoop.hbase.fs.HFileSystem$1.invoke(HFileSystem.java:294)
	at com.sun.proxy.$Proxy16.getFileInfo(Unknown Source)
	at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1988)
	at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1118)
	at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1114)
	at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
	at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
	at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:409)
	at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1400)
	at org.apache.hadoop.hbase.regionserver.HRegionServer.setupWALAndReplication(HRegionServer.java:1522)
	at org.apache.hadoop.hbase.regionserver.HRegionServer.handleReportForDutyResponse(HRegionServer.java:1286)
	at org.apache.hadoop.hbase.regionserver.HRegionServer.run(HRegionServer.java:862)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.htrace.Trace
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 27 more

这个错误信息就说明了htrace相关的jar包没有加载成功。

在安装Hbase时,因为Hbase安装路径下hbase-0.98.6-hadoop2/lib下的hadoop相关的jar包版本需要和你安装的hadoop版本相同。

解决方法:

  将$HADOOP_HOME/share/Hadoop/common/lib下的htrace-core-3.0.4.jar复制到$HBASE_HOME/lib下 。

关闭hbase,重新启动,在各个节点上执行jps命令:

[root@Master 桌面]# jps
3196 DataNode
3599 JobHistoryServer
3069 NameNode
3434 NodeManager
5151 HRegionServer
3699 QuorumPeerMain
6061 Jps
5014 HMaster
5475 Main
Slave1和Slave2节点多了,HRegionServer和QuorumPeerMain进程,则hbase启动成功。

在hbaseShell里执行命令,提示如下

hbase(main):002:0> create 'test','cf'
0 row(s) in 0.8570 seconds

=> Hbase::Table - test

温馨提示:出现问题了,一定要去看相关的日志信息,根据日志去分析是哪里出了问题。





你可能感兴趣的:(hbase)