1、如果之前存在network网络需要清理一下
docker-compose down -v --remove-orphans
2、新建目录
mkdir -p /home/iotdb/confignode/data
mkdir -p /home/iotdb/confignode/logs
mkdir -p /home/iotdb/datanode/data
mkdir -p /home/iotdb/datanode/logs
3、三台机器分别建立docker-compose-standalone.yml文件
3.1 第一台
version: "3"
services:
iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
container_name: iotdb-confignode
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
environment:
- cn_internal_address=10.1.19.191
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=10.1.19.191:10710
- schema_replication_factor=3
- data_replication_factor=2
privileged: true
volumes:
- /home/iotdb/confignode/data:/iotdb/data
- /home/iotdb/confignode/logs:/iotdb/logs
network_mode: "host"
iotdb-datanode:
image: apache/iotdb:2.0.6-datanode
container_name: iotdb-datanode
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
ports:
- "6667:6667"
privileged: true
environment:
- dn_rpc_address=10.1.19.191
- dn_internal_address=10.1.19.191
- dn_seed_config_node=10.1.19.191:10710
- dn_rpc_port=6667
- dn_internal_port=10730
- dn_mpp_data_exchange_port=10740
- dn_schema_region_consensus_port=10750
- dn_data_region_consensus_port=10760
- schema_replication_factor=3
- data_replication_factor=2
volumes:
- /home/iotdb/datanode/data:/iotdb/data
- /home/iotdb/datanode/logs:/iotdb/logs
network_mode: "host"
3.2 第二台
version: "3"
services:
iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
container_name: iotdb-confignode
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
environment:
- cn_internal_address=10.1.19.192
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=10.1.19.191:10710
- schema_replication_factor=3
- data_replication_factor=2
privileged: true
volumes:
- /home/iotdb/confignode/data:/iotdb/data
- /home/iotdb/confignode/logs:/iotdb/logs
network_mode: "host"
iotdb-datanode:
image: apache/iotdb:2.0.6-datanode
container_name: iotdb-datanode
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
ports:
- "6667:6667"
privileged: true
environment:
- dn_rpc_address=10.1.19.192
- dn_internal_address=10.1.19.192
- dn_seed_config_node=10.1.19.191:10710
- dn_rpc_port=6667
- dn_internal_port=10731
- dn_mpp_data_exchange_port=10741
- dn_schema_region_consensus_port=10751
- dn_data_region_consensus_port=10761
- schema_replication_factor=3
- data_replication_factor=2
volumes:
- /home/iotdb/datanode/data:/iotdb/data
- /home/iotdb/datanode/logs:/iotdb/logs
network_mode: "host"
3.3 第三台
version: "3"
services:
iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
container_name: iotdb-confignode
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
environment:
- cn_internal_address=10.1.19.193
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=10.1.19.191:10710
- schema_replication_factor=3
- data_replication_factor=2
privileged: true
volumes:
- /home/iotdb/confignode/data:/iotdb/data
- /home/iotdb/confignode/logs:/iotdb/logs
network_mode: "host"
iotdb-datanode:
image: apache/iotdb:2.0.6-datanode
container_name: iotdb-datanode
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
ports:
- "6667:6667"
privileged: true
environment:
- dn_rpc_address=10.1.19.193
- dn_internal_address=10.1.19.193
- dn_seed_config_node=10.1.19.191:10710
- dn_rpc_port=6667
# 注意 下方配置不同虚机的端口需要不一样的
- dn_internal_port=10732
- dn_mpp_data_exchange_port=10742
- dn_schema_region_consensus_port=10752
- dn_data_region_consensus_port=10762
- schema_replication_factor=3
- data_replication_factor=2
volumes:
- /home/iotdb/datanode/data:/iotdb/data
- /home/iotdb/datanode/logs:/iotdb/logs
network_mode: "host"
4、然后启动
version: "3"
services:
iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
container_name: iotdb-confignode
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
environment:
- cn_internal_address=10.1.19.193
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=10.1.19.191:10710
- schema_replication_factor=3
- data_replication_factor=2
privileged: true
volumes:
- /home/iotdb/confignode/data:/iotdb/data
- /home/iotdb/confignode/logs:/iotdb/logs
network_mode: "host"
iotdb-datanode:
image: apache/iotdb:2.0.6-datanode
container_name: iotdb-datanode
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
ports:
- "6667:6667"
privileged: true
environment:
- dn_rpc_address=10.1.19.193
- dn_internal_address=10.1.19.193
- dn_seed_config_node=10.1.19.191:10710
- dn_rpc_port=6667
# 注意 下方配置不同虚机的端口需要不一样的
- dn_internal_port=10732
- dn_mpp_data_exchange_port=10742
- dn_schema_region_consensus_port=10752
- dn_data_region_consensus_port=10762
- schema_replication_factor=3
- data_replication_factor=2
volumes:
- /home/iotdb/datanode/data:/iotdb/data
- /home/iotdb/datanode/logs:/iotdb/logs
network_mode: "host"
5、注意不同虚机下的- dn_internal_port=10732
-
dn_mpp_data_exchange_port=10742
-
dn_schema_region_consensus_port=10752
-
dn_data_region_consensus_port=10762几个端口号需要不同才行