开启zookeeper的JMX
vim /baimei/softwares/apache-zookeeper-3.8.1-bin/bin/zkEnv.sh
(1)添加:
# Add by zzy for enable zookeeper JMX
JMXLOCALONLY=false
JMXHOSTNAME=10.0.0.101
JMXPORT=9999
JMXSSL=false
JMXLOG4J=false
(2)然后同步到集群其他地方:
data_rsync.sh /baimei/softwares/apache-zookeeper-3.8.1-bin/bin/zkEnv.sh
$ZK_HOME/bin/zkEnv.sh
(3)批量修改JMXHOSTNAME
for ((host_id=111;host_id<=113;host_id++)) do ssh elk${host_id} "sed -ri 's#(JMXHOSTNAME=10.0.0.)101#\1${host_id}#g' $ZK_HOME/bin/zkEnv.sh";done
(4)检测
egrep -v '^#|^$' $ZK_HOME/bin/zkEnv.sh