Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Connection getHiveConnection() {
- Connection con = null;
- try {
- Configuration configuration = new Configuration();
- configuration.set("fs.defaultFS", "hdfs://100.100.1100.310:8020");
- configuration.set("hadoop.security.authentication", "kerberos");
- configuration.set("java.security.krb5.conf","/etc/krb5.conf");
- configuration.set("dfs.namenode.kerberos.principal", "nn/_HOST@company.LOCAL");
- UserGroupInformation.setConfiguration(configuration);
- UserGroupInformation.loginUserFromKeytab("some@company.LOCAL", "/etc/security/keytabs/some.keytab");
- con = DriverManager.getConnection("jdbc:hive2://100.100.1100.320:10000/db;principal=hive/someNode@company.LOCAL", "hive", "123");
- } catch (Exception se) {
- se.printStackTrace();
- }
- return con;
- }
- java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://100.100.1100.320:10000/db;principal=hive/someNode@company.LOCAL: GSS initiate failed
- at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:215)
- at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:163)
- at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
- at java.sql.DriverManager.getConnection(DriverManager.java:664)
- at java.sql.DriverManager.getConnection(DriverManager.java:247)
- at com.sstech.storage.mapreduce.HiveDAO.getHiveConnection(HiveDAO.java:67)
- at com.sstech.storage.mapreduce.StorageReducer.setup(StorageReducer.java:100)
- at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:168)
- at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:627)
- at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
- at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
- at java.security.AccessController.doPrivileged(Native Method)
- at javax.security.auth.Subject.doAs(Subject.java:422)
- at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1724)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement