tencent cloud

이 페이지는 현재 영어 만 지원하며보고있는 언어를 준비 중입니다.
关闭
전체 제품 문서
TDMQ for CKafka
Running Kafka Client (Optional)
마지막 업데이트 시간:2024-01-09 14:45:02
Running Kafka Client (Optional)
마지막 업데이트 시간: 2024-01-09 14:45:02

Overview

This document explains how to start using Kafka APIs after you purchase the CKafka service. After setting up a CKafka environment on a CVM instance, you need to download and decompress the Kafka installation file and perform simple testing on Kafka APIs.

Directions

Step 1. Install a JDK.

1. Check Java installation.

Open a terminal window and run this command:
java -version
If the output of the command is a Java version number, then Java is already installed in your system. If you have not installed Java yet, download and install a Java Development Kit (JDK).

2. Set up the Java environment.

Set the JAVA_HOME environment variable and point it to the Java installation directory on your machine.
For example, if you use Java JDK 1.8.0_20, the outputs on different operating systems are as follows:
Supported Operating Systems
Output
Windows
Set the environment variable JAVA_HOME to
C:\Program Files\Java\jdkjdk1.8.0_20
Linux
export JAVA_HOME=/usr/local/java-current
Mac OSX
export JAVA_HOME=/Library/Java/Home
Add the Java compiler path to the system path:
Supported Operating Systems
Output
Windows
Add ;C:\Program Files\Java\jdk1.8.0_20\bin to the end of the system variable Path
Linux
export PATH=$PATH:$JAVA_HOME/bin/
Mac OSX
not required
Use the java -version command to check your Java installation.

Step 2. Download the Kafka installation file.

Download and decompress the Kafka installation file.

Step 3. Test Kafka APIs.

Go to the ./bin directory, and produce and consume a message via CLI commands.
1. Open a terminal window to start a consumer.
bash kafka-console-consumer.sh --bootstrap-server XXXX:port --topic XXXX --consumer.config ../config/consumer.properties
Note:
Replace XXXX:port with the domain name and port for VPC access, which can be obtained in the Access Mode section on the Instance Details page in the console.

topic: replace XXXX with the topic name, which can be obtained on the Topic Management page in the console.
2. Open another terminal window to start a producer.
bash kafka-console-producer.sh --broker-list XXXX:port --topic XXXX --producer.config ../config/producer.properties
Note:
Replace XXXX:port with the domain name and port for VPC access, which can be obtained in the Access Mode section on the Instance Details page in the console.

topic: replace XXXX with the topic name, which can be obtained on the Topic Management page in the console.
Enter the content of the message and press Enter.
Producing a message:

Consuming a message:

3. In the message querying page of the CKafka console, query the message sent.

The details of the message are as follows:


문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백

문의하기

고객의 업무에 전용 서비스를 제공해드립니다.

기술 지원

더 많은 도움이 필요하시면, 티켓을 통해 연락 바랍니다. 티켓 서비스는 연중무휴 24시간 제공됩니다.

연중무휴 24시간 전화 지원
中国香港
+852 800 906 020 (免费)
美国
+1 844 606 0804 (免费)
英国
+44 808 196 4551 (免费)
加拿大
+1 888 605 7930 (免费)
澳大利亚
+61 1300 986 386 (免费)
EdgeOne 热线
+852 300 80699
更多本地服务热线陆续新增中