Bootstrap

11.kafka开启jmx

方式一:

1.进入/opt/kafka_2.13-3.3.2/bin目录

命令:

cd /opt/kafka_2.13-3.3.2/bin

[root@rhel77 ~]# cd /opt/kafka_2.13-3.3.2/bin
[root@rhel77 bin]# pwd
/opt/kafka_2.13-3.3.2/bin
[root@rhel77 bin]# 

2.备份kafka-run-class.sh

命令:

cp  kafka-run-class.sh kafka-run-class.sh.bak.20241202

[root@rhel77 bin]# cp  kafka-run-class.sh kafka-run-class.sh.bak.20241202
[root@rhel77 bin]# 
[root@rhel77 bin]# ls -l kafka-run-class.sh.*
-rwxr-xr-x 1 root root 10881 Dec  2 19:47 kafka-run-class.sh.bak.20241202
[root@rhel77 bin]# ls -l kafka-run-class.sh
-rwxr-xr-x 1 root root 10938 Dec  2 19:52 kafka-run-class.sh
[root@rhel77 bin]# 

3.编辑kafka-run-class.sh,添加如下内容,并保存

->某些服务器可能无法正确绑定ip,这时候我们需要显示指定绑定的host(ip/hostname.hostname 要做好映射关系):

按需

-Djava.rmi.server.hostname=192.1

;