Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Sync with upstream #7

Merged
merged 22 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .docker/clickhouse/cluster/server1_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0"?>
<clickhouse>

<http_port>8123</http_port>
<interserver_http_port>9009</interserver_http_port>
<interserver_http_host>clickhouse1</interserver_http_host>

<users_config>users.xml</users_config>
<default_profile>default</default_profile>
<default_database>default</default_database>

<mark_cache_size>5368709120</mark_cache_size>

<path>/var/lib/clickhouse/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
<keep_alive_timeout>3</keep_alive_timeout>

<logger>
<level>debug</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
<console>1</console>
</logger>

<remote_servers>
<test_cluster>
<shard>
<replica>
<host>clickhouse1</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse2</host>
<port>9000</port>
</replica>
</shard>
</test_cluster>
</remote_servers>

<keeper_server>
<tcp_port>9181</tcp_port>
<server_id>1</server_id>
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>

<coordination_settings>
<operation_timeout_ms>10000</operation_timeout_ms>
<session_timeout_ms>30000</session_timeout_ms>
<raft_logs_level>trace</raft_logs_level>
<rotate_log_storage_interval>10000</rotate_log_storage_interval>
</coordination_settings>

<raft_configuration>
<server>
<id>1</id>
<hostname>clickhouse1</hostname>
<port>9000</port>
</server>
<server>
<id>2</id>
<hostname>clickhouse2</hostname>
<port>9000</port>
</server>
</raft_configuration>
</keeper_server>

<zookeeper>
<node>
<host>clickhouse1</host>
<port>9181</port>
</node>
<node>
<host>clickhouse2</host>
<port>9181</port>
</node>
</zookeeper>

<macros>
<cluster>test_cluster</cluster>
<replica>clickhouse1</replica>
<shard>1</shard>
</macros>

<distributed_ddl>
<path>/clickhouse/test_cluster/task_queue/ddl</path>
</distributed_ddl>

<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
</query_log>

<http_options_response>
<header>
<name>Access-Control-Allow-Origin</name>
<value>*</value>
</header>
<header>
<name>Access-Control-Allow-Headers</name>
<value>accept, origin, x-requested-with, content-type, authorization</value>
</header>
<header>
<name>Access-Control-Allow-Methods</name>
<value>POST, GET, OPTIONS</value>
</header>
<header>
<name>Access-Control-Max-Age</name>
<value>86400</value>
</header>
</http_options_response>
</clickhouse>
117 changes: 117 additions & 0 deletions .docker/clickhouse/cluster/server2_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0"?>
<clickhouse>

<http_port>8123</http_port>
<interserver_http_port>9009</interserver_http_port>
<interserver_http_host>clickhouse2</interserver_http_host>

<users_config>users.xml</users_config>
<default_profile>default</default_profile>
<default_database>default</default_database>

<mark_cache_size>5368709120</mark_cache_size>

<path>/var/lib/clickhouse/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
<keep_alive_timeout>3</keep_alive_timeout>

<logger>
<level>debug</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
<console>1</console>
</logger>

<remote_servers>
<test_cluster>
<shard>
<replica>
<host>clickhouse1</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse2</host>
<port>9000</port>
</replica>
</shard>
</test_cluster>
</remote_servers>

<keeper_server>
<tcp_port>9181</tcp_port>
<server_id>2</server_id>
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>

<coordination_settings>
<operation_timeout_ms>10000</operation_timeout_ms>
<session_timeout_ms>30000</session_timeout_ms>
<raft_logs_level>trace</raft_logs_level>
<rotate_log_storage_interval>10000</rotate_log_storage_interval>
</coordination_settings>

<raft_configuration>
<server>
<id>1</id>
<hostname>clickhouse1</hostname>
<port>9000</port>
</server>
<server>
<id>2</id>
<hostname>clickhouse2</hostname>
<port>9000</port>
</server>
</raft_configuration>
</keeper_server>

<zookeeper>
<node>
<host>clickhouse1</host>
<port>9181</port>
</node>
<node>
<host>clickhouse2</host>
<port>9181</port>
</node>
</zookeeper>

<macros>
<cluster>test_cluster</cluster>
<replica>clickhouse2</replica>
<shard>1</shard>
</macros>

<distributed_ddl>
<path>/clickhouse/test_cluster/task_queue/ddl</path>
</distributed_ddl>

<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
</query_log>

<http_options_response>
<header>
<name>Access-Control-Allow-Origin</name>
<value>*</value>
</header>
<header>
<name>Access-Control-Allow-Headers</name>
<value>accept, origin, x-requested-with, content-type, authorization</value>
</header>
<header>
<name>Access-Control-Allow-Methods</name>
<value>POST, GET, OPTIONS</value>
</header>
<header>
<name>Access-Control-Max-Age</name>
<value>86400</value>
</header>
</http_options_response>
</clickhouse>
54 changes: 54 additions & 0 deletions .docker/clickhouse/single/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0"?>
<clickhouse>

<http_port>8123</http_port>
<tcp_port>9000</tcp_port>

<users_config>users.xml</users_config>
<default_profile>default</default_profile>
<default_database>default</default_database>

<mark_cache_size>5368709120</mark_cache_size>

<path>/var/lib/clickhouse/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
<keep_alive_timeout>3</keep_alive_timeout>

<logger>
<level>debug</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
<console>1</console>
</logger>

<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
</query_log>

<http_options_response>
<header>
<name>Access-Control-Allow-Origin</name>
<value>*</value>
</header>
<header>
<name>Access-Control-Allow-Headers</name>
<value>accept, origin, x-requested-with, content-type, authorization</value>
</header>
<header>
<name>Access-Control-Allow-Methods</name>
<value>POST, GET, OPTIONS</value>
</header>
<header>
<name>Access-Control-Max-Age</name>
<value>86400</value>
</header>
</http_options_response>

</clickhouse>
34 changes: 34 additions & 0 deletions .docker/clickhouse/users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<clickhouse>

<profiles>
<default>
<load_balancing>random</load_balancing>
</default>
</profiles>

<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
<access_management>1</access_management>
</default>
</users>

<quotas>
<default>
<interval>
<duration>3600</duration>
<queries>0</queries>
<errors>0</errors>
<result_rows>0</result_rows>
<read_rows>0</read_rows>
<execution_time>0</execution_time>
</interval>
</default>
</quotas>
</clickhouse>
52 changes: 52 additions & 0 deletions .docker/docker-compose.cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3.5'

services:
clickhouse1:
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
ulimits:
nofile:
soft: 262144
hard: 262144
hostname: clickhouse1
container_name: clickhouse-activerecord-clickhouse-server-1
ports:
- '8124:8123'
- '9001:9000'
volumes:
- './clickhouse/cluster/server1_config.xml:/etc/clickhouse-server/config.xml'
- './clickhouse/users.xml:/etc/clickhouse-server/users.xml'
healthcheck:
test: bash -c "exec 6<> /dev/tcp/localhost/8123"
interval: 5s

clickhouse2:
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
ulimits:
nofile:
soft: 262144
hard: 262144
hostname: clickhouse2
container_name: clickhouse-activerecord-clickhouse-server-2
ports:
- '8125:8123'
volumes:
- './clickhouse/cluster/server2_config.xml:/etc/clickhouse-server/config.xml'
- './clickhouse/users.xml:/etc/clickhouse-server/users.xml'
healthcheck:
test: bash -c "exec 6<> /dev/tcp/localhost/8123"
interval: 5s

# Using Nginx as a cluster entrypoint and a round-robin load balancer for HTTP requests
nginx:
image: 'nginx:1.23.1-alpine'
hostname: nginx
ports:
- '28123:8123'
volumes:
- './nginx/local.conf:/etc/nginx/conf.d/local.conf'
container_name: clickhouse-activerecord-nginx
depends_on:
clickhouse1:
condition: service_healthy
clickhouse2:
condition: service_healthy
17 changes: 17 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'
services:
clickhouse:
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-23.11-alpine}'
container_name: 'clickhouse-activerecord-clickhouse-server'
ports:
- '18123:8123'
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- './clickhouse/single/config.xml:/etc/clickhouse-server/config.xml'
- './clickhouse/users.xml:/etc/clickhouse-server/users.xml'
healthcheck:
test: bash -c "exec 6<> /dev/tcp/localhost/8123"
interval: 5s
Loading
Loading