title: Connecting to HiveMetaStore on cluster with kerberos
body: <p>I have a java application which reads hive metadata using hcatalog apis. If I need to read metadata from a hive database on a cluster with Kerberos and knox, would the following configuration work?
  <code></p>
  
  <pre><code>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));
  </code></pre>
  
  <p></code>
  I will be running the Java program from a remote windows machine.</p>
  
  <p>If my hive-site.xml on the cluster contains the following properties</p>
  
  <pre><code>&lt; property&gt;
  &lt;name&gt;hive.metastore.uris&lt;/name&gt;
  &lt;value&gt;thrift://server1.example.com:9083&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;hive.metastore.sasl.enabled&lt;/name&gt;
  &lt;value&gt;true&lt;/value&gt;
  &lt;description&gt;If true, the metastore thrift interface will be secured with SASL. Clients must authenticate with Kerberos.&lt;/description&gt;
  &lt; /property&gt;
  &lt;property&gt;
  &lt;name&gt;hive.metastore.kerberos.keytab.file&lt;/name&gt;
  &lt;value&gt;/etc/hive/conf/hive.keytab&lt;/value&gt;
  &lt;description&gt;The path to the Kerberos Keytab file containing the metastore thrift server’s service principal.&lt;/description&gt;
  &lt; /property&gt;
  &lt;property&gt;
  &lt;name&gt;hive.metastore.kerberos.principal&lt;/name&gt;
  &lt;value&gt;hive/_HOST@example.COM&lt;/value&gt;
  &lt;description&gt;The service principal for the metastore thrift server. The special string _HOST will be replaced automatically with the correct host name.&lt;/description&gt;
  &lt; /property&gt;
  </code></pre>
  
  <p>how do I configure the HCatClient to connect to hive?</p>