- Documentation
Message Queue for Kafka
Quick Start
Connect instance
Connect to instance by using PLAINTEXT endpoint
Connect instance
Connect to instance by using PLAINTEXT endpoint
Connect to instance by using PLAINTEXT endpoint
This topic describes the steps to connect to a Kafka instance via the PLAINTEXT endpoint in a VPC network environment to generate and consume messages.
Background information
Message Queue for Kafka provides a common access method of PLAINTEXT protocol, i.e., the default endpoint. When connecting to the instance via the PLAINTEXT endpoint in a VPC network environment, no username or password is required. You can access the instance directly.
Prerequisites
- PLAINTEXT endpoint information including connection address and port number is obtained. For detailed information, refer to View endpoint.
- A Topic is created. For action steps, refer to Create Topic.
- VolcanoEngine ECS is purchased, with JDK successfully installed and environment variables configured. Kafka open-source clients are downloaded, such as Kafka 2.2.2 client.
Generate message
- Extract the Kafka client files.
- Open a terminal in the ./bin directory.
- Run the following command to start the producer and begin generating messages.
bash kafka-console-producer.sh --broker-list ${default endpoint} --topic ${Topic Name}
- Enter the message content to produce, and then press Enter to send the message to the Kafka instance.
- The content that is entered in each line will be packaged into a message and sent to the Kafka instance. To stop producing, use Ctrl+C to exit message production.
[root@kafkaecs bin]# bash kafka-console-producer.sh --broker-list kafka-cnngc7an0qpv****.kafka.ivolces.com:9092 --topic mytopic
>This is a Kafka message!
Consume messages
- Open another terminal and run the following command to consume messages.
- To stop consuming, use the Ctrl+C command to exit message consumption.
bash kafka-console-consumer.sh --bootstrap-server ${default endpoint} --topic ${Topic name} --group ${consumer group name} --from-beginning
- After successful operation, the consumer can receive messages sent by the producer. The messages are identical to the messages on the producer side.
[root@kafka bin]# bash kafka-console-consumer.sh --bootstrap-server kafka-cnngc7an0qpv****.kafka.ivolces.com:9092 --topic mytopic --group grouptest --from-beginning
This is a Kafka message!
^CProcessed a total of 2 messages
Last updated: 2025.08.08 18:39:48