【发布时间】:2020-05-11 18:24:43
【问题描述】:
我在没有安装 Hive 的情况下独立安装并运行了 Metastore Server。但是,我找不到任何有关与服务器通信的节俭网络 API 的文档。我需要能够直接或通过 HCatalog 连接到 Metastore 服务器。请指教。
【问题讨论】:
我在没有安装 Hive 的情况下独立安装并运行了 Metastore Server。但是,我找不到任何有关与服务器通信的节俭网络 API 的文档。我需要能够直接或通过 HCatalog 连接到 Metastore 服务器。请指教。
【问题讨论】:
hive-webhcat-java-client中有一个HCatalog Java客户端,可以在client mode(连接hcatalog thrift服务器)和embed mode(内部做所有事情,直接连接mysql)中使用。
HiveConf hiveConf = new HiveConf();
hiveConf.addResource("/Users/tzp/Documents/env/apache-hive-3.1.2-bin/conf/hive-site.xml");
//if you set this param, the client try to connect external hive metastore
hiveConf.set("metastore.thrift.uris", "thrift://localhost:9083");
HCatClient client = HCatClient.create(new Configuration(hiveConf));
List<String> dbNames = client.listDatabaseNamesByPattern("*");
System.out.println(dbNames);
我认为 Hive 在 Python 中没有提供类似的客户端,但是有一个第三方库 hmsclient,做同样的事情。
from hmsclient import hmsclient
client = hmsclient.HMSClient(host='localhost', port=9083)
with client as c:
c.check_for_named_partition('db', 'table', 'date=20180101')
HCatalog 在功能上与 Hive Metastore 相同。
【讨论】:
“Hive Metastore 客户端”的 JavaDoc 及其 API(分支 1.x)可在
现在,祝你找到教程或编写 sn-ps...
【讨论】: