docker-compose部署多分片多副本clickhouse本地环境

一、部署环境

1.ck版本:20.4.2.9

2.系统:MacOS

3.zookeeper版本:3.4

4.docker:19.03.8

二、配置

1.docker-compose.yaml

version: '2'

services:
  zookeeper-ck2:
    image: zookeeper:3.4
    restart: always
    hostname: zookeeper-ck2
    container_name: zookeeper-ck2
    ports:
      - "2183:2181"
      - "2184:2182"

  clickhouse01-ck2:
    image: yandex/clickhouse-server:20.4.2.9
    hostname: clickhouse01-ck2
    container_name: clickhouse01-ck2
    expose:
      - "9000"
    user: root
    privileged: true
    ports:
      - "8133:8123"
      - "9011:9000"
    volumes:
      - ./ch01/etc:/etc/clickhouse-server
      - ./ch01/data:/var/lib/clickhouse
      - ./ch01/log/:/var/log/clickhouse-server/
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper-ck2"

  clickhouse02-ck2:
    image: yandex/clickhouse-server:20.4.2.9
    hostname: clickhouse02-ck2
    container_name: clickhouse02-ck2
    expose:
      - "9000"
    user: root
    privileged: true
    ports:
      - "9012:9000"
      - "8134:8123"
    volumes:
      - ./ch02/etc:/etc/clickhouse-server
      - ./ch02/data:/var/lib/clickhouse
      - ./ch02/log/:/var/log/clickhouse-server/
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper-ck2"

  clickhouse03-ck2:
    image: yandex/clickhouse-server:20.4.2.9
    hostname: clickhouse03-ck2
    container_name: clickhouse03-ck2
    expose:
      - "9000"
    user: root
    privileged: true
    ports:
      - "9013:9000"
      - "8135:8123"
    volumes:
      - ./ch03/etc:/etc/clickhouse-server
      - ./ch03/data:/var/lib/clickhouse
      - ./ch03/log/:/var/log/clickhouse-server/
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper-ck2"

  clickhouse04-ck2:
    image: yandex/clickhouse-server:20.4.2.9
    hostname: clickhouse04-ck2
    container_name: clickhouse04-ck2
    expose:
      - "9000"
    user: root
    privileged: true
    ports:
      - "9014:9000"
      - "8136:8123"
    volumes:
      - ./ch04/etc:/etc/clickhouse-server
      - ./ch04/data:/var/lib/clickhouse
      - ./ch04/log/:/var/log/clickhouse-server/
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    depends_on:
      - "zookeeper-ck2"

2.config.xml

3.metrika.xml

4.users.xml

三、目录

这里我部署了4节点,两分片,两副本

四、结果

docker-compose部署多分片多副本clickhouse本地环境_第1张图片

最后可以根据配置进行连接

docker-compose部署多分片多副本clickhouse本地环境_第2张图片

 

 

你可能感兴趣的:(clickhouse)