org.apache.hadoop.hbase.PleaseHoldException: Master is initializing

时间:2022-09-19 08:27:16

电脑换了重新装了下系统,在本机ubuntu 的环境下搭建hadoopCDH4.5 伪分布式。进入Hbase shell,在创建表的时候出现异常如下:

ERROR: org.apache.hadoop.hbase.PleaseHoldException: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
    at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:1710)
    at org.apache.hadoop.hbase.master.HMaster.createTable(HMaster.java:1234)
    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.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:320)
    at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1428)

Here is some help for this command:
Create table; pass table name, a dictionary of specifications per
column family, and optionally a dictionary of table configuration.
Dictionaries are described below in the GENERAL NOTES section.
Examples:

  hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
  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', 'f1', {SPLITS => ['10', '20', '30', '40']}
  hbase> create 't1', 'f1', {SPLITS_FILE => 'splits.txt'}
  hbase> # Optionally pre-split the table into NUMREGIONS, using
  hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
  hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}

最后发现/etc/hosts 文件下的ip不对

#127.0.0.1      localhost
127.0.1.1       hadoop

解决办法:

将/etc/hosts 中的127.0.1.1 修改为  127.0.0.1,关掉hbase 然后在关掉hadoop,在分别重新开启即可。

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

=> Hbase::Table - test
hbase(main):003:0> describe 'test'
DESCRIPTION                                                                                  ENABLED                                           
 {NAME => 'test', FAMILIES => [{NAME => 't1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER =>  true                                              
 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '                                                   
 0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY =>                                                    
 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}                                                                                    
1 row(s) in 0.0560 seconds

 

  

粗心引起的错误,浪费了时间。