...
Note: To connect using Kerberos, the 'authenticatedUser' argument to EndPoint.newConnection() should have been used to do a kerberos Kerberos login. Additionally the 'hive.metastore.kerberos.principal' setting should be set correctly either in hive-site.xml or in the 'conf' argument (if not null). If using hive-site.xml, it's its directory should be included in the classpath.
Code Block | ||
---|---|---|
| ||
import org.apache.hadoop.security.UserGroupInformation; HiveEndPoint hiveEP2 = ... ; UserGroupInformation ugi = .. authenticateWithKerberos(principal,keytab); StreamingConnection secureConn = hiveEP2.newConnection(true, null, ugi); DelimitedInputWriter writer3 = new DelimitedInputWriter(fieldNames, ",", hiveEP2); TransactionBatch txnBatch3= secureConn.fetchTransactionBatch(10, writer3); ///// Batch 1 - First TXN – over secure connection txnBatch3.beginNextTransaction(); txnBatch3.write("28,Eric Baldeschwieler".getBytes()); txnBatch3.write("29,Ari Zilka".getBytes()); txnBatch3.commit(); txnBatch3.close(); secureConn.close(); |