关闭kafka和zookeeper的jmx端口

关闭kafka和zookeeper的jmx端口

  • 这是一个随机端口

  • 还监听在0.0.0.0上

  • 关闭方式

    在systemctl里设置环境变量Environment="KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote.host=127.0.0.1"

  • systemctl的相关配置

    • kafka
        [Unit]
        Description=Apache Kafka server (broker)
        Documentation=http://kafka.apache.org/documentation.html
        Requires=network.target remote-fs.target
        After=network.target remote-fs.target kafka-zookeeper.service
        
        [Service]
        Type=simple
        User=root
        Group=root
        Environment=JAVA_HOME=/usr/local/jdk1.8.0_211
        ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
        ExecStop=/opt/kafka/bin/kafka-server-stop.sh
        Environment="KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote.host=127.0.0.1"
        
        [Install]
        WantedBy=multi-user.target
      
    • zookeeper
       [Unit]
       Description=Apache Zookeeper server (Kafka)
       Documentation=http://zookeeper.apache.org
       Requires=network.target remote-fs.target
       After=network.target remote-fs.target
       
       [Service]
       Type=simple
       User=root
       Group=root
       Environment=JAVA_HOME=/usr/local/jdk1.8.0_211
       ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
       ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
       Environment="KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote.host=127.0.0.1"
       [Install]
       WantedBy=multi-user.target
      

你可能感兴趣的:(linux,kafka,zookeeper)