Specify JMX RMI port system property when not already set
Reviewers: Andriy Redko Chris Egerton
@@ -213,6 +213,10 @@ fi
# JMX port to use
if [ $JMX_PORT ]; then
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
+ if ! echo "$KAFKA_JMX_OPTS" | grep -qF -- '-Dcom.sun.management.jmxremote.rmi.port=' ; then
+ # If unset, set the RMI port to address issues with monitoring Kafka running in containers
+ KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
+ fi
fi
# Log directory to use
