Zookeeper

解压

tar -xvf zookeeper-3.4.14.tar.gz -C /TRS/APP/

添加配置文件

mv conf/zoo_sample.cfg zoo.cfg

启动

./bin/zkServer.sh start

Kafka

解压

tar -xvf kafka_2.13-2.5.0.tgz -C /TRS/APP/
cd /TRS/APP/kafka_2.13-2.5.0/config

复制配置文件

cp server.properties server-1.properties
cp server.properties server-2.properties
cp server.properties server-3.properties

修改配置每一项配置文件的如下内容(以server-3.properties为例)

broker.id=3 
listeners=PLAINTEXT://10.14.18.229:9094 #端口号不同
log.dirs=/tmp/kafka3-logs 

启动

nohup bin/kafka-server-start.sh config/server-1.properties >kafka1.log &
nohup bin/kafka-server-start.sh config/server-2.properties >kafka2.log &
nohup bin/kafka-server-start.sh config/server-3.properties >kafka3.log &

查看端口

[root@localhost kafka_2.13-2.5.0]# netstat -lnt | grep 9092
tcp6       0      0 10.14.18.229:9092       :::*                    LISTEN     
[root@localhost kafka_2.13-2.5.0]# netstat -lnt | grep 9093
tcp6       0      0 10.14.18.229:9093       :::*                    LISTEN     
[root@localhost kafka_2.13-2.5.0]# netstat -lnt | grep 9094
tcp6       0      0 10.14.18.229:9094       :::*                    LISTEN     
[root@localhost kafka_2.13-2.5.0]# 

添加防火墙

firewall-cmd  --add-port=9092/tcp --permanent 
firewall-cmd  --add-port=9093/tcp --permanent 
firewall-cmd  --add-port=9094/tcp --permanent 
firewall-cmd  --reload
Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐