centerOS下docker 搭建IotDB集群

一、准备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-confignode
    restart: always
    container_name: iotdb-confignode
    environment:
      - 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.IoTConsensus
    volumes:
      - ./data/confignode:/iotdb/data
      - ./logs/confignode:/iotdb/logs
    network_mode: "host"

  iotdb-datanode:
    image: apache/iotdb:1.1.0-datanode
    restart: always
    container_name: iotdb-datanode
    environment:
      - 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.RatisConsensus
    volumes:
      - ./data/datanode:/iotdb/data/
      - ./logs/datanode:/iotdb/logs/
    network_mode: "host"

2、第二台机器

version: "3"
services:
  iotdb-confignode:
    image: apache/iotdb:1.1.0-confignode
    restart: always
    container_name: iotdb-confignode
    environment:
      - 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.IoTConsensus
    volumes:
      - ./data/confignode:/iotdb/data
      - ./logs/confignode:/iotdb/logs
    network_mode: "host"

  iotdb-datanode:
    image: apache/iotdb:1.1.0-datanode
    restart: always
    container_name: iotdb-datanode
    environment:
      - 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.RatisConsensus
    volumes:
      - ./data/datanode:/iotdb/data/
      - ./logs/datanode:/iotdb/logs/
    network_mode: "host"

3、第三台机器

version: "3"
services:
  iotdb-confignode:
    image: apache/iotdb:1.1.0-confignode
    restart: always
    container_name: iotdb-confignode
    environment:
      - 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.IoTConsensus
    volumes:
      - ./data/confignode:/iotdb/data
      - ./logs/confignode:/iotdb/logs
    network_mode: "host"

  iotdb-datanode:
    image: apache/iotdb:1.1.0-datanode
    restart: always
    container_name: iotdb-datanode
    environment:
      - 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.RatisConsensus
    volumes:
      - ./data/datanode:/iotdb/data/
      - ./logs/datanode:/iotdb/logs/
    network_mode: "host"

三、分别运行docker-compose.yml文件

docker-compose up -d
相关推荐
Just_Do_IT_OK1 小时前
Docker--Kibana
docker
QQ_7781329743 小时前
Docker--Docker Network(网络)
docker
Dusk_橙子4 小时前
在K8S中,节点状态notReady如何排查?
云原生·容器·kubernetes
骑着王八撵玉兔4 小时前
【容器化技术 Docker 与微服务部署】详解
分布式·docker·微服务·中间件·容器·架构
dessler5 小时前
Docker-Harbor部署指南
linux·运维·docker
刘大猫265 小时前
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
大数据·人工智能·docker
Jrainlau7 小时前
2025 年前端开发工程师必备的 Docker Compose 全栈项目实践
docker
ihengshuai7 小时前
Docker网络与数据卷持久化
网络·docker·容器
iffy18 小时前
Docker部署cosyvoice
运维·docker·容器