Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit f20d037

Browse files
Merge pull request #29 from arruzk/kafka_config
Kafka configuration
2 parents 8efafb4 + 568ffab commit f20d037

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,22 @@ F: Flag for remove clickhouse from host(disabled by default)
138138
clickhouse_remove: no
139139
```
140140
141+
F: You can manage [Kafka configuration](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/#configuration)
142+
```yaml
143+
# global configuration
144+
clickhouse_kafka_config:
145+
auto_offset_reset: smallest
146+
debug: cgrp
147+
# topic-level configuration
148+
clickhouse_kafka_topics_config:
149+
topic1:
150+
retry_backoff_ms: 250
151+
fetch_min_bytes: 100000
152+
topic2:
153+
retry_backoff_ms: 300
154+
fetch_min_bytes: 120000
155+
```
156+
141157
Example Playbook
142158
----------------
143159

defaults/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,8 @@ clickhouse_path_user_files: "{{ clickhouse_path_base }}/clickhouse/user_files/"
8888

8989
clickhouse_mlock_status: false
9090

91-
max_partitions_per_insert_block: 100
91+
max_partitions_per_insert_block: 100
92+
93+
clickhouse_kafka_config: []
94+
95+
clickhouse_kafka_topics_config: []

templates/config.j2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#jinja2: trim_blocks: True, lstrip_blocks: True
12
<?xml version="1.0"?>
23
<!-- {{ ansible_managed }} -->
34
<yandex>
@@ -359,4 +360,22 @@
359360

360361
<!-- Uncomment to disable ClickHouse internal DNS caching. -->
361362
<!-- <disable_internal_dns_cache>1</disable_internal_dns_cache> -->
363+
364+
{% if clickhouse_kafka_config is defined %}
365+
<kafka>
366+
{% for config in clickhouse_kafka_config %}
367+
<{{ config }}>{{ clickhouse_kafka_config[config] }}</{{ config }}>
368+
{% endfor %}
369+
</kafka>
370+
{% endif %}
371+
372+
{% for kafka_topic in clickhouse_kafka_topics_config %}
373+
<kafka_{{ kafka_topic }}>
374+
{% for item in clickhouse_kafka_topics_config[kafka_topic] %}
375+
<{{ item }}>{{ clickhouse_kafka_topics_config[kafka_topic][item] }}</{{ item }}>
376+
{% endfor %}
377+
</kafka_{{ kafka_topic }}>
378+
379+
{% endfor %}
380+
362381
</yandex>

0 commit comments

Comments
 (0)