CKafka allows you to dump messages to another CKafka cluster to sync data between CKafka clusters.
Currently, this feature relies on the SCF and CKafka services, which should be activated first before you can use this feature.
Message dump to CKafka will be performed with the CKafka trigger in SCF to sync messages to another CKafka cluster.
In the general creation process, dump cannot be performed directly across regions or in self-built Kafka. For such dump, you need to configure the network or delivery information for the function. The cross-region dump process is as follows:
Create a CKafka dump template, go to the SCF console, and configure the delivery instance and topic as needed.
Modify Environment Variable and Network settings in the function configuration.
Environment variable configuration description:
kafka_address: Kafka IP address.
kafka_topic_name: Kafka topic name.
Note:
- To dump CKafka data across regions, simply modify the relevant environment variables. You need to configure a peering connection for VPC.
- For a CVM-based self-built Kafka instance, you need to change them to the VPC and Kafka topic of the instance.
- For other self-built Kafka instances, you need to change the IP and topic in the environment variable to the information of the instance. If there is no Direct Connect, data needs to be transferred over the SCF public network.
Save the configurations and enable the dump feature.
SCF supports two CKafka access methods: PLAINTEXT
and SASL_PLAINTEXT
, which can be modified in the SCF code.
PLAINTEXT
access method:
kafka_to_kafka = KafkaToKafka(kafka_address)
SASL_PLAINTEXT
access method:
kafka_to_kafka= KafkaToKafka(
kafka_address
security_protocol = "SASL_PLAINTEXT",
sasl_mechanism="PLAIN",
sasl_plain_username="ckafka-80o10xxx#Taborxx",
sasl_plain_password="Taborxxxx",
api_version=(0, 10, 2)
)
Note:
sasl_plain_username
consists of Instance ID and username concatenated with #.
CKafka dump capabilities are implemented based on SCF, and you can find relevant dump information and status in the SCF log.
CKafkaToCKafka
scheme uses the CKafka trigger. For more information on related settings such as retry policy and maximum number of messages, see CKafka Trigger.offset
and msgBody
data of the CKafka trigger by default. If you want to process the logic by yourself, see Event Message Structure for CKafka Trigger.
Was this page helpful?