Before v0.12, Apache IoTDB's docker image name and version format is:
apache/iotdb:0.<major>.<minor>.
From 0.12 on, we release two images: one is for a single node, and the other is for the cluster mode.
The format is: apache/iotdb:0.<major>.<minor>-node and apache/iotdb:0.<major>.<minor>-cluster.
Before v0.12, the "latest" tag will forward to the largest apache/iotdb:0.<major>.<minor>.
From 0.12 on, the "latest" tag will forward to the largest apache/iotdb:0.<major>.<minor>-node.
docker build -t THE_DOCKER_IMAGE_NAME:THE_VERSION -f THE_DOCKER_FILE_NAME
e.g.,
docker build -t my-iotdb:<version> -f Dockerfile-<version>Actually, we maintain a repo on dockerhub, so that you can get the docker image directly.
For example,
docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 -p 5555:5555 apache/iotdb:<version>docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 -p 5555:5555 -p 9003:9003 -p 40010:40010 apache/iotdb:<version>By default, the ports that IoTDB uses are:
- 6667: RPC port
- 31999: JMX port
- 8181: Monitor port
- 5555: Data sync port
- 9003: internal metadata rpc port (for cluster)
- 40010: internal data rpc port (for cluster)
The instructions below show how to store the output data and logs of IoTDB to two folders called iotdb_data and iotdb_logs respectively.
/D/docker/iotdb_data and /D/docker/iotdb_logs can be changed to any local directory of your own host.
docker run -it -v /D/docker/iotdb_data:/iotdb/data -v /D/docker/iotdb_logs:/iotdb/logs --name 123 apache/iotdb:<version>Suppose you have run an IoTDB Server in docker
- Use
docker psto find out the CONTAINER ID e.g.,
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c82321c70137 apache/iotdb:<version> "/iotdb/sbin/start-s…" 12 minutes ago Up 12 minutes 0.0.0.0:6667->6667/tcp, 0.0.0.0:8181->8181/tcp, 5555/tcp, 0.0.0.0:31999->31999/tcp elegant_germain- Use
docker execto attach the container:
docker exec -it c82321c70137 /bin/bashThen, for the latest version (or, >=0.10.x), run start-cli.sh, for version 0.9.x and 0.8.1, run start-client.sh.
Or,
docker exec -it c82321c70137 start-cli.sh- First way: use config file:
docker run -it -v /your_application.properties_folder:/iotdb-grafana/config -p 8888:8888 apache/iotdb:<version>-grafana
- Second way: use environment(take
SPRING_DATASOURCE_URLfor example)
docker run -it -p 8888:8888 apache/iotdb:<version>-grafana -e SPRING_DATASOURCE_URL=jdbc:iotdb://iotdb:6667/
- All related environment are as follows(more details in
grafana/src/main/resources/application.properties)
| name | default value |
|---|---|
| SPRING_DATASOURCE_URL | jdbc:iotdb://127.0.0.1:6667/ |
| SPRING_DATASOURCE_USERNAME | root |
| SPRING_DATASOURCE_PASSWORD | root |
| SPRING_DATASOURCE_DRIVER_CLASS_NAME | org.apache.iotdb.jdbc.IoTDBDriver |
| SERVER_PORT | 8888 |
| TIMESTAMP_PRECISION | ms |
| ISDOWNSAMPLING | true |
| INTERVAL | 1m |
| CONTINUOUS_DATA_FUNCTION | AVG |
| DISCRETE_DATA_FUNCTION | LAST_VALUE |
Using docker compose, it contains three services: iotdb, grafana and grafana-connector
- The location of docker compose file:
/docker/src/main/DockerCompose/docker-compose-grafana.yml - Use
docker-compose upcan start all three services- you can use
docker-compose up -dto start in the background - you can modify
docker-compose-grafana.ymlto implement your requirements.- you can modify environment of grafana-connector
- If you want to SAVE ALL DATA, please use
volumeskeyword to mount the data volume or file of the host into the container.
- you can use
- After all services are start, you can visit
{ip}:3000to visit grafana- In
Configuration, searchSimpleJson - Fill in url:
grafana-connector:8888, then clicksave and test. ifData source is workingis shown, the configuration is finished. - Then you can create dashboards.
- In
- if you want to stop services, just run
docker-compose down
Enjoy it!