Skip to content

Commit

Permalink
add clickhouse docker & configs
Browse files Browse the repository at this point in the history
  • Loading branch information
RebelRaider committed Jul 22, 2024
1 parent 6a4e868 commit 324eadf
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
37 changes: 37 additions & 0 deletions clickhouse/clickhouse-config/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<yandex>
<!-- Configuration file for ClickHouse -->
<logger>
<level>trace</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
</logger>

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

<path>/var/lib/clickhouse/</path>
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
<format_schema_path>/var/lib/clickhouse/format_schemas/</format_schema_path>

<!-- Network Configuration -->
<listen_host>::</listen_host>

<!-- Extra Configuration -->
<listen_try>0.0.0.0</listen_try>
<listen_try>127.0.0.1</listen_try>

<compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
</case>
</compression>

<zookeeper>
<node index="1">
<host>localhost</host>
<port>2181</port>
</node>
</zookeeper>
</yandex>
22 changes: 22 additions & 0 deletions clickhouse/clickhouse-config/users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<yandex>
<profiles>
<default>
<!-- Keep the default profile settings here -->
<allow_introspection_functions>1</allow_introspection_functions>
</default>
</profiles>
<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
<access_management>1</access_management> <!-- Enable access management -->
</default>
</users>
<quotas>
<default></default>
</quotas>
</yandex>
16 changes: 16 additions & 0 deletions clickhouse/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'

services:
clickhouse:
image: yandex/clickhouse-server:latest
container_name: clickhouse-server
ports:
- "8123:8123" # HTTP interface
- "9000:9000" # Native TCP interface
volumes:
- clickhouse_data:/var/lib/clickhouse
- ./init-clickhouse.sql:/docker-entrypoint-initdb.d/init-clickhouse.sql
- ./clickhouse-config/users.xml:/etc/clickhouse-server/users.d/users.xml

volumes:
clickhouse_data:
5 changes: 5 additions & 0 deletions clickhouse/init-clickhouse.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE DATABASE IF NOT EXISTS test_db;

CREATE USER IF NOT EXISTS test_user IDENTIFIED WITH plaintext_password BY 'test_password';

GRANT ALL ON test_db.* TO test_user;

0 comments on commit 324eadf

Please sign in to comment.