Kafka turns on JMX_ After port, when using Kafka command-line tools (Kafka topics, kafka-console-consumer.sh, etc.), an exception will be reported that the port is occupied, such as:
bash-5.1# /opt/kafka_2.13-2.7.0/bin/kafka-topics.sh --create --topic chat --partitions 5 --zookeeper 172.16.5.16:2181 --replication-factor 3
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is:
java.net.BindException: Address in use (Bind failed)
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 9999; nested exception is:
java.net.BindException: Address in use (Bind failed)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:480)
at sun.management.Agent.startAgent(Agent.java:262)
at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 9999; nested exception is:
java.net.BindException: Address in use (Bind failed)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:346)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:254)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:237)
at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:213)
at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:173)
at sun.management.jmxremote.SingleEntryRegistry.<init>(SingleEntryRegistry.java:49)
at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:816)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:468)
... 2 more
Caused by: java.net.BindException: Address in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:392)
at java.net.ServerSocket.<init>(ServerSocket.java:254)
at java.net.ServerSocket.<init>(ServerSocket.java:145)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
... 11 more
terms of settlement:
Modify the bin/kafka-run-class.sh file:
Find this code
if [ $JMX_PORT ]; then
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
fi
Replace with the following:
ISKAFKASERVER="false"
if [[ "$*" =~ "kafka.Kafka" ]]; then
ISKAFKASERVER="true"
fi
if [ $JMX_PORT ] && [ -z "$ISKAFKASERVER" ]; then
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
fi
Then create topic and solve the problem.
bash-5.1#
bash-5.1# /opt/kafka_2.13-2.7.0/bin/kafka-topics.sh --create --topic chat --partitions 5 --zookeeper 172.16.5.16:2181 --replication-factor 3
Created topic chat.
bash-5.1#
Read More:
- kafka-eagle-2.0.3:Note: Kafka version is – or JMX Port is -1 maybe kafka broker jmxport disable.
- Through PID (process identification) to find the port (port) occupied applications, to solve the problem of port occupied
- Port 4200 is already in use.Use ‘-port’ to specify a different port error Reasons
- Appium connecting to the ADB 5037 port of nocturnal simulator is occupied by itself
- Solution to the problem that listen TCP 0.0.0.0:3306: bind: address already in use port is occupied in Linux centos7
- Android error: ADB port is occupied( adb.exe ,start-server’ failed — run manually if necessary)
- Idea startup error: Port occupied/address already exists
- Eclipse port occupied( java.net.BindException : address already in use: bind) solution
- The remote port occupation of Linux startup jar package script reports an error
- View port and resolve port conflict in Windows
- The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in u
- HBase hangs up immediately after startup. The port reports an error of 500 and hmaster aborted
- Dca1000 reports an error and the SPI port cannot be connected
- Centos Failed to Modify the port of SSH: error: Bind to port 27615 on 0.0.0.0 failed: Permission denied.
- When the docker of win10 subsystem is started, the port is not available
- Resourcemanger reported an error: the port is unavailable
- CDH opens Kerberos and reports an error: ticket expired
- The ADB server port is changed to 10001, and appium cannot connect to the device
- When xshell 6 is connected normally for the first time, it will prompt could not connect to ‘127.0.0.1’ (port 61708): connection failed
- ssh port forwarding