presto(trino)+kerberos+https

 

 

 创建用户

 
###使用trino用户,启动trino server和cli都用trion用户
useradd trino -g hadoop

 

解压、创建配置文件目录:

cd /data/software/trino-server-379
mkdir -p etc/catalog 

 

vim etc/node.properties

#node.properties文件内容
#环境名称
node.environment=production
#节点id,如果是集群,每台机器的id都必须唯一不一样
node.id=node001
#数据目录
node.data-dir=/data/presto

 

vim etc/jvm.config

 

-server
-Xmx500M
-XX:-UseBiasedLocking
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+ExplicitGCInvokesConcurrent
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:ReservedCodeCacheSize=128M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000


-Dsun.security.krb5.debug=true
-Dlog.enable-console=true
-Djava.security.krb5.conf=/etc/krb5.conf

 

 

vim etc/log.properties


io.trino=INFO

 

vim etc/config.properties

coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=100MB
query.max-memory-per-node=100MB
#discovery.uri=https://hadoop01:7778
discovery.uri=http://hadoop01:8080

http-server.authentication.type=KERBEROS

http-server.authentication.krb5.service-name=trino
http-server.authentication.krb5.principal-hostname=hadoop01
http-server.authentication.krb5.keytab=/etc/security/keytab/trino.service.keytab
http.authentication.krb5.config=/etc/krb5.conf

http-server.https.enabled=true
http-server.https.port=7778

http-server.https.keystore.path=/etc/security/keytab/presto/keystore
http-server.https.keystore.key=password
#Kerberos 通常对 DNS 名称敏感。 将此属性设置为使用 FQDN 可确保正确操作和使用有效的 DNS 主机名。
node.internal-address-source=FQDN


internal-communication.shared-secret=u51elfxYF8yEQA3Vu9visEHsDpg5nDMRTCBVjdD+jp/5HLKIT7rMxU7Np6ueT7U97UgosEpJz8Yq
#internal-communication.https.required=true

 

vim etc/catalog/jmx.properties

connector.name=jmx

 

 

配置kerberos

#coordinator(hadoop01)
kadmin -proot/admin -wpassword -q"addprinc -randkey trino@HADOOP.COM"
kadmin -proot/admin -wpassword -q"addprinc -randkey trino/hadoop01@HADOOP.COM"
kadmin -proot/admin -wpassword -q"xst -k /etc/security/keytab/trino.service.keytab trino@HADOOP.COM trino/hadoop01@HADOOP.COM"

 

配置SSL/TLS https

 Trino 默认运行没有安全性。 这允许您在使用 Trino CLI、Web UI 或其他客户端时使用指定 HTTP 协议的 URL 连接到服务器。

本主题描述如何配置您的 Trino 服务器以使用 TLS 以要求客户端使用 HTTPS 连接协议。 Trino 支持的所有身份验证技术都需要将 TLS 配置为基础层。

 

#生成 keystore:
keytool -genkeypair -alias presto.com -keyalg RSA -keystore /etc/security/keytab/presto/keystore

 

 启动Server

1  #kinit:
2  kinit -kt /etc/security/keytab/trino.service.keytab trino@HADOOP.COM
3  klist
4  #后台启动:
5  bin/launcher  start
6  #日志(/data/presto是配置的数据目录):
7  tail -300f /data/presto/var/log/

 

cli使用

chmod 777 trino-cli-379-executable.jar 
./trino-cli-379-executable.jar   --version

启动:

./trino-cli-379-executable.jar  \
--server https://hadoop01:7778  \
--krb5-config-path /etc/krb5.conf \
--krb5-principal trino/hadoop01@HADOOP.COM \
--krb5-keytab-path /etc/security/keytab/trino.service.keytab \
--krb5-remote-service-name trino \
--keystore-path /etc/security/keytab/presto/keystore \
--keystore-password password \
--user trino/hadoop01@HADOOP.COM
--catalog jmx
执行:
SHOW CATALOGS;
SHOW TABLES FROM jmx.current;

 

 

 

问题1:

Query 20220508_082241_00002_eipmw failed: Access Denied: User trino/hadoop01@HADOOP.COM cannot impersonate user trino

解决:

使用“--user”参数

 

posted @ 2022-05-08 16:10  mzjnumber1  阅读(1253)  评论(0编辑  收藏  举报