Skip to content

Commit

Permalink
新增使用JDBC访问Kerberos和非Kerberos环境下Spark1.6 ThriftServer服务
Browse files Browse the repository at this point in the history
  • Loading branch information
peach committed Jun 1, 2018
1 parent 3b98182 commit 0c72701
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jdbcdemo/src/main/java/com/cloudera/spark1jdbc/KBSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class KBSample {
public static void main(String[] args) throws Exception {
System.out.println("通过JDBC连接Kerberos环境下的Spark1.6 Thrift Server");
//登录Kerberos账号
System.setProperty("java.security.krb5.conf", "/Users/zoulihan/Documents/develop/kerberos/krb5.conf");
System.setProperty("java.security.krb5.conf", "/Users/fayson/Documents/develop/kerberos/krb5.conf");
Configuration configuration = new Configuration();
configuration.set("hadoop.security.authentication" , "Kerberos" );
UserGroupInformation. setConfiguration(configuration);
UserGroupInformation.loginUserFromKeytab("[email protected]", "/Users/zoulihan/Documents/develop/kerberos/fayson.keytab");
UserGroupInformation.loginUserFromKeytab("[email protected]", "/Users/fayson/Documents/develop/kerberos/fayson.keytab");
System.out.println(UserGroupInformation.getLoginUser());

Connection connection = null;
Expand Down

0 comments on commit 0c72701

Please sign in to comment.