# MQTT Broker disconnected

**URL:** https://discourse.nodered.org/t/mqtt-broker-disconnected/882
**Category:** General
**Created:** [18 June 2018 10:04 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882 "2018-06-18T10:04:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 10:04 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/1 "2018-06-18T10:04:00Z")

</div>

Hello there,

I got a Problem with my Moska MQTT Broker. If i want to use the Broker it says, Broker is unconnected.  
the Debug window says the following:

> msg : string[73]  
> "Error starting mosca mqtt server, cause: Error: listen EADDRINUSE :::1883"

I have no idea what s wrong..

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 June 2018 10:06 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/2 "2018-06-18T10:06:17Z")

</div>

`EADDRINUSE` means something is already listening on port 1883 preventing your mosca instance from running.

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 11:06 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/3 "2018-06-18T11:06:39Z")

</div>

okay, so what can I do that this port is free for the Broker?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 June 2018 11:21 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/4 "2018-06-18T11:21:27Z")

</div>

Most likely you already have an MQTT broker running. Run the command

```auto
netstat -nlp|grep 1883

```

to find what is using it. Perhaps Moska is already running or perhaps you have installed mosquitto or another broker.

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 11:28 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/5 "2018-06-18T11:28:37Z")

</div>

okay, you re right, it is still running a mosquitto… with which command can I delet this?

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [18 June 2018 11:30 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/6 "2018-06-18T11:30:24Z")

</div>

Have you tried google?

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 11:50 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/7 "2018-06-18T11:50:10Z")

</div>

yes i do… but don t find, what i exactly need

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 June 2018 11:57 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/8 "2018-06-18T11:57:48Z")

</div>

What OS are you running this on?  
How did you install mosquitto?  
If you already have mosquitto installed and running, why do you want to also use Mosca?

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 12:02 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/9 "2018-06-18T12:02:52Z")

</div>

it is running on a raspberry Pi with Raspbian.

…cause i trie to communicate with Node-red from my Pi and the node red from my Windows PC. And all my tries to fix this with mosquitto are just with out a result, so I tried to fix it with Mosca cause it seems beeing easier with mosca and node red…

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 12:06 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/10 "2018-06-18T12:06:19Z")

</div>

..and i find a Topic which handle the communication as i want it, with mosca..

> [@One node-red device to ctl another node-red device](https://discourse.nodered.org/t/one-node-red-device-to-ctl-another-node-red-device/449/3):
>
> I’d imagine MQTT would be the simplest if the flows are running on different machines

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 June 2018 12:30 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/11 "2018-06-18T12:30:04Z")

</div>

`sudo apt-get remove mosquitto`

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 12:47 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/12 "2018-06-18T12:47:59Z")

</div>

okay, well of corse this would be the easiest way… but for the Moment I use mosquitto as a intern communication for an other program…

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 June 2018 12:53 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/13 "2018-06-18T12:53:43Z")

</div>

You asked how to delete mosquitto, which Colin answered. You didn’t say you needed both mosquitto and mosca to be running at the same time.

If you truly want them both running, then you’ll have to configure one to use a different port - they cannot both use 1883.

But if you’re already using mosquitto, I don’t see why you’d need mosca at all. You haven’t said what issues you had with mosquitto and node-red - maybe that’s the thing to solve here.

---

<div class="post-metadata">

### Author: ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)
#### Post date: [18 June 2018 13:09 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/14 "2018-06-18T13:09:31Z")

</div>

If you need booth u will require to define a different port for each mqtt server…

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [18 June 2018 13:23 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/15 "2018-06-18T13:23:54Z")

</div>

I got mosquitto on a diferent port… the port 1883 is not in use but still exist. so i want just delete the mosquitto for the port 1883…

sorry if this wasn t clear, my english is not that good…

---

<div class="post-metadata">

### Author: ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)
#### Post date: [18 June 2018 13:27 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/16 "2018-06-18T13:27:30Z")

</div>

The error you have is because port 1883 was already in use, so take a look deeply and chechk what you have, maybe you have configured incorrectly on node red and you have now some instance with booth configured on same port, try to stop for a moment mosquitto and check if node red start with “sudo service mosquitto stop”.

Regards

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 June 2018 13:38 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/17 "2018-06-18T13:38:43Z")

</div>

Run the command I posted to find what is using the port.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [18 June 2018 15:31 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/18 "2018-06-18T15:31:18Z")

</div>

And @Colin means the ‘netstat’ command not the ‘apt-get remove…’ one.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 June 2018 15:42 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/19 "2018-06-18T15:42:26Z")

</div>

Yes, netstat. But actually I agree with Nick, work out what the problem was with mosquitto and sort that. Most using MQTT on a pi use mosquitto so you are more likely to find support with that than another broker I think.

---

<div class="post-metadata">

### Author: ![asandford](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@asandford](https://discourse.nodered.org/u/asandford)
#### Post date: [18 June 2018 16:44 UTC](https://discourse.nodered.org/t/mqtt-broker-disconnected/882/20 "2018-06-18T16:44:49Z")

</div>

Does the MQTT node on the Windows box have the RPi’s IP (or hostname.local if you’ve got Bonjour installed) as the broker address?

[Next page](https://discourse.nodered.org/t/mqtt-broker-disconnected/882.md?page=2)
