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
相关推荐
Algorithm15762 小时前
mac上使用docker搭建gitlab
macos·docker·gitlab
巅峰程序12 小时前
[docker]拉取镜像失败
docker·容器·eureka
江流。12 小时前
docker执行java的jar包
java·docker·jar
MonkeyKing_sunyuhua14 小时前
sudo docker ps才能查看,docker ps不能查看问题
docker·容器·eureka
小龙在山东14 小时前
使用Docker快速部署FastAPI Web应用
docker·容器·fastapi
苏格拉真没有底14 小时前
docker配置代理解决不能拉镜像问题
运维·docker·容器
CoderJia程序员甲17 小时前
阿里云Linux安装Docker服务报错问题
linux·阿里云·docker
Ada大侦探18 小时前
新手小白学习docker第六弹------Docker常规安装(安装tomcat、mysql、redis)
mysql·docker·tomcat
ciao-lk18 小时前
docker desktop运行rabittmq容器,控制台无法访问
docker·容器
五月高高19 小时前
Docker部署Nginx服务器并实现HTTPS自动重定向
服务器·nginx·docker