[Presto] Connect hive by kerberos

For data security, hadoop cluster usually implement different security mechanisms, most commonly used mechanism is kerberos. Recently I tested how to connect hive by kerberos in presto.

1.Add krb5.conf/keytab/hdfs-site.xml/core-site.xml in every node.

2.Modify etc/jvm.properties, append -Djava.security.krb5.conf=”krb5.conf location”

3.Create hive.properties under etc/catalog

cat << 'EOF' > etc/catalog/hive.properties
connector.name=hive-hadoop2

hive.metastore.uri=thrift://xxx:9083
hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=xxx@xxx.com
hive.metastore.client.principal=xxx@xxx.com
hive.metastore.client.keytab="keytab location"

hive.config.resources="core-site.xml and hdfs-site.xml" location
EOF

4.Download hadoop-lzo jar into plugin/hive-hadoop2

wget http://maven.twttr.com/com/hadoop/gplcompression/hadoop-lzo/0.4.16/hadoop-lzo-0.4.16.jar -O plugin/hive-hadoop2

5.Get principal tgt

export KRB5_CONFIG="krb5.conf location"
kinit -kt "keytab location" xxx@xxx.com

6.Restart presto

bin/launcher restart