我是 hbase 的新手,并尝试使用以下命令在hortonworks沙箱hbase shell中创建一个表:
create 'testtable', 'colfam1'
这样做时,我不断收到此错误:
hbase(main):002:0> create 'testtable', 'colfam1'
ERROR: Can't get master address from ZooKeeper; znode data == null
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:
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', {NAME => 'f1', CONFIGURATION =>
{'hbase.hstore.blockingStoreFiles' => '10'}}
Table configuration options can be put at the end.
Examples:
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',
REGION_REPLICATION => 2, CONFIGURATION => REGION_REPLICATION => 2, 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.
我直接从HBase:The Definitive Guide中复制了这一行,为什么create
语句不起作用?这种语法有问题吗?
答案 0 :(得分:0)
您是在本地安装HBase还是在群集上安装HBase?如果它是前者,你是否使用start-hbase.sh脚本启动HBase。如果是后者,你必须启动HBase和Zookeeper。
答案 1 :(得分:0)
尝试在您的locahost上进入Ambari并登录。单击HBASE,然后在摘要下单击ActiveHbaseMaster。然后只需从左侧的列启动ActiveHbaseMaster和RegionServer / Hbase!这对我有用