1

I'm developing an MQTT based application using HiveMQ, an enterprise broker. I installed it as per the instructions here- http://www.hivemq.com/docs/hivemq/2.0.1/

When I run it using ./bin/run.sh, the server connection is immediately closed due to the error - Could not bind to all interfaces and port 1883, because it is already in use. Stopping HiveMQ

As far as I'm aware, nothing else is using this port. This happens even when I restart my computer and nothing else is running. I'm running in root mode.

Why am I getting this error?

sbhatla
  • 1,040
  • 2
  • 22
  • 34
  • 1
    Have you tried running lsof -iTCP:1883 just to double check nothing is listening on the port? – hardillb Aug 26 '14 at 21:07
  • Turns out this was very useful. I get- `mosquitto 539 mosquitto 3u IPv4 9748 0t0 TCP *:1883 (LISTEN)`. This indicates a previous MQTT broker, mosquitto running always in the background for some reason. netstat did not show this problem. – sbhatla Aug 29 '14 at 16:51

2 Answers2

3

To check if something is already running on the port, please type the following into the terminal if you happen to run a Linux / BSD / OSX:

netstat -an|grep 1883

If you're running a Windows System, type the following:

netstat -an|find "1883"

After running that command you should see which application is using port 1883.

Alternatively you could edit the configuration.properties file in you conf folder of the HiveMQ installation and set the global.port property to a port of your choice.

Dominik Obermaier
  • 5,610
  • 4
  • 34
  • 45
  • Using netstat, the result is- `tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN; tcp6 0 0 :::1883 :::* LISTEN; unix 3 [ ] STREAM CONNECTED 1883 /var/run/dbus/system_bus_socket` – sbhatla Aug 27 '14 at 19:20
  • Changing my port to 1884 works fine. But that's not the official MQTT port. – sbhatla Aug 27 '14 at 21:01
  • So it seems there is already an application using port 1883. In this case, using a nonstandard port like 1884 works or you could prevent the other application from using port 1883. – Dominik Obermaier Aug 28 '14 at 09:03
  • 1
    Found the issue. Please see the question's comment. Had to use lsof -iTCP:1883 which showed MQTT broker mosquitto running. – sbhatla Aug 29 '14 at 16:52
0

From those results, do you have d-bus daemon installed? I don't know much about d-bus, but have you tried disabling it or modifying the config and then see if you can restart hivemq on port 1883.

Matt.
  • 1,043
  • 1
  • 12
  • 20