mirror of
https://github.com/outbackdingo/clickhouse-cluster-example.git
synced 2026-01-27 02:18:28 +00:00
Update
This commit is contained in:
44
config_1.xml
44
config_1.xml
@@ -115,48 +115,14 @@
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
<remote_servers>
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse3</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse4</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
</remote_servers>
|
||||
<remote_servers incl="clickhouse_remote_servers" />
|
||||
|
||||
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
|
||||
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
|
||||
Values for substitutions are specified in /yandex/name_of_substitution elements in that file.
|
||||
-->
|
||||
|
||||
<zookeeper>
|
||||
<node index="1">
|
||||
<host>zoo1</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="2">
|
||||
<host>zoo2</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
</zookeeper>
|
||||
<zookeeper incl="clickhouse_zookeeper_servers" optional="true" />
|
||||
|
||||
<!-- Substitutions for parameters of replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
@@ -164,10 +130,12 @@
|
||||
See https://clickhouse.yandex/reference_en.html#Creating%20replicated%20tables
|
||||
-->
|
||||
<macros>
|
||||
<shard>01</shard>
|
||||
<replica>01</replica>
|
||||
<shard>shard_01</shard>
|
||||
<replica>replica_01</replica>
|
||||
</macros>
|
||||
|
||||
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
|
||||
|
||||
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
|
||||
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
|
||||
|
||||
|
||||
44
config_2.xml
44
config_2.xml
@@ -114,48 +114,14 @@
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
<remote_servers>
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse3</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse4</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
</remote_servers>
|
||||
<remote_servers incl="clickhouse_remote_servers" />
|
||||
|
||||
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
|
||||
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
|
||||
Values for substitutions are specified in /yandex/name_of_substitution elements in that file.
|
||||
-->
|
||||
|
||||
<zookeeper>
|
||||
<node index="1">
|
||||
<host>zoo1</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="2">
|
||||
<host>zoo2</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
</zookeeper>
|
||||
<zookeeper incl="clickhouse_zookeeper_servers" optional="true" />
|
||||
|
||||
<!-- Substitutions for parameters of replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
@@ -163,10 +129,12 @@
|
||||
See https://clickhouse.yandex/reference_en.html#Creating%20replicated%20tables
|
||||
-->
|
||||
<macros>
|
||||
<shard>01</shard>
|
||||
<replica>02</replica>
|
||||
<shard>shard_01</shard>
|
||||
<replica>replica_02</replica>
|
||||
</macros>
|
||||
|
||||
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
|
||||
|
||||
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
|
||||
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
|
||||
|
||||
|
||||
48
config_3.xml
48
config_3.xml
@@ -47,7 +47,7 @@
|
||||
<tcp_port>9000</tcp_port>
|
||||
|
||||
<!-- Port for communication between replicas. Used for data exchange. -->
|
||||
<interserver_http_port>9011</interserver_http_port>
|
||||
<interserver_http_port>9010</interserver_http_port>
|
||||
|
||||
<!-- Hostname that is used by other replicas to request this server.
|
||||
If not specified, than it is determined analoguous to 'hostname -f' command.
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. -->
|
||||
<listen_host>::</listen_host>
|
||||
<!--<listen_host>::1</listen_host>-->
|
||||
<!--<listen_host>::</listen_host>-->
|
||||
<listen_host>127.0.0.1</listen_host>
|
||||
|
||||
<max_connections>4096</max_connections>
|
||||
@@ -114,48 +114,14 @@
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
<remote_servers>
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse3</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse4</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
</remote_servers>
|
||||
<remote_servers incl="clickhouse_remote_servers" />
|
||||
|
||||
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
|
||||
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
|
||||
Values for substitutions are specified in /yandex/name_of_substitution elements in that file.
|
||||
-->
|
||||
|
||||
<zookeeper>
|
||||
<node index="1">
|
||||
<host>zoo1</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="2">
|
||||
<host>zoo2</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
</zookeeper>
|
||||
<zookeeper incl="clickhouse_zookeeper_servers" optional="true" />
|
||||
|
||||
<!-- Substitutions for parameters of replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
@@ -163,10 +129,12 @@
|
||||
See https://clickhouse.yandex/reference_en.html#Creating%20replicated%20tables
|
||||
-->
|
||||
<macros>
|
||||
<shard>02</shard>
|
||||
<replica>01</replica>
|
||||
<shard>shard_02</shard>
|
||||
<replica>replica_01</replica>
|
||||
</macros>
|
||||
|
||||
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
|
||||
|
||||
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
|
||||
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
|
||||
|
||||
|
||||
48
config_4.xml
48
config_4.xml
@@ -47,7 +47,7 @@
|
||||
<tcp_port>9000</tcp_port>
|
||||
|
||||
<!-- Port for communication between replicas. Used for data exchange. -->
|
||||
<interserver_http_port>9011</interserver_http_port>
|
||||
<interserver_http_port>9010</interserver_http_port>
|
||||
|
||||
<!-- Hostname that is used by other replicas to request this server.
|
||||
If not specified, than it is determined analoguous to 'hostname -f' command.
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. -->
|
||||
<listen_host>::</listen_host>
|
||||
<!--<listen_host>::1</listen_host>-->
|
||||
<!--<listen_host>::</listen_host>-->
|
||||
<listen_host>127.0.0.1</listen_host>
|
||||
|
||||
<max_connections>4096</max_connections>
|
||||
@@ -114,48 +114,14 @@
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
<remote_servers>
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse3</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse4</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
</remote_servers>
|
||||
<remote_servers incl="clickhouse_remote_servers" />
|
||||
|
||||
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
|
||||
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
|
||||
Values for substitutions are specified in /yandex/name_of_substitution elements in that file.
|
||||
-->
|
||||
|
||||
<zookeeper>
|
||||
<node index="1">
|
||||
<host>zoo1</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="2">
|
||||
<host>zoo2</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
</zookeeper>
|
||||
<zookeeper incl="clickhouse_zookeeper_servers" optional="true" />
|
||||
|
||||
<!-- Substitutions for parameters of replicated tables.
|
||||
Optional. If you don't use replicated tables, you could omit that.
|
||||
@@ -163,10 +129,12 @@
|
||||
See https://clickhouse.yandex/reference_en.html#Creating%20replicated%20tables
|
||||
-->
|
||||
<macros>
|
||||
<shard>02</shard>
|
||||
<replica>02</replica>
|
||||
<shard>shard_02</shard>
|
||||
<replica>replica_02</replica>
|
||||
</macros>
|
||||
|
||||
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
|
||||
|
||||
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
|
||||
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
|
||||
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
version: '3'
|
||||
|
||||
networks:
|
||||
ck_cluster:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.50.0.0/24
|
||||
|
||||
services:
|
||||
haproxy:
|
||||
image: haproxy:latest
|
||||
@@ -14,8 +7,6 @@ services:
|
||||
- "9001:9000"
|
||||
volumes:
|
||||
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
|
||||
networks:
|
||||
- ck_cluster
|
||||
depends_on:
|
||||
- clickhouse1
|
||||
- clickhouse2
|
||||
@@ -30,9 +21,7 @@ services:
|
||||
- "3888"
|
||||
environment:
|
||||
ZOO_MY_ID: "1"
|
||||
ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181
|
||||
networks:
|
||||
- ck_cluster
|
||||
ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
|
||||
|
||||
zoo2:
|
||||
image: zookeeper:latest
|
||||
@@ -42,21 +31,30 @@ services:
|
||||
- "3888"
|
||||
environment:
|
||||
ZOO_MY_ID: "2"
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181
|
||||
networks:
|
||||
- ck_cluster
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zoo3:2888:3888;2181
|
||||
|
||||
zoo3:
|
||||
image: zookeeper:latest
|
||||
expose:
|
||||
- "2181"
|
||||
- "2888"
|
||||
- "3888"
|
||||
environment:
|
||||
ZOO_MY_ID: "3"
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181
|
||||
|
||||
clickhouse1:
|
||||
image: yandex/clickhouse-server:19.15.3.6
|
||||
hostname: clickhouse1
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
volumes:
|
||||
- ./config_1.xml:/etc/clickhouse-server/config.xml
|
||||
networks:
|
||||
- ck_cluster
|
||||
- ./metrika.xml:/etc/clickhouse-server/metrika.xml
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
@@ -64,15 +62,16 @@ services:
|
||||
|
||||
clickhouse2:
|
||||
image: yandex/clickhouse-server:19.15.3.6
|
||||
hostname: clickhouse2
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
volumes:
|
||||
- ./config_2.xml:/etc/clickhouse-server/config.xml
|
||||
networks:
|
||||
- ck_cluster
|
||||
- ./metrika.xml:/etc/clickhouse-server/metrika.xml
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
@@ -80,15 +79,16 @@ services:
|
||||
|
||||
clickhouse3:
|
||||
image: yandex/clickhouse-server:19.15.3.6
|
||||
hostname: clickhouse3
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
volumes:
|
||||
- ./config_3.xml:/etc/clickhouse-server/config.xml
|
||||
networks:
|
||||
- ck_cluster
|
||||
- ./metrika.xml:/etc/clickhouse-server/metrika.xml
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
@@ -96,15 +96,16 @@ services:
|
||||
|
||||
clickhouse4:
|
||||
image: yandex/clickhouse-server:19.15.3.6
|
||||
hostname: clickhouse4
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
volumes:
|
||||
- ./config_4.xml:/etc/clickhouse-server/config.xml
|
||||
networks:
|
||||
- ck_cluster
|
||||
- ./metrika.xml:/etc/clickhouse-server/metrika.xml
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
|
||||
43
metrika.xml
Normal file
43
metrika.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<yandex>
|
||||
<clickhouse_remote_servers>
|
||||
<ck_cluster>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
<shard>
|
||||
<internal_replication>true</internal_replication>
|
||||
<replica>
|
||||
<host>clickhouse3</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>clickhouse4</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</ck_cluster>
|
||||
</clickhouse_remote_servers>
|
||||
|
||||
<clickhouse_zookeeper_servers>
|
||||
<node index="1">
|
||||
<host>zoo1</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="2">
|
||||
<host>zoo2</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
<node index="3">
|
||||
<host>zoo3</host>
|
||||
<port>2181</port>
|
||||
</node>
|
||||
</clickhouse_zookeeper_servers>
|
||||
</yandex>
|
||||
Reference in New Issue
Block a user