Error:9010 port already in use

I am using HiveMQ broker installed on Windows.
I tried creating new cluster node by changing port number from 9010 to 9011 under /bin/run.sh.
As i run HiveMQ this error is shown.
Kindly help me in resolving this issue.

Hi Shruti,

the specific error you are seeing is occuring, because the second instance of HiveMQ you are launching is attempting to bind to the same ports as the first one. Identical ports cannot be opened more than once.
Further, HiveMQ’s community edition does not support clustering. You can find and overview of the individual edition’s capabilities on our homepage.

I hope this helps.

Kind regards,
Finn

Hi @Shruti,

as Finn already mentioned you try to use the port twice. In your particular case it’s the JMX port. You can fix this by changing the used port in the run.bat in node2. In line 54 of run.bat:

rem JMX Monitoring
set "JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false %JAVA_OPTS%"

In this option -Dcom.sun.management.jmxremote.port=9010 you change the port for example to -Dcom.sun.management.jmxremote.port=9011.

Mind that you have to this again if you add more local nodes.

Greetings,
Michael from the HiveMQ team

I have tried doing this. Already changed jmx port from 9010 to 9011 but as soon as i run HiveMQ, same port number gets displayed (i.e. 9010) in place of 9011. Is there any other way?

Kindly help in resolving this issue.

Hi @Shruti,

the above solution is the only one and I use this also on my laptop to build a local cluster.
Please check:

  • did you correct the port in the right run.bat
  • did you save the change
  • can you try to run the command from new cmd shell

Greetings,
Michael

Thanks a lot! It worked.