Docker环境下部署TDengine集群
发表于|更新于
|字数总计:440|阅读时长:2分钟|阅读量:
一、Docker环境准备
本文基于Windows 10
+Docker Desktop
单机搭建集群,如需跨主机搭建,请自行搜索Swarm
或Docker跨主机通讯
相关内容。
Docker Desktop自带了Docker Compose
,无需另外安装
1 2
| # 验证一下 docker-compose --version
|
2、创建Docker网络
1
| docker network create --driver bridge --subnet 172.18.0.0/16 taosnet
|
二、集群配置
1、创建数据文件夹和配置文件
1 2 3
| /path/to/tdengine-docker/node{n}/logs /path/to/tdengine-docker/node{n}/data /path/to/tdengine-docker/node{n}/taos.cfg
|
2、编辑docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| version: "2" services: taos-node1: container_name: taos-node1 restart: on-failure volumes: - ./node1/logs:/var/log/taos - ./node1/data:/var/lib/taos - ./node1/taos.cfg:/etc/taos/taos.cfg ports: - "6030-6049:6030-6049" image: tdengine/tdengine:2.6.0.4 hostname: taos-node1 extra_hosts: - "taos-node2:172.18.0.3" - "taos-node3:172.18.0.4" networks: taosnet: ipv4_address: 172.18.0.2 network_mode: "bridge"
taos-node2: container_name: taos-node2 restart: on-failure volumes: - ./node2/logs:/var/log/taos - ./node2/data:/var/lib/taos - ./node2/taos.cfg:/etc/taos/taos.cfg ports: - "7030-7049:7030-7049" image: tdengine/tdengine:2.6.0.4 hostname: taos-node2 extra_hosts: - "taos-node1:172.18.0.2" - "taos-node3:172.18.0.4" networks: taosnet: ipv4_address: 172.18.0.3 network_mode: "bridge"
taos-node3: container_name: taos-node3 restart: on-failure volumes: - ./node3/logs:/var/log/taos - ./node3/data:/var/lib/taos - ./node3/taos.cfg:/etc/taos/taos.cfg ports: - "8030-8049:8030-8049" image: tdengine/tdengine:2.6.0.4 hostname: taos-node3 extra_hosts: - "taos-node1:172.18.0.2" - "taos-node2:172.18.0.3" networks: taosnet: ipv4_address: 172.18.0.4 network_mode: "bridge"
networks: taosnet: external: true
|
3、修改各节点taos.cfg
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| node1: firstEp taos-node1:6030 fqdn taos-node1 serverPort 6030
node2: firstEp taos-node1:6030 fqdn taos-node2 serverPort 7030
node3: firstEp taos-node1:6030 fqdn taos-node3 serverPort 8030
|
4、启动集群组网
1 2 3 4 5 6 7
| # 启动docker集群 docker-compose up -d
# 在node1运行命令,让node2和node3加入集群 taos create dnode "taos-node2:7030"; create dnode "taos-node3:8030";
|
5、测试和访问
参考官网文档