前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住给大家分享一下。点击跳转到网站:https://www.captainai.net/dongkelun
前言
总结Java如何连接Kerberos认证下的Spark Thrift Server/Hive Server总结
启动
关于如何启动 Spark Thrift Server和 Hive Server 请参考https://dongkelun.com/2021/02/19/javaSparkThriftServer/
Java 代码
pom 依赖
1 | <dependencies> |
关于依赖版本对应同样请参考https://dongkelun.com/2021/02/19/javaSparkThriftServer/
配置文件
hive.service.keytab和krb5.conf均为kerberos认证相关,从服务器上下载,krb5.conf路径在/etc下,具体根据自己服务器的配置去查找
krb5.conf1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25[libdefaults]
renew_lifetime = 7d
forwardable = true
default_realm = INDATA.COM
ticket_lifetime = 24h
dns_lookup_realm = false
dns_lookup_kdc = false
default_ccache_name = /tmp/krb5cc_%{uid}
#default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
#default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
[domain_realm]
indata.com = INDATA.COM
[logging]
default = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
kdc = FILE:/var/log/krb5kdc.log
[realms]
INDATA.COM = {
admin_server = indata-192.168.44.128.indata.com:17490
kdc = indata-192.168.44.128.indata.com
kdc = indata-192.168.44.129.indata.com
}
代码
1 | package com.dkl.blog; |
代码已上传到 github