내보내기를 위한 싱크 커넥터
싱크 커넥터를 사용해 Kafka 토픽의 데이터를 데이터베이스, 데이터 레이크 및 기타 대상에 내보내는 방법을 살펴봅니다.
내보내기를 위한 싱크 커넥터은(는) CoddyKit의 무료 Apache Kafka & Stream Processing Fundamentals 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Apache Kafka & Stream Processing Fundamentals 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Apache Kafka & Stream Processing Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Exporting Data from Kafka
Welcome to the final lesson on Kafka Connect! We've learned how to bring data into Kafka using Source Connectors. Now, let's explore how to get data out.
This lesson focuses on Sink Connectors, which are essential for moving data from your Kafka topics to external systems like databases, data warehouses, or analytics platforms.
Why Use Sink Connectors?
Imagine you have real-time data streaming into Kafka, but your business intelligence tools or legacy applications need that data in a different system.
- Integration: Connect Kafka to almost any data store.
- No Custom Code: Avoid writing complex consumer applications for common destinations.
- Reliability: Built-in fault tolerance and delivery guarantees.
- Scalability: Easily scale data export by adding more connector tasks.
How Sink Connectors Function
A Sink Connector acts like a specialized Kafka consumer. Here's the basic workflow:
- The connector runs within a Kafka Connect worker.
- It subscribes to one or more Kafka topics.
- It consumes messages from these topics.
- It transforms (if configured) and writes the data to the target external system.
- It manages Kafka offsets, ensuring data is processed reliably.
Common Sink Destinations
Kafka Connect offers a rich ecosystem of pre-built sink connectors for a wide variety of destinations. Some popular examples include:
- Databases: PostgreSQL, MySQL, Oracle, SQL Server (via JDBC)
- Cloud Storage: Amazon S3, Google Cloud Storage, Azure Blob Storage
- Search Engines: Elasticsearch, Solr
- Data Warehouses: Snowflake, Redshift
- Other Systems: HDFS, JMS queues, HTTP endpoints
Basic Sink Connector Configuration
Configuring a sink connector is similar to source connectors. You define its properties in a JSON file or directly via the Connect REST API. Key properties include:
name: Unique name for your connector.connector.class: The specific connector implementation (e.g.,JdbcSinkConnector).topicsortopics.regex: The Kafka topics to read from.key.converter&value.converter: How to deserialize data from Kafka.
Example: FileStreamSinkConnector
Let's look at a simple example: the FileStreamSinkConnector. This built-in connector writes data from a Kafka topic to a local file. It's great for observing how sink connectors work.
Here's a basic configuration JSON for it:
{ "name": "file-sink-connector",
"config": {
"connector.class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
"tasks.max": "1",
"topics": "my_test_topic",
"file": "/tmp/kafka-sink-output.txt",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.storage.StringConverter"
}
}Deploying a Sink Connector
Once you have your connector configuration (like the file-sink-config.json above), you deploy it to your Kafka Connect cluster using a curl command against the Connect REST API:
This command tells the Connect cluster to create and start a new connector instance based on your configuration.
curl -X POST -H "Content-Type: application/json" \
--data @file-sink-config.json \
http://localhost:8083/connectorsData Formats and Converters
When a sink connector reads data from Kafka, it uses converters to deserialize the message keys and values. Common converters include:
StringConverter: For plain text data.JsonConverter: For JSON formatted data.AvroConverter: For Avro-serialized data (often with Schema Registry).
The connector then takes this deserialized data and formats it appropriately for the target system (e.g., SQL INSERT statements for a database sink).
Ensuring Data Integrity
Kafka Connect sink connectors are designed for reliability:
- At-Least-Once Delivery: Most sink connectors guarantee that each message will be delivered to the destination at least once, even if failures occur.
- Offset Management: Connectors automatically commit offsets to Kafka, tracking what data has been successfully processed.
- Error Handling: Connectors can be configured to retry failed operations or send problematic messages to a Dead Letter Queue (DLQ) for later inspection.
Sink Connector Challenge
Let's check your understanding of Kafka Connect Sink Connectors!
Recap: Sink Connectors
Great job! You've now grasped the core concepts of Kafka Connect Sink Connectors.
- Sink Connectors export data from Kafka topics to various external systems.
- They provide a reliable, scalable, and code-free way to integrate Kafka with your data ecosystem.
- Configuration involves specifying the connector class, topics, and destination-specific properties.
- They handle data deserialization, formatting, and ensure delivery guarantees.
Kafka Connect significantly simplifies building robust data pipelines!
자주 묻는 질문
“내보내기를 위한 싱크 커넥터” 강의는 무료인가요?
네 — “내보내기를 위한 싱크 커넥터” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Apache Kafka & Stream Processing Fundamentals 강의 전체를 잠금 해제할 수 있습니다. Apache Kafka & Stream Processing Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.
“내보내기를 위한 싱크 커넥터”에서 뭘 배우나요?
싱크 커넥터를 사용해 Kafka 토픽의 데이터를 데이터베이스, 데이터 레이크 및 기타 대상에 내보내는 방법을 살펴봅니다. 브라우저에서 직접 실행하는 실습 코드로 Apache Kafka & Stream Processing Fundamentals을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Apache Kafka & Stream Processing Fundamentals을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Apache Kafka & Stream Processing Fundamentals은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“내보내기를 위한 싱크 커넥터” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Apache Kafka & Stream Processing Fundamentals 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Apache Kafka & Stream Processing Fundamentals 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Kafka Connect 소개
- 수집을 위한 소스 커넥터
- 내보내기를 위한 싱크 커넥터
- 단일 메시지 변환(SMT)