Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Super Guru

SYMPTOM:

The following jmx tool command is failing with "port already in user" error

/usr/hdp/current/kafka-broker/bin/kafka-run-class.sh kafka.tools.JmxTool --object-name kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec  --jmx-url service:jmx:rmi:///jndi/rmi://`hostname`:1099/jmxrmi

ROOT CAUSE:

JMX tool invoke the kafka-run-class.sh after reading kafka-env.sh, since we have already have export $JMX_PORT=1099 there then it tried to bind the same host while invoking the jmx tool which result into error.

WORKAROUND:

NA

RESOLUTION:

edit kafka-run-class.sh

Replace section 
# JMX port to use 
if [ $JMX_PORT ]; then 
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" 
fi 
To the following: 
Changed security protocol to the correct ones and kafka cli script as follows. 
# JMX port to use 
if [ $ISKAFKASERVER = "true" ]; then 
JMX_REMOTE_PORT=$JMX_PORT 
else 
JMX_REMOTE_PORT=$CLIENT_JMX_PORT 
fi 
if [ $JMX_REMOTE_PORT ]; then 
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_REMOTE_PORT" 
fi




6,982 Views