我有一个使用 hcatalog api 读取配置单元元数据的 java 应用程序。如果我需要使用 Kerberos 和 knox 从集群上的配置单元数据库中读取元数据,以下配置是否有效?
HiveConf hcatConf = new HiveConf();
hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, “thrift://server1.example.com:9083”);
hcatConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, “hive/_HOST@example.COM”);
hcatConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_KEYTAB_FILE, “local_path/hive.keytab”);
hcatConf.setVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, “true”);
HCatClient hcatClient = HCatClient.create(new Configuration(hcatConf));
我将从远程 Windows 机器上运行 Java 程序。
如果集群上我的 hive-site.xml 包含以下属性
< property>
<name>hive.metastore.uris</name>
<value>thrift://server1.example.com:9083</value>
</property>
<property>
<name>hive.metastore.sasl.enabled</name>
<value>true</value>
<description>If true, the metastore thrift interface will be secured with SASL. Clients must authenticate with Kerberos.</description>
< /property>
<property>
<name>hive.metastore.kerberos.keytab.file</name>
<value>/etc/hive/conf/hive.keytab</value>
<description>The path to the Kerberos Keytab file containing the metastore thrift server’s service principal.</description>
< /property>
<property>
<name>hive.metastore.kerberos.principal</name>
<value>hive/_HOST@example.COM</value>
<description>The service principal for the metastore thrift server. The special string _HOST will be replaced automatically with the correct host name.</description>
< /property>
如何配置 HCatClient 以连接到 hive?