首页 > 代码库 > 创建Hbase Hive外部表报错: Unable to determine ZooKeeper ensemble

创建Hbase Hive外部表报错: Unable to determine ZooKeeper ensemble

创建HBase的Hive外部表

  1: create external table ttt(rowkey string,info map<string,string>)STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler‘ WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:") TBLPROPERTIES ("hbase.table.name" = "lwg");

报错,提示无法获得Zookeeper集群地址

  1: hive> create external table ttt(rowkey string,info map<string,string>)STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler‘ WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:") TBLPROPERTIES ("hbase.table.name" = "lwg");
  2: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.io.IOException: Unable to determine ZooKeeper ensemble
  3:   at org.apache.hadoop.hbase.zookeeper.ZKUtil.connect(ZKUtil.java:120) #当连接Zookeeper时,抛异常无法获取zookeeper集群地址
  4:   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:165)
  5:   at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:134)
  6:   at org.apache.hadoop.hbase.catalog.CatalogTracker.<init>(CatalogTracker.java:176)
  7:   at org.apache.hadoop.hbase.catalog.CatalogTracker.<init>(CatalogTracker.java:150)
  8:   at org.apache.hadoop.hbase.catalog.CatalogTracker.<init>(CatalogTracker.java:132)
  9:   at org.apache.hadoop.hbase.client.HBaseAdmin.getCatalogTracker(HBaseAdmin.java:229)
 10:   at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:277)
 11:   at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:293)
 12:   at org.apache.hadoop.hive.hbase.HBaseStorageHandler.preCreateTable(HBaseStorageHandler.java:182)
 13:   at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:602)
 14:   at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:595)
 15:   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 16:   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 17:   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 18:   at java.lang.reflect.Method.invoke(Method.java:606)
 19:   at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:90)
 20:   at com.sun.proxy.$Proxy9.createTable(Unknown Source)
 21:   at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:670)
 22:   at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3959)
 23:   at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:295)
 24:   at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
 25:   at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
 26:   at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604)
 27:   at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364)
 28:   at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177)
 29:   at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
 30:   at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
 31:   at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:247)
 32:   at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:199)
 33:   at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:410)
 34:   at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:783)
 35:   at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
 36:   at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
 37:   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 38:   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 39:   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 40:   at java.lang.reflect.Method.invoke(Method.java:606)
 41:   at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

在Hive命令行环境下,指定Zookeeper配置,能够正常访问Zookeeper、HBase

  1: set hbase.zookeeper.quorum=zk1,zk2,zk3,zk4,zk5
  2: set zookeeper.znode.parent=/hbase # hbase在zookeeper上root node

将这两个参数加入到~/.hiverc,这样hive在启动的时候,会自动加载给配置

创建Hbase Hive外部表报错: Unable to determine ZooKeeper ensemble