【问题标题】:How to use Hive Metastore standalone?如何独立使用 Hive Metastore?
【发布时间】:2020-05-11 18:24:43
【问题描述】:

我在没有安装 Hive 的情况下独立安装并运行了 Metastore Server。但是,我找不到任何有关与服务器通信的节俭网络 API 的文档。我需要能够直接或通过 HCatalog 连接到 Metastore 服务器。请指教。

【问题讨论】:

    标签: hcatalog hive-metastore


    【解决方案1】:

    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 相同。

    【讨论】:

      【解决方案2】:

      【讨论】:

      • 一个免费的 sn-p 反正:stackoverflow.com/questions/33880050/…
      • 谢谢参孙。此时,我使用python中的thrift api来访问Metastore服务器。如果我有更多问题,我可能会再次提醒你。在此感谢您!
      猜你喜欢
      • 2021-01-20
      • 1970-01-01
      • 2017-10-19
      • 1970-01-01
      • 1970-01-01
      • 2022-09-28
      • 1970-01-01
      • 2018-09-23
      • 2014-08-27
      相关资源
      最近更新 更多