0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Open Source TrinoからCloudera Iceberg REST Catalog + Ozone 環境への接続

Last updated at Posted at 2025-11-06

はじめに

本記事では、Open Source Trino から Iceberg REST Catalog + Ozone (S3互換ストレージ) に接続するための手順を解説します。
この構成により、オンプレミス環境でも外部ツールから安全かつ標準的なAPI経由でIcebergテーブルへアクセスできます。

この記事では以下をカバーします:

  1. Trinoサーバーのセットアップ
  2. Iceberg REST Catalog + OAuth2 認証設定
  3. Trinoクライアントの導入とクエリ実行例

Trinoサーバーのセットアップ

まずはTrinoサーバーをインストールします。
ここでは Trino 476 を使用します。

curl -O https://repo1.maven.org/maven2/io/trino/trino-server/476/trino-server-476.tar.gz
tar xzvf trino-server-476.tar.gz
cd trino-server-476

mkdir -p etc etc/catalog var/log

基本設定ファイルの作成

etc/config.properties:

coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
discovery-server.enabled=true
discovery.uri=http://localhost:8080

etc/node.properties:

node.environment=metalake
node.id=1
node.data-dir=/var/trino/data

etc/jvm.config:

-server
-Xmx4G
-XX:+UseG1GC

JDKのインストール

ここでは Temurin 24 JDK を使用します。

# Adoptiumリポジトリ追加(RHEL/CentOS/Fedoraの場合)
sudo rpm --import https://packages.adoptium.net/artifactory/api/gpg/key/public
sudo tee /etc/yum.repos.d/adoptium.repo >/dev/null <<'EOF'
[Adoptium]
name=Adoptium
baseurl=https://packages.adoptium.net/artifactory/rpm/rhel/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
EOF

# JDKインストール
sudo dnf install -y temurin-24-jdk

# バージョン確認
java -version

Iceberg Catalog設定

etc/catalog/iceberg.properties に以下を記述します。
これにより、Trino → Iceberg REST Catalog 経由でApache Ozone(S3互換)環境にアクセスできます。

##############################################
# Trino → Metalake REST Catalog connector
# Iceberg + Ozone (S3-compatible)
##############################################

connector.name=iceberg

# 1) REST Catalog利用
iceberg.catalog.type=REST
iceberg.rest-catalog.uri=https://<REST-Catalog-Server>/gateway/cdp-share-access/hms-api/icecli
iceberg.rest-catalog.oauth2.server-uri=https://<REST-Catalog-Server>/gateway/cdp-share-access/hms-api/icecli/v1/oauth/tokens

# 2) OAuth2認証設定
iceberg.rest-catalog.security=OAUTH2
iceberg.rest-catalog.oauth2.credential=<client_id:client_secret>
iceberg.rest-catalog.oauth2.scope=catalog

# 3) TrinoのS3クライアント利用を有効化
fs.native-s3.enabled=true

# 4) Ozone S3 Gatewayエンドポイント
s3.endpoint=https://<Ozong-S3-Gateway-Server>
s3.region=ap-northeast-1
s3.path-style-access=true

# 5) Ozone S3認証情報
s3.aws-access-key=<ACCESS_KEY>
s3.aws-secret-key=<SECRET_KEY>

# 6) SSL設定
# s3.ssl.enabled=true

iceberg.rest-catalog.view-endpoints-enabled=false

Trinoの起動

bin/launcher run

Trinoクライアントのインストール

curl -L -o trino https://repo1.maven.org/maven2/io/trino/trino-cli/476/trino-cli-476-executable.jar
chmod +x trino

クエリ実行デモ

Trino CLIから接続:

./trino --server http://localhost:8080 --catalog iceberg --schema default
trino:default> select * from ice_demo.test_tbl_ice;
 id |     name
----+---------------
  6 | Test by zzeng
  1 | Alice
  2 | Bob
  3 | Charlie
  4 | David
  5 | Eve
  7 | New record
(7 rows)
Query 20251029_224354_00005_xswyd, FINISHED, 1 node
Splits: 2 total, 2 done (100.00%)
4.45 [7 rows, 1.32KiB] [1 rows/s, 305B/s]

image.png

まとめ

本手順により、TrinoからIceberg REST Catalog + Ozone へのアクセスが可能になります。
REST Catalogを介することで、CDP以外のOSSエコシステム(Trino / Spark / Snowflakeなど)からも統一的にIcebergテーブルを参照できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?