2018-09-17 17:46:28 +00:00
|
|
|
---
|
2019-06-28 17:51:30 +00:00
|
|
|
title: "Docker Cheat Sheet"
|
2018-09-17 17:46:28 +00:00
|
|
|
date: 2017-08-10
|
2019-06-28 17:51:30 +00:00
|
|
|
summary: Docker Compose cheat sheet to help you remember the common commands to control an Ozone cluster running on top of Docker.
|
|
|
|
weight: 4
|
2018-09-17 17:46:28 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
<!---
|
2018-09-17 23:21:10 +00:00
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
2018-09-17 17:46:28 +00:00
|
|
|
|
2018-09-17 23:21:10 +00:00
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
2018-09-17 23:21:10 +00:00
|
|
|
limitations under the License.
|
2018-09-17 17:46:28 +00:00
|
|
|
-->
|
|
|
|
|
2019-08-21 17:17:41 +00:00
|
|
|
In the `compose` directory of the ozone distribution there are multiple pseudo-cluster setup which
|
|
|
|
can be used to run Ozone in different way (for example: secure cluster, with tracing enabled,
|
|
|
|
with prometheus etc.).
|
2018-09-17 17:46:28 +00:00
|
|
|
|
2019-06-28 17:51:30 +00:00
|
|
|
If the usage is not document in a specific directory the default usage is the following:
|
2018-09-17 17:46:28 +00:00
|
|
|
|
2019-06-28 17:51:30 +00:00
|
|
|
```bash
|
2018-09-17 17:46:28 +00:00
|
|
|
cd compose/ozone
|
|
|
|
docker-compose up -d
|
2019-06-28 17:51:30 +00:00
|
|
|
```
|
2018-09-17 17:46:28 +00:00
|
|
|
|
2019-08-21 17:17:41 +00:00
|
|
|
The data of the container is ephemeral and deleted together with the docker volumes.
|
2019-06-28 17:51:30 +00:00
|
|
|
```bash
|
2018-09-17 17:46:28 +00:00
|
|
|
docker-compose down
|
2019-06-28 17:51:30 +00:00
|
|
|
```
|
2018-09-17 17:46:28 +00:00
|
|
|
|
2019-06-28 17:51:30 +00:00
|
|
|
## Useful Docker & Ozone Commands
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
If you make any modifications to ozone, the simplest way to test it is to run freon and unit tests.
|
|
|
|
|
2019-01-25 06:47:36 +00:00
|
|
|
Here are the instructions to run freon in a docker-based cluster.
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
docker-compose exec datanode bash
|
|
|
|
{{< /highlight >}}
|
|
|
|
|
|
|
|
This will open a bash shell on the data node container.
|
2018-10-12 06:00:13 +00:00
|
|
|
Now we can execute freon for load generation.
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
ozone freon randomkeys --numOfVolumes=10 --numOfBuckets 10 --numOfKeys 10
|
|
|
|
{{< /highlight >}}
|
|
|
|
|
2019-01-25 06:47:36 +00:00
|
|
|
Here is a set of helpful commands for working with docker for ozone.
|
2018-09-17 17:46:28 +00:00
|
|
|
To check the status of the components:
|
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
docker-compose ps
|
|
|
|
{{< /highlight >}}
|
|
|
|
|
|
|
|
To get logs from a specific node/service:
|
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
docker-compose logs scm
|
|
|
|
{{< /highlight >}}
|
|
|
|
|
|
|
|
|
|
|
|
As the WebUI ports are forwarded to the external machine, you can check the web UI:
|
|
|
|
|
|
|
|
* For the Storage Container Manager: http://localhost:9876
|
2019-01-25 06:47:36 +00:00
|
|
|
* For the Ozone Manager: http://localhost:9874
|
|
|
|
* For the Datanode: check the port with `docker ps` (as there could be multiple data nodes, ports are mapped to the ephemeral port range)
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
You can start multiple data nodes with:
|
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
docker-compose scale datanode=3
|
|
|
|
{{< /highlight >}}
|
|
|
|
|
2019-06-28 17:51:30 +00:00
|
|
|
You can test the commands from the [Ozone CLI]({{< ref "shell/_index.md" >}}) after opening a new bash shell in one of the containers:
|
2018-09-17 17:46:28 +00:00
|
|
|
|
|
|
|
{{< highlight bash >}}
|
|
|
|
docker-compose exec datanode bash
|
|
|
|
{{< /highlight >}}
|