forked from fayson/cdhproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增使用JDBC访问Kerberos和非Kerberos环境下Spark1.6 ThriftServer服务
- Loading branch information
peach
committed
Jun 1, 2018
1 parent
3b98182
commit 0c72701
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|