ユーザ作成
### trinoユーザーを使用して、TrinoサーバーとCLIを起動します。
sudo useradd -m trino
ファイルの解凍と設定ディレクトリの作成:
cd /opt/trino-server-380
mkdir -p etc/catalog
vim etc/node.properties
# node.propertiesファイル内容
node.environment=production_env
node.id=node_001
node.data-dir=/var/trino/data
vim etc/jvm.config
-server
-Xmx1G
-XX:+UseG1GC
-XX:G1HeapRegionSize=64M
-XX:+ExplicitGCInvokesConcurrent
-XX:+ExitOnOutOfMemoryError
-Djava.security.krb5.conf=/etc/krb5.conf
-Dsun.security.krb5.debug=true
vim etc/log.properties
io.trino=DEBUG
vim etc/config.properties
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=9090
query.max-memory=200MB
discovery.uri=https://trino-master:7778
http-server.authentication.type=KERBEROS
http-server.authentication.krb5.service-name=trino_service
http-server.authentication.krb5.principal-hostname=trino-master
http-server.authentication.krb5.keytab=/etc/security/keytabs/trino_service.keytab
http-server.https.enabled=true
http-server.https.port=7778
http-server.https.keystore.path=/etc/security/certs/trino_keystore.jks
http-server.https.keystore.key=securepass
node.internal-address-source=FQDN
vim etc/catalog/system.properties
connector.name=system
Kerberos設定
kadmin.local -q "addprinc -randkey trino_service@LOCAL.COM"
kadmin.local -q "xst -k /etc/security/keytabs/trino_service.keytab trino_service@LOCAL.COM"
SSL/TLS HTTPS設定
Trinoはデフォルトで安全な接続を行いません。このため、TLSを有効にすることでHTTPS接続を強制する必要があります。
keytool -genkeypair -alias trino_ssl -keyalg RSA -keystore /etc/security/certs/trino_keystore.jks
サーバ起動
# kinit:
kinit -kt /etc/security/keytabs/trino_service.keytab trino_service@LOCAL.COM
# バックグラウンドで起動:
/opt/trino/bin/launcher start
# ログ確認(/var/trino/dataはデータディレクトリ):
tail -f /var/trino/data/var/log/server.log
CLI使用
chmod 755 trino-cli-380-executable.jar
./trino-cli-380-executable.jar --version
起動:
./trino-cli-380-executable.jar \
--server https://trino-master:7778 \
--krb5-config-path /etc/krb5.conf \
--krb5-principal trino_service@LOCAL.COM \
--krb5-keytab-path /etc/security/keytabs/trino_service.keytab \
--krb5-remote-service-name trino_service \
--keystore-path /etc/security/certs/trino_keystore.jks \
--keystore-password securepass \
--user trino_user@LOCAL.COM \
--catalog system
実行:
SHOW CATALOGS;
SHOW TABLES FROM system.runtime;
問題1:
クエリ失敗: アクセス拒否
解決:
--userパラメータを適切に設定する。