> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrating Kafka with ClickHouse

> Introduction to Kafka with ClickHouse

[Apache Kafka](https://kafka.apache.org/) is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. ClickHouse provides multiple options to **read from** and **write to** Kafka and other Kafka API-compatible brokers (e.g., Redpanda, Amazon MSK).

## Available options

Choosing the right option for your use case depends on multiple factors, including your ClickHouse deployment type, data flow direction and operational requirements.

| Option | Deployment type | Fully managed | Kafka to ClickHouse | ClickHouse to Kafka |
| - | - | :-: | :-: | :-: |
| [ClickPipes for Kafka](https://clickhouse.com/docs/integrations/clickpipes/kafka/index.md) | [Cloud], [BYOC] (coming soon!) | ✅ | ✅ | |
| [Kafka Connect Sink](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-clickhouse-connect-sink.md) | [Cloud], [BYOC], [Self-hosted] | | ✅ | |
| [Kafka table engine](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md) | [Cloud], [BYOC], [Self-hosted] | | ✅ | ✅ |

For a more detailed comparison between these options, see [Choosing an option](#choosing-an-option).

### ClickPipes for Kafka

[ClickPipes](https://clickhouse.com/docs/integrations/clickpipes/home.md) is a managed integration platform that makes ingesting data from a diverse set of sources as simple as clicking a few buttons. Because it is fully managed and purpose-built for production workloads, ClickPipes significantly lowers infrastructure and operational costs, removing the need for external data streaming and ETL tools.

> [!TIP]
>
> This is the recommended option if you're a ClickHouse Cloud user. ClickPipes is **fully managed** and purpose-built to deliver the **best performance** in Cloud environments.

#### Main features

* Optimized for ClickHouse Cloud, delivering blazing-fast performance
* Horizontal and vertical scalability for high-throughput workloads
* Built-in fault tolerance with configurable replicas and automatic retries
* Deployment and management via ClickHouse Cloud UI, [Open API](https://clickhouse.com/docs/integrations/clickpipes/programmatic-access/openapi.md), or [Terraform](https://clickhouse.com/docs/integrations/clickpipes/programmatic-access/terraform.md)
* Enterprise-grade security with support for cloud-native authorization (IAM) and private connectivity (PrivateLink)
* Supports a wide range of [data sources](https://clickhouse.com/docs/integrations/clickpipes/kafka/reference.md), including Confluent Cloud, Amazon MSK, Redpanda Cloud, and Azure Event Hubs
* Supports most common serialization formats (JSON, Avro, Protobuf)

#### Getting started

To get started using ClickPipes for Kafka, see the [reference documentation](https://clickhouse.com/docs/integrations/clickpipes/kafka/reference.md) or navigate to the `Data Sources` tab in the ClickHouse Cloud UI.

### Kafka Connect Sink

Kafka Connect is an open-source framework that works as a centralized data hub for simple data integration between Kafka and other data systems. The [ClickHouse Kafka Connect Sink](https://github.com/ClickHouse/clickhouse-kafka-connect) connector provides a scalable and highly-configurable option to read data from Apache Kafka and other Kafka API-compatible brokers.

> [!TIP]
>
> This is the recommended option if you prefer **high configurability** or are already a Kafka Connect user.

#### Main features

* Can be configured to support exactly-once semantics
* Supports most common serialization formats (JSON, Avro, Protobuf)
* Tested continuously against ClickHouse Cloud

#### Getting started

To get started using the ClickHouse Kafka Connect Sink, see the [reference documentation](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-clickhouse-connect-sink.md).

### Kafka table engine

The [Kafka table engine](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md) can be used to read data from and write data to Apache Kafka and other Kafka API-compatible brokers. This option is bundled with open-source ClickHouse and is available across all deployment types.

> [!TIP]
>
> This is the recommended option if you're self-hosting ClickHouse and need a **low entry barrier** option, or if you need to **write** data to Kafka.

#### Main features

* Can be used for [reading](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md#kafka-to-clickhouse) and [writing](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md#clickhouse-to-kafka) data
* Bundled with open-source ClickHouse
* Supports most common serialization formats (JSON, Avro, Protobuf)

#### Getting started

To get started using the Kafka table engine, see the [reference documentation](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md).

### Choosing an option

| Product | Strengths | Weaknesses |
| - | - | - |
| **ClickPipes for Kafka** | • Scalable architecture for high throughput and low latency • Built-in monitoring and schema management • Private networking connections (via PrivateLink) • Supports SSL/TLS authentication and IAM authorization • Supports programmatic configuration (Terraform, API endpoints) | • Doesn't support pushing data to Kafka • At-least-once semantics |
| **Kafka Connect Sink** | • Exactly-once semantics • Allows granular control over data transformation, batching and error handling • Can be deployed in private networks • Allows real-time replication from databases not yet supported in ClickPipes via Debezium | • Doesn't support pushing data to Kafka • Operationally complex to set up and maintain • Requires Kafka and Kafka Connect expertise |
| **Kafka table engine** | • Supports [pushing data to Kafka](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-table-engine.md#clickhouse-to-kafka) • Operationally simple to set up | • At-least-once semantics • Limited horizontal scaling for consumers. Can't be scaled independently from the ClickHouse server • Limited error handling and debugging options • Requires Kafka expertise |

### Other options

* [**Confluent**](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/confluent/index.md) - On Confluent Cloud, use the [fully managed ClickHouse Connector Sink](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/confluent/confluent-cloud.md) or upload it yourself as a [Custom Connector](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/confluent/custom-connector.md). You can also use the [HTTP Sink Connector](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/confluent/kafka-connect-http.md), self-managed or fully managed on Confluent Cloud, to integrate Apache Kafka with an API via HTTP or HTTPS.

* [**Vector**](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-vector.md) - Vector is a vendor-agnostic data pipeline. With the ability to read from Kafka, and send events to ClickHouse, this represents a robust integration option.

* [**JDBC Connect Sink**](https://clickhouse.com/docs/integrations/connectors/data-ingestion/kafka/kafka-connect-jdbc.md) - The Kafka Connect JDBC Sink connector allows you to export data from Kafka topics to any relational database with a JDBC driver.

* **Custom code** - Custom code using Kafka and ClickHouse [client libraries](https://clickhouse.com/docs/integrations/language-clients/index.md) may be appropriate in cases where custom processing of events is required.

[BYOC]: https://clickhouse.com/docs/products/cloud/guides/infrastructure/deployment-options/byoc/overview.md

[Cloud]: https://clickhouse.com/docs/products/cloud/getting-started/cloud-get-started.md

[Self-hosted]: https://clickhouse.com/docs/get-started/about/intro.md
