Installation by Docker
Apache IoTDB’ Docker image is released on https://hub.docker.com/r/apache/iotdb
open in new window
Add environments of docker to update the configurations of Apache IoTDB.
Have a try
# get IoTDB official imagedocker pull apache/iotdb:1.1.0-standalone# create docker bridge networkdocker network create --driver=bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 iotdb# create docker containerdocker run -d --name iotdb-service \--hostname iotdb-service \--network iotdb \--ip 172.18.0.6 \-p 6667:6667 \-e cn_internal_address=iotdb-service \-e cn_target_config_node_list=iotdb-service:10710 \-e cn_internal_port=10710 \-e cn_consensus_port=10720 \-e dn_rpc_address=iotdb-service \-e dn_internal_address=iotdb-service \-e dn_target_config_node_list=iotdb-service:10710 \-e dn_mpp_data_exchange_port=10740 \-e dn_schema_region_consensus_port=10750 \-e dn_data_region_consensus_port=10760 \-e dn_rpc_port=6667 \apache/iotdb:1.1.0-standalone# execute SQLdocker exec -ti iotdb-service /iotdb/sbin/start-cli.sh -h iotdb-service
External access:
# <IP Address/hostname> is the real IP or domain address rather than the one in docker network, could be 127.0.0.1 within the computer.$IOTDB_HOME/sbin/start-cli.sh -h <IP Address/hostname> -p 6667
Notice:The confignode service would fail when restarting this container if the IP Adress of the container has been changed.
# docker-compose-standalone.ymlversion: "3"services:iotdb-service:image: apache/iotdb:1.1.0-standalonehostname: iotdb-servicecontainer_name: iotdb-serviceports:- "6667:6667"environment:- cn_internal_address=iotdb-service- cn_internal_port=10710- cn_consensus_port=10720- cn_target_config_node_list=iotdb-service:10710- dn_rpc_address=iotdb-service- dn_internal_address=iotdb-service- dn_rpc_port=6667- dn_mpp_data_exchange_port=10740- dn_schema_region_consensus_port=10750- dn_data_region_consensus_port=10760- dn_target_config_node_list=iotdb-service:10710volumes:- ./data:/iotdb/data- ./logs:/iotdb/logsnetworks:iotdb:ipv4_address: 172.18.0.6networks:iotdb:external: true
deploy cluster
Until now, we support host and overlay networks but haven’t supported bridge networks on multiple computers.
Overlay networks see 1C2D
open in new window and here are the configurations and operation steps to start an IoTDB cluster with docker using host networks。
Suppose that there are three computers of iotdb-1, iotdb-2 and iotdb-3. We called them nodes.
Here is the docker-compose file of iotdb-2, as the sample:
version: "3"services:iotdb-confignode:image: apache/iotdb:1.1.0-confignodecontainer_name: iotdb-confignodeenvironment:- cn_internal_address=iotdb-2- cn_target_config_node_list=iotdb-1:10710- cn_internal_port=10710- cn_consensus_port=10720- schema_replication_factor=3- schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus- config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus- data_replication_factor=3- data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensusvolumes:- /etc/hosts:/etc/hosts:ro- ./data/confignode:/iotdb/data- ./logs/confignode:/iotdb/logsnetwork_mode: "host"iotdb-datanode:image: apache/iotdb:1.1.0-datanodecontainer_name: iotdb-datanodeenvironment:- dn_rpc_address=iotdb-2- dn_internal_address=iotdb-2- dn_target_config_node_list=iotdb-1:10710- data_replication_factor=3- dn_rpc_port=6667- dn_mpp_data_exchange_port=10740- dn_schema_region_consensus_port=10750- dn_data_region_consensus_port=10760- data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus- schema_replication_factor=3- schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus- config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensusvolumes:- /etc/hosts:/etc/hosts:ro- ./data/datanode:/iotdb/data/- ./logs/datanode:/iotdb/logs/network_mode: "host"
Notice:
- The
dn_target_config_node_listof three nodes must the same and it is the first starting node ofiotdb-1with the cn_internal_port of 10710。 - In this docker-compose file,
iotdb-2should be replace with the real IP or hostname of each node to generate docker compose files in the other nodes. - The services would talk with each other, so they need map the /etc/hosts file or add the
extra_hoststo the docker compose file. - We must start the IoTDB services of
iotdb-1first at the first time of starting. - Stop and remove all the IoTDB services and clean up the
dataandlogsdirectories of the 3 nodes,then start the cluster again.