Running and Verification
Installing a Kafka software package in the Kunpeng environment requires dependencies such as bigtop-utils and ZooKeeper. Before verifying the rebuild, set up the environment. When the environment is ready, you can run the rpm -ivh xx.rpm command to install Kafka. This section mainly describes how to perform the verification.
- ZooKeeper package download URL:
- RPM package: https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS-SP4/everything/aarch64/Packages/zookeeper-3.6.1-2.6.oe2003sp4.noarch.rpm
- TAR package: http://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
- Bigtop package download URL: https://ci.bigtop.apache.org/view/Releases/job/Bigtop-3.2.1-aarch64/DISTRO=centos-7,PLATFORM=aarch64-slave,PRODUCT=bigtop-utils/
Procedure
- Install Kafka.
Switch to the terminal tool and run the following command:
cd /opt/DevKit/workspace/devadmin/porting/report/packagerebuild/ && ll
A directory is generated based on the task name when the software package is rebuilt, for example, Package_Rebuild_Task3. Switch to this directory and run the following command:
rpm -ivh kafka-2.4.1-1.el7.aarch64.rpm
The Package_Rebuild_Task3 directory stores the rebuilt software package. You can obtain the directory from the dialog box displayed in the lower-right corner of the page after the rebuild is successful.
The following information is displayed:
[root@localhost]# rpm -ivh kafka-2.4.1-1.el7.aarch64.rpm Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:kafka-2.4.1-1.el7.aarch64 ################################# [100%]
- Start ZooKeeper.Run the following commands to start ZooKeeper:
cd /usr/lib/zookeeper/bin/ ./zkServer.sh start
Figure 1 ZooKeeper started successfully
If ZooKeeper is installed in DNF or RPM mode, the default directory is /opt. You need to copy the following two JAR packages from /opt/zookeeper/lib to the libs directory of Kafka so that Kafka can be started properly:
- zookeeper-3.6.2.jar
- zookeeper-jute-3.6.2.jar
- Start Kafka.
Run the following commands to start Kafka:
cd /usr/lib/kafka/bin ./kafka-server-start.sh ../config/server.properties
Figure 2 Starting Kafka
After Kafka is started, do not close the terminal window.
- Verify the functions.
Verify the functions using the CLI.
- Run the following commands to create a topic in a new terminal window:
cd /usr/lib/kafka/bin kafka-topics.sh --zookeeper localhost:2181 --create --topic sandbox-experiment --partitions 2 --replication-factor 1
- Run the following command to start the consumer service:
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic sandbox-experiment
- Run the following command to start the producer service in a new terminal window:
kafka-console-producer.sh --broker-list localhost:9092 --topic sandbox-experiment
Send the message beginning hello kafka.
Figure 3 Messages sent by the producer service
- The consumer service receives the message.
Figure 4 Messages received by the consumer service
It is verified that the rebuilt kafka-2.4.1-1.el7.aarch.rpm package can be properly installed and used on the Kunpeng server.
- Run the following commands to create a topic in a new terminal window: