使用容器编排工具docker swarm安装clickhouse多机集群
Posted zqr99
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用容器编排工具docker swarm安装clickhouse多机集群相关的知识,希望对你有一定的参考价值。
1.首先需要安装docker最新版,docker 目前自带swarm容器编排工具
2.选中一台机器作为master,执行命令sudo docker swarm init [options]
3,再需要加入集群的集群上执行此命令
4.可以使用sudo docker node ls此命令来查询节点数
5编写docker-compose.yaml文件,目前我使用的是version 3版本,version2和3有区别,具体看官网介绍
贴一份完整的docker-compose.yaml供大家参考
version: ‘3‘
services:
zookeeper:
image: zookeeper
ports:
- "2181:2181"
- "2182:2182"
volumes:
- "/data/clickhouse/zk/data:/data"
- "/data/clickhouse/zk/log:/datalog"
deploy:
placement:
constraints:
- node.hostname == SHA11DMPHAMP01
# networks:
# - clickhouse
clickhouse203:
image: yandex/clickhouse-server
container_name: clickhouse203
expose:
- "9000"
- "8123"
user: root
privileged: true
deploy:
placement:
constraints:
- node.hostname == SHA11DMPHDOP01
ports:
- "111.250.128.203:9000:9000"
- "111.250.128.203:8123:8123"
volumes:
- "/data/clickhouse/etc:/etc/clickhouse-server"
- "/data/clickhouse/data:/var/lib/clickhouse"
- "/data/clickhouse/log:/var/log/clickhouse-server"
ulimits:
nofile:
soft: 262144
hard: 262144
depends_on:
- "zookeeper"
# networks:
# - clickhouse_network
clickhouse204:
image: yandex/clickhouse-server
container_name: clickhouse204
expose:
- "9000"
- "8123"
user: root
privileged: true
deploy:
placement:
constraints:
- node.hostname == SHA11DMPHDOP02
ports:
- "111.250.128.204:9001:9000"
- "111.250.128.204:8124:8123"
volumes:
- "/data/clickhouse/etc:/etc/clickhouse-server"
- "/data/clickhouse/data:/var/lib/clickhouse"
- "/data/clickhouse/log:/var/log/clickhouse-server"
ulimits:
nofile:
soft: 262144
hard: 262144
depends_on:
- "zookeeper"
# networks:
# - clickhouse
clickhouse205:
image: yandex/clickhouse-server
container_name: clickhouse205
expose:
- "9000"
- "8123"
user: root
privileged: true
deploy:
placement:
constraints:
- node.hostname == SHA11DMPHDOP03
ports:
- "111.250.128.205:9002:9000"
- "111.250.128.205:8125:8123"
volumes:
- "/data/clickhouse/etc:/etc/clickhouse-server"
- "/data/clickhouse/data:/var/lib/clickhouse"
- "/data/clickhouse/log:/var/log/clickhouse-server"
ulimits:
nofile:
soft: 262144
hard: 262144
depends_on:
- "zookeeper"
# networks:
# - clickhouse
clickhouse206:
image: yandex/clickhouse-server
container_name: clickhouse206
expose:
- "9000"
- "8123"
user: root
privileged: true
deploy:
placement:
constraints:
- node.hostname == SHA11DMPHDOP04
ports:
- "111.250.128.206:9003:9000"
- "111.250.128.206:8126:8123"
volumes:
- "/data/clickhouse/etc:/etc/clickhouse-server"
- "/data/clickhouse/data:/var/lib/clickhouse"
- "/data/clickhouse/log:/var/log/clickhouse-server"
ulimits:
nofile:
soft: 262144
hard: 262144
depends_on:
- "zookeeper"
# networks:
# - clickhouse
#networds:
# clickhouse_network:
clickhouse的具体配置我就不介绍了,配置方面可以看我上一篇博客
希望大家尊重作者版权, 未经允许不得转载,违者必究!!
以上是关于使用容器编排工具docker swarm安装clickhouse多机集群的主要内容,如果未能解决你的问题,请参考以下文章
小规模容器编排使用Docker Swarm不香么,用个锤子的kubernetes