这篇文章主要讲解了“kafka集群安装与配置方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“kafka集群安装与配置方法”吧!
[mayi@mayi101 software]$ tar -zxvf kafka_2.11-2.4.1.tgz -C /opt/software/
[mayi@mayi101 module]$ mv kafka_2.11-2.4.1/ kafka
[mayi@mayi101 kafka]$ mkdir logs
[mayi@mayi101 kafka]$ cd config/ [mayi@mayi101 config]$ vi server.properties 输入以下内容: #broker的全局唯一编号,不能重复 broker.id=0 #删除topic功能使能 delete.topic.enable=true #处理网络请求的线程数量 num.network.threads=3 #用来处理磁盘IO的现成数量 num.io.threads=8 #发送套接字的缓冲区大小 socket.send.buffer.bytes=102400 #接收套接字的缓冲区大小 socket.receive.buffer.bytes=102400 #请求套接字的缓冲区大小 socket.request.max.bytes=104857600 #kafka运行日志存放的路径 log.dirs=/opt/software/kafka/logs #topic在当前broker上的分区个数 num.partitions=1 #用来恢复和清理data下数据的线程数量 num.recovery.threads.per.data.dir=1 #segment文件保留的最长时间,超时将被删除 log.retention.hours=168 #配置连接Zookeeper集群地址 zookeeper.connect=mayi101:2181,mayi102:2181,mayi103:2181/kafka
[mayi@mayi101 module]$ sudo vi /etc/profile #KAFKA_HOME export KAFKA_HOME=/opt/module/kafka export PATH=$PATH:$KAFKA_HOME/bin [atguigu@hadoop102 module]$ source /etc/profile
[mayi@mayi101 module]$ xsync kafka/ 注意:分发之后记得配置其他机器的环境变量 分别在mayi102和mayi103上修改配置文件/opt/module/kafka/config/server.properties中的broker.id=1、broker.id=2 注:broker.id不得重复
依次在mayi101、mayi102、mayi103节点上启动kafka [mayi@mayi101 kafka]$ kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties [mayi@mayi101 kafka]$ kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties [mayi@mayi101 kafka]$ kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties
[mayi@mayi101 kafka]$ bin/kafka-server-stop.sh [mayi@mayi102 kafka]$ bin/kafka-server-stop.sh [mayi@mayi103 kafka]$ bin/kafka-server-stop.sh
#!/bin/bash for i in `cat /opt/software/hadoop-2.9.2/etc/hadoop/slaves` do echo "========== $i ==========" ssh $i 'source /home/mayi/.bash_profile&&/opt/software/kafka_2.11-2.4.1/bin/kafka-server-start.sh -daemon /opt/software/kafka_2.11-2.4.1/config/server.properties' echo $? done
#!/bin/bash for i in `cat /opt/software/hadoop-2.9.2/etc/hadoop/slaves` do echo "========== $i ==========" ssh $i 'source /home/mayi/.bash_profile&&/opt/software/kafka_2.11-2.4.1/bin/kafka-server-stop.sh' echo $? done
感谢各位的阅读,以上就是“kafka集群安装与配置方法”的内容了,经过本文的学习后,相信大家对kafka集群安装与配置方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。