The kafka write mode buffers data in Kafka before writing it to ClickHouse. This mode is useful when you have a high volume of data and want to avoid overwhelming ClickHouse. This mode takes advantage of ClickHouse’s kafka table engine.
To set up Dittofeed with the kafka write mode, you can make use of the following environment variables:
# necessary to use the write modeWRITE_MODE=kafka# the kafka host and portnames to write toKAFKA_BROKERS=host1:port1,host2:port2# the username and password to use for the kafka connectionKAFKA_USERNAME=my-kafka-usernameKAFKA_PASSWORD=my-kafka-password# whether to use SSL for the kafka connectionKAFKA_SSL=true# the kafka sasl mechanism to use# possible values are: plain, scram-sha-256, scram-sha-512KAFKA_SASL_MECHANISM=plain# the number of partitions to use for the user events topic when bootstrappingKAFKA_USER_EVENTS_PARTITIONS=1# the replication factor to use for the user events topic when bootstrappingKAFKA_USER_EVENTS_REPLICATION_FACTOR=1# the name of the user events topic to create when bootstrappingUSER_EVENTS_TOPIC_NAME=dittofeed-user-events
When using Kafka with SASL authentication, ClickHouse requires additional configuration in its config file. Create or modify the ClickHouse configuration file to include SASL settings:
SASL authentication settings cannot be configured at the table level in ClickHouse and must be set in the server configuration file. ClickHouse requires a restart when SASL configuration changes.