kafka_0.10.0.2.5 shell 工具执行时端口冲突的解决方法




./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 2 --topic testTopic
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is:

        java.net.BindException: Address already in use 


根因:

kafka-run-class.sh在加载了kafka-env.sh后按 $JMX_PORT 准备绑定与broker启动时一样的端口



解决方法:

编辑kafka-run-class.sh

将

# 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: 

修改为:

# 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


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值