{"id":28281746,"url":"https://github.com/linsoss/clickhouse-cluster-docker","last_synced_at":"2025-06-17T00:32:30.098Z","repository":{"id":105548098,"uuid":"316426935","full_name":"linsoss/clickhouse-cluster-docker","owner":"linsoss","description":"Docker compose for ClickHouse Cluster","archived":false,"fork":false,"pushed_at":"2023-10-19T13:20:53.000Z","size":25,"stargazers_count":17,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-21T12:18:07.968Z","etag":null,"topics":["clickhouse","clickhouse-server","docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linsoss.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-27T07:12:11.000Z","updated_at":"2025-02-25T06:59:57.000Z","dependencies_parsed_at":"2024-05-10T20:30:54.946Z","dependency_job_id":null,"html_url":"https://github.com/linsoss/clickhouse-cluster-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linsoss/clickhouse-cluster-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsoss%2Fclickhouse-cluster-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsoss%2Fclickhouse-cluster-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsoss%2Fclickhouse-cluster-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsoss%2Fclickhouse-cluster-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linsoss","download_url":"https://codeload.github.com/linsoss/clickhouse-cluster-docker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsoss%2Fclickhouse-cluster-docker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260268207,"owners_count":22983599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","clickhouse-server","docker","docker-compose"],"created_at":"2025-05-21T12:13:33.737Z","updated_at":"2025-06-17T00:32:30.090Z","avatar_url":"https://github.com/linsoss.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClickHouse Cluster Docker Compose\n\n![4cc49380-82ee-11ea-9baf-d971dbaafe63](https://cdn.jsdelivr.net/gh/Al-assad/md-img@master/bucket-3/202011271720.png)\n\n**[English](README.md)** ｜ [**中文**](README-CN.md)\n\n\u003cbr\u003e\n\n用于快速构建 ClickHouse Server 集群环境的 docker-compose 脚本，基于 [clickhouse/clickHouse-server](clickhouse/clickHouse-server) 官方镜像，支持自定义 clickhosue-server 版本，默认组件版本如下：\n\n* zookeeper：3.6；\n* clickHouse-server：20.11 ；\n\n### 快速开始\n\n```shell\ngit clone https://github.com/Al-assad/clickhouse-cluster-docker.git\ndocker-compose up\n```\n\n默认创建的集群节点为 1 个 zookeeper 节点，3 个 clickhosue-server 节点（3 分片、1 副本）：\n\n![image-20201127163735143](https://cdn.jsdelivr.net/gh/Al-assad/md-img@master/bucket-3/202011271637.png)\n\n### 宿主机连接 ClickHosue 集群\n\n1. 通过宿主机 ip 访问：\n\n   ```shell\n   clickhouse-server-ch01    127.0.0.1:8124\n   clickhouse-server-ch02    127.0.0.1:8125\n   clickhouse-server-ch03    127.0.0.1:8126\n   ```\n\n2. 通过 docker 子网 ip 访问：\n\n   如果宿主机为 MacOS，可以通过 [mac-docker-connector](https://github.com/wenjunxiao/mac-docker-connector) 项目直接访问是 docker 子网络：\n\n   ```shell\n   clickhouse-server-ch01    172.18.1.5:8123\n   clickhouse-server-ch02    172.18.1.6:8123\n   clickhouse-server-ch03    172.18.1.7:8123\n   ```\n\n可以通过 DBeaver 或者 clickhosue-client 连接访问 clickhosue-server 集群。\n\n### 其他集群模式\n\n```shell\n# zookeeper 单节点，clickhosue 3 分片 1 副本\ndocker-compose -f clickhosue_1zk-3shard-1replica up\n\n# zookeeper 单节点，clickhosue 3 分片 3 副本\ndocker-compose -f clickhosue_1zk-3shard-3replica up\n\n# zookeeper 3 节点，clickhosue 3 分片 1 副本\ndocker-compose -f clickhosue_3zk-3shard-1replica up\n\n# zookeeper 3 节点，clickhosue 3 分片 3 副本\ndocker-compose -f clickhosue_3zk-3shard-3replica up\n```\n\n此外可以通过直接修改 `ch-conf/metrika_ch01.xml`、`ch-conf/metrika_ch02.xml`、`ch-conf/metrika_ch03.xml` 来修改 3 个 ch 节点的 metrika 配置。\n\n### 其他 ClickHouse 版本\n\n可以通过修改 `CLICKHOUSE_VERSION` 环境变量来自定义 CH 镜像版本，注意需要使用 clickhouse/clickhosue-server 的对应镜像版本。\n\n```shell\n# 使用 clickhouse-server 23.8.4 版本\nexport CLICKHOUSE_VERSION=23.8.4 \u0026\u0026 docker-compose config\n```\n\n\n\n\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsoss%2Fclickhouse-cluster-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinsoss%2Fclickhouse-cluster-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsoss%2Fclickhouse-cluster-docker/lists"}