Skip to content

Commit bf6c3e3

Browse files
committed
HDDS-12321. Add Trino integration user guide
Document Trino with Ozone via the Hive connector, Ranger Docker-style workflows, ozonefs-hadoop3 JAR install, catalog and access-control properties, and operational caveats. Link Trino from the homepage. Use ozone-filesystem-hadoop3 from the ozonefs-hadoop3 module (no ozonefs-hadoop3-client / proto.shaded.prefix). Clarify Hadoop XML and Ranger plugin requirements in-container. Made-with: Cursor
1 parent a73bf87 commit bf6c3e3

2 files changed

Lines changed: 195 additions & 5 deletions

File tree

Lines changed: 194 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,198 @@
11
---
2-
draft: true
2+
sidebar_label: Trino
33
---
44

5-
# Trino
5+
# Trino with Ozone (Hive connector) and Ranger
66

7-
**TODO:** File a subtask under [HDDS-9858](https://issues.apache.org/jira/browse/HDDS-9858) and complete this page or section.
8-
**TODO:** Uncomment link to this page in src/pages/index.js
7+
[Trino](https://trino.io/) can query tables whose data lives in Apache Ozone when you use the **Hive connector** and a **Hive Metastore (HMS)** that already understands Ozone paths (`ofs://`, `o3fs://`, or `s3a://`, depending on how tables were created). [Apache Ranger](https://ranger.apache.org/) can enforce access control for Trino through Trino’s Ranger integration.
8+
9+
This page describes a **Docker-based lab-style setup**: build the standard Ozone **Hadoop 3 filesystem** JAR (`ozonefs-hadoop3` / `ozone-filesystem-hadoop3-*.jar`), join Trino to the same Docker network as Ozone, Ranger, Hadoop, and Hive, then configure a Hive catalog and Ranger access control.
10+
11+
:::note
12+
This is an **advanced** integration. Names (`ranger-hive`, `rangernw`), compose file names, and paths come from typical Ranger `dev-support/ranger-docker` layouts and **will differ** if you change compose projects or image tags. Treat hostnames and file names as examples and align them with your environment.
13+
:::
14+
15+
For how Hive uses Ozone (warehouse paths, `ofs://` URIs, and the filesystem JAR), see the [Hive](./hive) integration page.
16+
17+
## Prerequisites
18+
19+
- Docker and Docker Compose, with enough memory for Ranger, Hive, Ozone, and Trino.
20+
- Source tree for **Apache Ozone** and a JDK / Maven build able to run `mvn package` for the **`ozonefs-hadoop3`** module (or a release download of `ozone-filesystem-hadoop3`).
21+
- A running **Hive Metastore** that Trino can reach on `thrift://<host>:9083`.
22+
- **Hadoop `core-site.xml`** (and related config) that defines the Ozone filesystem implementation and service addresses, mounted or copied into the Trino container where `hive.config.resources` points.
23+
- If you use Ranger: Trino **Ranger plugin** configuration files (`ranger-trino-security.xml`, `ranger-trino-audit.xml`, `ranger-policymgr-ssl.xml`, and policies synced from Ranger Admin). See the [Trino Ranger access control](https://trino.io/docs/current/security/ranger-access-control.html) documentation.
24+
25+
## Ozone JAR and Trino
26+
27+
Trino bundles its own Hadoop libraries. For the Hive connector to read and write `ofs://` / `o3fs://` paths, the **`ozone-filesystem-hadoop3-*.jar`** from the **`ozonefs-hadoop3`** Maven module must be on the Hive plugin classpath (see below).
28+
29+
The older **`ozonefs-hadoop3-client`** artifact and the **`proto.shaded.prefix`** Maven option are **no longer used** in current Ozone; build or download the standard **`ozonefs-hadoop3`** output only.
30+
31+
:::warning
32+
Pair **Ozone and Trino releases** that agree on a compatible Hadoop 3.x line. If Trino fails to load the Ozone filesystem or you see class or protobuf conflicts, align versions or ask on the Ozone dev list.
33+
:::
34+
35+
## 1. Build the Ozone filesystem JAR
36+
37+
From your Ozone source checkout, build the Hadoop 3 filesystem module (and its dependencies):
38+
39+
```bash
40+
mvn clean package -DskipTests -pl hadoop-ozone/ozonefs-hadoop3 -am
41+
```
42+
43+
When the build succeeds, copy the artifact from the module output directory:
44+
45+
```bash
46+
cd hadoop-ozone/ozonefs-hadoop3/target/
47+
cp ozone-filesystem-hadoop3-*.jar /tmp/
48+
```
49+
50+
The version in the file name (`*-SNAPSHOT.jar` or a release version) **depends on your Ozone branch**. You can also use the same artifact from Maven Central (coordinates `org.apache.ozone:ozone-filesystem-hadoop3`) at the version that matches your cluster instead of building from source.
51+
52+
:::note Historical note
53+
An older lab used [Ozone at commit fc89ba6a](https://github.com/apache/ozone/tree/fc89ba6aef9bd01562f76ef19888a56950bc6939); layout and Maven modules have changed since then. Prefer a **maintained release tag** that matches your cluster.
54+
:::
55+
56+
## 2. Bring up Ozone, Ranger, Hive, and Hadoop in Docker
57+
58+
### Option A: Ranger project compose stacks (recommended for a single lab network)
59+
60+
The Apache Ranger repo ships Docker Compose files under `dev-support/ranger-docker`.
61+
62+
1. Clone Ranger: [https://github.com/apache/ranger](https://github.com/apache/ranger).
63+
2. Open `dev-support/ranger-docker` and follow the **README** there (prerequisites, passwords, profiles).
64+
3. Build and start the stack that includes Ranger, Hadoop, Hive, and Ozone. The README and file names on `master` **change over time**; your commands may look like the following pattern (verify against the current README):
65+
66+
```bash
67+
docker compose \
68+
-f docker-compose.ranger.yml \
69+
-f docker-compose.ranger-hadoop.yml \
70+
-f docker-compose.ranger-hive.yml \
71+
-f docker-compose.ranger-ozone.yml \
72+
build
73+
74+
docker compose \
75+
-f docker-compose.ranger.yml \
76+
-f docker-compose.ranger-hadoop.yml \
77+
-f docker-compose.ranger-hive.yml \
78+
-f docker-compose.ranger-ozone.yml \
79+
up -d
80+
```
81+
82+
### Option B: Assemble containers yourself
83+
84+
Alternatively, run compatible images (for example [Apache Ranger](https://hub.docker.com/r/apache/ranger), [Apache Ozone](https://hub.docker.com/r/apache/ozone), and Hive/Hadoop images you trust) and attach them to **one user-defined Docker network** so Trino can resolve HMS and Ozone by container name.
85+
86+
:::warning Network and hostnames
87+
Trino’s catalog must use the **same Docker network** as HMS and the hosts named in `core-site.xml`. If Trino cannot resolve `ranger-hive` (or your HMS hostname), `thrift://` connections will fail. Replace example names with `docker network inspect` output from your stack.
88+
:::
89+
90+
## 3. Run Trino and install the Ozone JAR
91+
92+
Start a Trino container on the Ranger/Ozone network. The example uses image [trinodb/trino](https://hub.docker.com/r/trinodb/trino) and assumes the network is named `rangernw` (adjust to your setup):
93+
94+
```bash
95+
docker run -d -p 8080:8080 --name trino --network rangernw trinodb/trino
96+
```
97+
98+
Copy the Ozone filesystem JAR into the Hive HDFS plugin directory inside the container (paths match common Trino image layouts):
99+
100+
```bash
101+
docker cp /tmp/ozone-filesystem-hadoop3-*.jar \
102+
trino:/usr/lib/trino/plugin/hive/hdfs/
103+
```
104+
105+
If your Trino image uses a different install root, locate `plugin/hive/hdfs` under that root.
106+
107+
The **`ozone-filesystem-hadoop3`** module normally produces a **self-contained (shaded) JAR** meant to be dropped in as a **single** file. If you see `NoClassDefFoundError` for Ozone or gRPC classes, you may have the wrong artifact or a partial copy—use the primary `ozone-filesystem-hadoop3-*.jar` from this module’s `target/` directory, or the matching artifact from Maven Central.
108+
109+
**Restart Trino** after adding the JAR so the plugin class loader picks it up.
110+
111+
### Hadoop and Ozone configuration inside Trino
112+
113+
`hive.config.resources` must point to **real files** inside the container (comma-separated list if you need more than one). Those files must define the Ozone filesystem (for example `fs.ofs.impl`) and OM/SCM addresses the same way your Hive/Hadoop stack does—usually by reusing `core-site.xml` (and sometimes additional config such as `ozone-site.xml` or keys merged into `core-site.xml`) from the Ranger/Hadoop/Ozone compose setup.
114+
115+
The doc does **not** copy those files for you. Typical approaches:
116+
117+
- **`docker cp`** from a Hadoop or edge container that already has the right XMLs, into a path such as `/tmp/hadoop/conf/`, or
118+
- **`docker run -v`** to bind-mount a host directory of config into the Trino container.
119+
120+
Until this matches your live Ozone cluster, Trino will fail when it tries to open `ofs://` paths even if the Hive catalog and Metastore connection work.
121+
122+
## 4. Hive catalog properties (`hive.properties`)
123+
124+
Create a catalog file for the Hive connector. The HMS URI and config paths **must match your deployment**.
125+
126+
Example `hive.properties`:
127+
128+
```properties
129+
connector.name=hive
130+
hive.metastore.uri=thrift://ranger-hive:9083
131+
fs.hadoop.enabled=true
132+
hive.config.resources=/tmp/hadoop/conf/core-site.xml
133+
hive.non-managed-table-writes-enabled=true
134+
hive.hdfs.impersonation.enabled=true
135+
```
136+
137+
Copy it into the container:
138+
139+
```bash
140+
docker cp hive.properties trino:/etc/trino/catalog/
141+
```
142+
143+
:::warning Possible configuration gaps
144+
- **`hive.config.resources`**: Must list real files inside the container (often you mount a host directory of Hadoop config at `/tmp/hadoop/conf` or another path you choose).
145+
- **`hive.hdfs.impersonation.enabled=true`**: Requires a secure setup where Trino can impersonate end users; in minimal Docker demos this can fail if Hadoop/Ozone security is not aligned with Trino. Disable or adjust only if you understand the security trade-offs.
146+
- **Managed vs external tables**: Behavior depends on HMS metadata and Ozone paths; see [Hive](./hive).
147+
:::
148+
149+
## 5. Ranger access control (`access-control.properties`)
150+
151+
Ranger authorization for Trino depends on your **Trino version** and distribution: you need the Ranger access-control integration Trino expects (plugin JARs and native libraries, if any), **not** only the properties and XML files below. Follow [Trino Ranger access control](https://trino.io/docs/current/security/ranger-access-control.html) end to end, including how to install Ranger’s Trino artifacts into the container image if required.
152+
153+
If you enable Ranger for Trino, add an `access-control.properties` (location depends on Trino version; often `/etc/trino/`):
154+
155+
```properties
156+
access-control.name=ranger
157+
ranger.service.name=dev_trino
158+
ranger.plugin.config.resource=/etc/trino/ranger-trino-security.xml,/etc/trino/ranger-trino-audit.xml,/etc/trino/ranger-policymgr-ssl.xml
159+
ranger.hadoop.config.resource=
160+
```
161+
162+
Copy it in:
163+
164+
```bash
165+
docker cp access-control.properties trino:/etc/trino/
166+
```
167+
168+
You must also install the XML files referenced above (and any TLS trust stores or policy cache settings Ranger expects). Follow [Trino Ranger access control](https://trino.io/docs/current/security/ranger-access-control.html) and your Ranger Admin deployment.
169+
170+
:::warning Empty `ranger.hadoop.config.resource`
171+
The draft setup left **`ranger.hadoop.config.resource` blank**. That may be intentional for a minimal demo or it may be **incomplete** for your Ranger or Hadoop layout. Confirm with Trino and Ranger documentation whether Hadoop config must be passed to the Ranger plugin in your environment.
172+
:::
173+
174+
## 6. Restart Trino and verify
175+
176+
Restart the Trino container after configuration changes.
177+
178+
1. Open the Trino web UI (port `8080` in the example) or use `trino-cli`.
179+
2. `SHOW CATALOGS` should list `hive` (or whatever you named the properties file without `.properties`).
180+
3. Run a simple query against a table you know is stored on Ozone (path visible in HMS).
181+
182+
If initialization fails, check Trino logs for:
183+
184+
- Class loading or **protobuf** errors (often an Ozone / Hadoop / Trino **version mismatch** or a wrong JAR on the plugin classpath).
185+
- **Metastore** connection errors (wrong host, port, or network).
186+
- **Filesystem** errors (missing `core-site.xml` properties for `ofs` / `o3fs`).
187+
188+
## Summary of risks and open checks
189+
190+
| Area | What to verify |
191+
| ---- | -------------- |
192+
| Ozone JAR vs Trino | Use **`ozone-filesystem-hadoop3-*.jar`** from **`ozonefs-hadoop3`**; Ozone version and Hadoop line must match Trino and your cluster. |
193+
| Versions | Pinned Git commits and `*-SNAPSHOT` JARs are for **development**, not production baselines. |
194+
| Docker compose | File names and services come from the Ranger repo; they **drift** on `master`. |
195+
| Ranger | All `ranger-*.xml` files, service definitions, and `ranger.hadoop.config.resource` must match Ranger Admin and your Hadoop/Ozone config. |
196+
| Impersonation | `hive.hdfs.impersonation.enabled` requires a coherent security story across Trino, Hadoop, and Ozone. |
197+
198+
For work tracked around this integration on the Ozone side, see [HDDS-12321](https://issues.apache.org/jira/browse/HDDS-12321).

src/pages/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function Integrations() {
233233
}}
234234
/>
235235
),
236-
// link: '/docs/user-guide/integrations/trino'
236+
link: "/docs/user-guide/integrations/trino",
237237
},
238238
{
239239
name: "Impala",

0 commit comments

Comments
 (0)