Enable JMX on Apache Kafka

Export in the startup scripts the following environment variables.

Apache Kafka JMX

JMX_PORT and KAFKA_JMX_OPTS

export JMX_PORT=[JMX_PORT]   # 9581
export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"

Kafka Connect JMX

JMX_PORT and KAFKA_JMX_OPTS

export JMX_PORT=[JMX_PORT]    # 9584
export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"

Zookeeper JMX

For Kafka distribution zookeeper:

JMX_PORT and ZOOKEEPER_SERVER_OPTS

export JMX_PORT=[JMX_PORT]    # 9585
export ZOOKEEPER_SERVER_OPTS="$ZOOKEEPER_SERVER_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"

For official zookeeper distribution ( https://zookeeper.apache.org/releases.html) :

JMXPORT

export JMXPORT=9585
./zkServer.sh start

Schema Registry JMX

JMX_PORT and SCHEMA_REGISTRY_JMX_OPTS

export JMX_PORT=[JMX_PORT]    # 9582
export SCHEMA_REGISTRY_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"

Test JMX connection

Verify access with:

jconsole ipaddress:port

Once services start verify remote access to the Java Monitoring and Management console:

Topology of Streaming SQL and joining 3 Kafka topics