一、准备3台机器,IP地址依次为IP1,IP2,IP3,找一个目录下建立文件夹如下:
./data/confignode
./logs/confignode
./data/datanode
./logs/datanode
二、在当前目录下建立docker-compose.yml文件,3台都要
1、第一台(为主节点的)
version: "3"
services:iotdb-confignode:image: apache/iotdb:1.1.0-confignoderestart: alwayscontainer_name: iotdb-confignodeenvironment:- cn_internal_address=IP1- cn_target_config_node_list=IP1:10710- schema_replication_factor=3- cn_internal_port=10710- cn_consensus_port=10720- 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:- ./data/confignode:/iotdb/data- ./logs/confignode:/iotdb/logsnetwork_mode: "host"iotdb-datanode:image: apache/iotdb:1.1.0-datanoderestart: alwayscontainer_name: iotdb-datanodeenvironment:- dn_rpc_address=IP1- dn_internal_address=IP1- dn_target_config_node_list=IP1: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:- ./data/datanode:/iotdb/data/- ./logs/datanode:/iotdb/logs/network_mode: "host"
2、第二台机器
version: "3"
services:iotdb-confignode:image: apache/iotdb:1.1.0-confignoderestart: alwayscontainer_name: iotdb-confignodeenvironment:- cn_internal_address=IP2- cn_target_config_node_list=IP2:10710- schema_replication_factor=3- cn_internal_port=10710- cn_consensus_port=10720- 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:- ./data/confignode:/iotdb/data- ./logs/confignode:/iotdb/logsnetwork_mode: "host"iotdb-datanode:image: apache/iotdb:1.1.0-datanoderestart: alwayscontainer_name: iotdb-datanodeenvironment:- dn_rpc_address=IP2- dn_internal_address=IP2- dn_target_config_node_list=IP1: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:- ./data/datanode:/iotdb/data/- ./logs/datanode:/iotdb/logs/network_mode: "host"
3、第三台机器
version: "3"
services:iotdb-confignode:image: apache/iotdb:1.1.0-confignoderestart: alwayscontainer_name: iotdb-confignodeenvironment:- cn_internal_address=IP3- cn_target_config_node_list=IP3:10710- schema_replication_factor=3- cn_internal_port=10710- cn_consensus_port=10720- 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:- ./data/confignode:/iotdb/data- ./logs/confignode:/iotdb/logsnetwork_mode: "host"iotdb-datanode:image: apache/iotdb:1.1.0-datanoderestart: alwayscontainer_name: iotdb-datanodeenvironment:- dn_rpc_address=IP3- dn_internal_address=IP3- dn_target_config_node_list=IP1: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:- ./data/datanode:/iotdb/data/- ./logs/datanode:/iotdb/logs/network_mode: "host"
三、分别运行docker-compose.yml文件
docker-compose up -d