Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/06-troubleshooting/15-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_label: Docker
---

# Troubleshooting Ozone in Docker

**TODO:** File a subtask under [HDDS-9860](https://issues.apache.org/jira/browse/HDDS-9860) and complete this page or section.
171 changes: 166 additions & 5 deletions docs/08-developer-guide/02-run/02-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,170 @@ sidebar_label: Docker Compose

# Running Ozone From Docker Compose

**TODO:** File a subtask under [HDDS-9861](https://issues.apache.org/jira/browse/HDDS-9861) and complete this page or section.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

- Reference common clusters from acceptance tests that can be used.
- Define the Ozone runner image at `ozone-docker-runner` and its purpose to wrap Ozone binaries.
- How to define which image gets used in the cluster (runner or other pre-built image).
- Changing configurations in Docker Compose (`docker-config` file, transformation.py, etc).
This guide walks you through the process of building Apache Ozone from source and running it using Docker Compose. This approach is particularly useful for development, testing, and understanding Ozone's architecture.

## Prerequisites

Before you begin, ensure you have installed:

- [Docker Engine](https://docs.docker.com/engine/install/) - Latest stable version
- [Docker Compose](https://docs.docker.com/compose/install/) - Latest stable version

## Building and Deploying Ozone

### Step 1: Build from Source

First, build Ozone from source following our [Build with Maven](/docs/08-developer-guide/01-build/01-maven.md) guide.

### Step 2: Locate Docker Compose Files

Navigate to the compose directory in your build output:

```bash
cd ./hadoop-ozone/dist/target/ozone-<VERSION>/compose/ozone
```

### Step 3: Configure Your Deployment (Optional)

You can customize your Ozone deployment by modifying the configuration parameters in the `docker-compose.yaml` file:

1. **Common Configurations**: Located under the `x-common-config` section
2. **Service-Specific Settings**: Found under the `environment` section of individual services

Example configuration modification:

```yaml
# Example configuration modifications
x-common-config:
environment:
OZONE-SITE.XML_ozone.scm.container.size: 1GB
OZONE-SITE.XML_ozone.scm.block.size: 256MB
```

### Step 4: Launch the Cluster

Start your Ozone cluster:

```bash
docker compose up -d --scale datanode=3
```

This command creates a fully functional Apache Ozone cluster using the `ozone-docker-runner` base image, which mounts your locally compiled Ozone binaries.

## Container Diagram

This image shows the containers that will be created by the `docker compose up -d` command when running the default Docker Compose configuration under `/compose/ozone` .

<!-- cspell:word DN -->

```mermaid
graph TB
subgraph "Apache Ozone Containers"
scm["SCM<br/>Storage Container Manager<br/>(Port: 9876, 9860)"]
om["OM<br/>Ozone Manager<br/>(Port: 9874, 9862)"]
s3g["S3G<br/>S3 Gateway<br/>(Port: 9878)"]
recon["Recon<br/>Monitoring Service<br/>(Port: 9888)"]
httpfs["HttpFS<br/>HTTP FileSystem<br/>(Port: 14000)"]

subgraph "Data Nodes"
dn1["DataNode 1<br/>(Port: 19864, 9882)"]
dnN["DataNode N<br/>(Port: 19864, 9882)"]
end

%% Connections
scm --> dn1
scm --> dnN
om --> dn1
om --> dnN
s3g --> om
s3g --> scm
httpfs --> om
httpfs --> scm
recon --> scm
recon --> om
end

classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
classDef datanode fill:#e1f5fe,stroke:#0288d1,stroke-width:2px;
classDef manager fill:#e8f5e9,stroke:#388e3c,stroke-width:2px;

class dn1,dnN datanode;
class scm,om manager;
```

## Cluster Components

### Core Services

Your Ozone cluster includes the following components:

- **Storage Container Manager (SCM)**: Manages storage containers and block allocation
- **Ozone Manager (OM)**: Handles namespace operations and metadata management
- **S3 Gateway**: Provides S3-compatible API access
- **Recon**: Monitoring and management service
- **Datanodes**: Distributed storage nodes
- **HttpFS**: HTTP-based filesystem interface

## Cluster Management

### Essential Commands

Here are the key commands for managing your Ozone cluster:

```bash
# Start the cluster
docker compose up -d

# Stop and remove all containers
docker compose down

# Monitor service logs
docker compose logs -f [service_name]

# Scale the number of datanodes
docker compose up -d --scale datanode=3

# Check cluster status
docker compose ps
```

### CLI Access

Access the Ozone command-line interface from any Ozone container:

```bash
# Enter the Ozone Manager container or any other container
docker compose exec om bash

# Run Ozone commands
ozone
```

## Advanced Configurations

The compose directory includes several specialized configurations for different use cases:

<!-- cspell:word ozonesecure -->

| Configuration | Purpose |
|----------------|-----------------------------------------|
| ozone-ha | High availability deployment setup |
| ozonesecure | Security features with SSL and Kerberos |
| ozone-topology | Rack-aware deployment configuration |
| upgrade | Non-rolling upgrade testing environment |

To explore these configurations:

```bash
cd hadoop-ozone/dist/target/ozone-*-SNAPSHOT/compose/
```

## Next Steps

After setting up your development cluster:

1. Explore the [Ozone CLI documentation](/docs/04-user-guide/02-clients/01-ozone.md)
2. Experiment with the various compose configurations for specific use cases
2 changes: 2 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const config = {
],

markdown: {
mermaid: true,
/*
Validate markdown frontmatter against a more restrictive schema than what Docusaurus allows.
This ensures all pages are using a minimal set of consistent keys.
Expand Down Expand Up @@ -171,6 +172,7 @@ const config = {
]
],

themes: ['@docusaurus/theme-mermaid'],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packageManager": "pnpm@8.7.1",
"packageManager": "pnpm@9.12.3",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why we need the pnpm version bump? Is mermaid incompatible with older versions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With pnpm@8.7.1, running docker-compose fails with the following error:

0.280 ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-8.7.1.tgz
1.109  ERR_PNPM_LOCKFILE_BREAKING_CHANGE  Lockfile /ozone-site/pnpm-lock.yaml not compatible with current pnpm
1.109 
1.109 Run with the --force parameter to recreate the lockfile.
------
failed to solve: process "/bin/sh -c pnpm install --prod --frozen-lockfile" did not complete successfully: exit code: 1
`docker-compose` process finished with exit code 17

I added the docusaurus/theme-mermaid package via pnpm add @docusaurus/theme-mermaid@3.3.2 on my mac. This updated the pnpm-lock.yaml and the package.json files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptlrs can you run pnpm --version?
One reason for this error would be because the lockfile was generated on my machine running v8 and yours might have installed v9.
The reason for using v8 was because Ozone dist also uses pnpm v8 and hence local testing becomes easier when working on both the repos

"name": "doc-site",
"version": "0.1.0",
"private": true,
Expand All @@ -18,6 +18,7 @@
"@docusaurus/core": "3.7.0",
"@docusaurus/plugin-pwa": "^3.7.0",
"@docusaurus/preset-classic": "3.7.0",
"@docusaurus/theme-mermaid": "3.7.0",
"@mdx-js/react": "^3.1.0",
"ajv": "^8.17.1",
"clsx": "^2.1.1",
Expand Down
Loading
Loading