kafka堆内存调优:
1.查看堆内存大小
jmap -heap `jps | awk '/Kafka/{print $1}'` | grep MaxHeapSize
2.修改堆内存(修改堆内存大小5~6G)
which kafka-server-start.sh
vim /baimei/softwares/kafka_2.12-3.3.2/bin/kafka-server-start.sh
...
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" # 注视掉该行(29行),并将下面2行复制即可。
这里在生产环境 要配置Xmx5G -XMS 5G
export KAFKA_HEAP_OPTS="-server -Xmx256M -Xms256M -XX:PermSize=128m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=8 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70"
export JMX_PORT="8888"
3.重启kafka
[root@elk111 ~]# kafka-server-stop.sh
[root@elk111 ~]# kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties
4.查看kafka的堆内存大小
jmap -heap `jps | awk '/Kafka/{print $1}'` | grep MaxHeapSize
5.将启动脚本同步到其他节点
which kafka-server-start.sh
data_rsync.sh /baimei/softwares/kafka_2.12-3.3.2/bin/kafka-server-start.sh
6.其他节点重启kafka环境
kafka集群安装 : 连接
manager_kafka.sh stop
manager_kafka.sh start
检查 堆内存是否修改成功
jmap -heap `jps | awk '/Kafka/{print $1}'` | grep MaxHeapSize