wget wget http://mirror.bit.edu.cn/apache/kafka/2.4.0/kafka_2.13-2.4.0.tgz
tar -zxvf kafka_2.13-2.4.0.tgz
cd kafka_2.13-2.4.0/bin
# 运行zookeeper服务
./zookeeper-server-start.sh ../config/zookeeper.properties 1>/dev/null 2>&1 &
# 运行kafka服务
./kafka-server-start.sh ../config/server.properties 1>/dev/null 2>&1 &

安装KafkaManager

yum install java-devel
git clone https://github.com/yahoo/kafka-manager.git
cd kafka-manager
./sbt clean dist
cd /root/kafka-manager/target/universal/kafka-manager-x.x.x.x

修改配置文件:vi conf/application.conf
WX20200216-131314@2x.png

运行KafkaManager

cd bin
./kafka-manager -Dconfig.files=…/config/application.conf 1>/dev/null 2>&1 &

常用指令:

创建一个新的Topic:

 ./kafka-topics.sh --create --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181 --replication-factor 1 --partitions 3 --topic TopicSession

查询Topic列表:

./kafka-topics.sh --list --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181

查看Topic详细信息:

./kafka-topics.sh --describe --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181 --topic TopicSession

建立订阅者console-consumer:

./kafka-console-consumer.sh --bootstrap-server hadoop1:9092,hadoop2:9092,hadoop3:9092 --topic TopicSession

建立发布者console-producer:

./kafka-console-producer.sh --broker-list hadoop1:9092,hadoop2:9092,hadoop3:9092 --topic TopicSession