3. Set environment variables

I need to set three variables.

JMX_PORT

export JMX_PORT=8989

KAFKA_OPTS

export KAFKA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8989"

port=8989 should be same as JMX_PORT.

KAFKA_JMX_OPTS

Enter below command in kafka directory because $(pwd) will set present directory.

export KAFKA_JMX_OPTS="-javaagent:$(pwd)/libs/jmx_prometheus_javaagent-1.0.1.jar=12345:$(pwd)/config/kafka-2_0_0.yml"

Check the pwd command is well replaced with an actual directory.

env | grep KAFKA_JMX_OPTS

Port number 8989 and 12345 can be my choice. It seems that there is no general popular number for these.

These env variables are used in bin/kafka-run-class.sh that will be run inside bin/kafka-server-start.sh.

Last updated