- Product Bulletin
- Service Overview
-
User Guide
- Usage Overview
- Selecting HCE as the Public Image When Creating an ECS
- Changing an OS to HCE
- Migrating an OS
- Upgrading HCE and RPM Packages
- Security Updates for HCE
- Obtaining the openEuler Extended Software Packages
- Creating a Docker Image and Starting a Container
- Tools
- Kernel Functions and Interfaces
- xGPU
- Configuring the Repositories and Installing Software for HCE
-
FAQs
- What Do I Do If CentOS Linux Is No Longer Maintained?
- Does Huawei Cloud Have a Migration Solution for CentOS?
- How Do I Install the MLNX Driver?
- How Do I Enable SELinux on an ECS Running HCE?
- How Do I Change the OS Name on the Console After the OS Is Migrated?
- How Are Huawei Cloud EulerOS, EulerOS, and openEuler Different from One Another?
- How Do I Enable WireGuard in Kernel and Install wireguard-tools?
- How Do I Save the User Credential Information for Logging In to Docker Like What Docker CE Does?
- What Is OOM? Why Does OOM Occur?
- How Do I Handle IPVS Errors?
- Why Can't HCE Obtain an IPv6 Address After IPv6 Is Enabled for an ECS?
- How Do I Set Auto Log Using TMOUT?
- Best Practices
- General Reference
Show all
Copied.
Installing Kafka
Introduction
Kafka is distributed pub/sub messaging middleware with high throughput, data persistence, horizontal scalability, and stream data processing. Common applications include log collection, data streaming, online/offline system analytics, and real-time monitoring.
This tutorial describes how you can deploy Kafka in HCE 2.0.
Preparations
- Prepare an ECS and assign a public IP address or EIP to the ECS.
- Ensure that inbound security group rules allow traffic to flow to the ECS over port 9092.
Procedure
- Install Kafka.
Run the following command to install Kafka:
dnf install kafka
After the command is executed, Kafka is installed in the /opt/kafka directory.
- Configure Kafka.
- Open the /opt/kafka/config/server.properties file and modify the following attributes:
listeners=PLAINTEXT://<Private IP address>:9092 advertised.listeners=PLAINTEXT://<Public IP address>:9092
- Create the /lib/systemd/system/zookeeper.service file and enter the following information:
[Unit] Description=Zookeeper service After=network.target [Service] Type=simple Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" User=root Group=root ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh Restart=on-failure SuccessExitStatus=143 [Install] WantedBy=multi-user.target
- Create the /lib/systemd/system/kafka.service file and enter the following information:
[Unit] Description=Apache Kafka server (broker) After=network.target zookeeper.service [Service] Type=simple Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" User=root Group=root ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties ExecStop=/opt/kafka/bin/kafka-server-stop.sh Restart=on-failure SuccessExitStatus=143 [Install] WantedBy=multi-user.target
- Run the following commands in sequence to start Kafka and ZooKeeper:
systemctl daemon-reload systemctl start zookeeper systemctl start kafka
- Open the /opt/kafka/config/server.properties file and modify the following attributes:
- Verify Kafka.
- Run the following command to create a topic:
/opt/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
- Run the following command to view the created topic:
/opt/kafka/bin/kafka-topics.sh --list --zookeeper localhost:2181
If test is displayed, Kafka is deployed.
- Run the following command to create a topic:
The preceding configuration is used only for tests. Exercise caution when using the configuration in the service environment.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot