Advertisement
Guest User

Untitled

a guest
Mar 6th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. public Connection getHiveConnection() {
  2. Connection con = null;
  3. try {
  4.  
  5. Configuration configuration = new Configuration();
  6. configuration.set("fs.defaultFS", "hdfs://100.100.1100.310:8020");
  7. configuration.set("hadoop.security.authentication", "kerberos");
  8. configuration.set("java.security.krb5.conf","/etc/krb5.conf");
  9. configuration.set("dfs.namenode.kerberos.principal", "nn/_HOST@company.LOCAL");
  10. UserGroupInformation.setConfiguration(configuration);
  11. UserGroupInformation.loginUserFromKeytab("some@company.LOCAL", "/etc/security/keytabs/some.keytab");
  12.  
  13. con = DriverManager.getConnection("jdbc:hive2://100.100.1100.320:10000/db;principal=hive/someNode@company.LOCAL", "hive", "123");
  14.  
  15.  
  16. } catch (Exception se) {
  17. se.printStackTrace();
  18. }
  19. return con;
  20.  
  21. }
  22.  
  23. 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
  24. at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:215)
  25. at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:163)
  26. at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
  27. at java.sql.DriverManager.getConnection(DriverManager.java:664)
  28. at java.sql.DriverManager.getConnection(DriverManager.java:247)
  29. at com.sstech.storage.mapreduce.HiveDAO.getHiveConnection(HiveDAO.java:67)
  30. at com.sstech.storage.mapreduce.StorageReducer.setup(StorageReducer.java:100)
  31. at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:168)
  32. at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:627)
  33. at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
  34. at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
  35. at java.security.AccessController.doPrivileged(Native Method)
  36. at javax.security.auth.Subject.doAs(Subject.java:422)
  37. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1724)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement