TLS provides Kafka protocol consumption functionality. You can use Flink's flink-connector-kafka plugin to connect to TLS and consume data from TLS into downstream big data components or data warehouses.
Scenario overview
Apache Flink is a distributed processing engine and framework for stateful computation on bounded and unbounded data streams. Flink provides the Apache Kafka connector (flink-connector-kafka) to read and write data in Kafka topics. TLS supports enabling Kafka protocol consumption functionality for specified log topics. Once enabled, Flink can consume log topics as Kafka topics, such as consuming them into downstream big data components or data warehouses. This is suitable for streaming computation or big data storage scenarios. Prerequisites
- A log project and log topic are created. For detailed instructions, see .
- Kafka protocol consumption functionality has been enabled for the specified log topic, and the Kafka protocol consumption topic ID has been obtained. For more details, see .
- We recommend using IAM users for access authorization. Before using an IAM user, ensure that the Volcanoengine primary account has created an IAM user and granted consumption-related permissions. For more details, see .
- Access Key for the current login account has been obtained. For more information, see Create Access Key.
Notice
Apache Flink has multiple built-in Kafka clients, and the client versions used may vary between different Flink distributions. Currently, TLS only supports Kafka client connections of version 0.11.x and above. The corresponding Flink version is 1.7.x and above. If you use Flink below 1.7.x, you need to manually specify the Kafka client version as 0.11.x or above.
Configuration steps
1. Add Maven dependencies
When consuming log data from the TLS log service of Volcano Engine using Flink, you need to use Flink's flink-connector-kafka as the connector.
Add the relevant Maven dependencies for flink-connector-kafka to your project.
The dependency details are as follows:
2. Configure Kafka source for Flink
The Kafka Source provides builder classes to create instances of KafkaSource. For usage and implementation details, see Flink. When building KafkaSource, you must specify the basic properties using the following methods.
The following code snippet demonstrates how to construct KafkaSource to consume log data from the TLS log topic "0fdaa6b6-3c9f-424c-8664-fc0d222c****".