# MQTT Broker error: 1883 port in use

**URL:** <https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894>\
**Category:** General\
**Created:** [19 March 2021 16:26 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894 "2021-03-19T16:26:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 16:26 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/1 "2021-03-19T16:26:57Z")

</div>

Greetings Community,

RPI4 running on:  
Raspbian GNU/Linux 10 (buster)  
NodeRED v1.2.3.

on the publishing PI:

> Error: [error] [aedes broker:MQTT Broker] Error: Port 1883 is already in use
> 
> I ran the command _sudo netstat -nlp|grep 1883_
> 
> _tcp 0 0 0.0.0.0:1883 0.0.0.0: LISTEN 486/mosquitto \*\*  
> tcp6 0 0 :::1883 ::: LISTEN 486/mosquitto_

I was reading through the forum for possible solutions I attempted to uninstall mosquito thinking I have an external instance running. But it says abort after I select Y when I run:  
sudo apt-get remove mosquitto

My only confusion is, I have not altered with MQTT aedes broker node and all of a sudden it stopped working when I was creating a new topic for an MQTT out node, it shows connected. But the broker shows disconnected.

On the subscriber PI:

> Flows stopped due to missing node types.  
> position-config  
> server

> pi@zone4:~ $ sudo netstat -nlp|grep 1883  
> tcp 0 0 0.0.0.0:1883 0.0.0.0:\* LISTEN 506/mosquitto  
> tcp6 0 0 :::1883 :::\* LISTEN 506/mosquitto

**How do I disable that TCP thingy(see above) that's using port 1883 all of a sudden?**

If I am not clear enough I can reiterate anything for clarity.

All the best

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 16:28 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/2 "2021-03-19T16:28:04Z")

</div>

Trivial: I have also tried turning both devices off and on again 😅

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [19 March 2021 16:42 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/3 "2021-03-19T16:42:51Z")

</div>

Looks like you have Mosquitto running on the device.  
Try uninstalling it  
`sudo apt-get remove mosquitto`

---

<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:** [19 March 2021 16:51 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/4 "2021-03-19T16:51:20Z")

</div>

Why do you want to stop using Mosquitto and use Aedes instead? Mosquitto is generally considered better.

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 17:41 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/5 "2021-03-19T17:41:49Z")

</div>

I have tried that , but when I put the command in(see original post midway), it says abort after I hit Y.

Colin : I generally have no preference, I'm attempting to really just fix what had stopped working all of a sudden.

I'm open to any suggestions

---

<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:** [19 March 2021 17:56 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/6 "2021-03-19T17:56:03Z")

</div>

If you can't remove mosquitto something odd is going on. Show us the full output when you run the remove, including the command you enter. Also what happens if you run `sudo apt update`

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 18:16 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/7 "2021-03-19T18:16:32Z")

</div>

Thank you collin. I will attempt that as soon as I get home and post the response soon.

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 20:33 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/8 "2021-03-19T20:33:36Z")

</div>

Nice, I did the sudo apt update, then the remove command. that worked to restore the provider p!

for the subscriber pi, I had a buttload of unused nodes from early imports I did then deleted. I was able to restore this pi too.

Thank you for the helpful and prompt support!

---

<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:** [19 March 2021 20:37 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/9 "2021-03-19T20:37:37Z")

</div>

If you are using mqtt I recommend mosquitto rather than aedes.

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 20:43 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/10 "2021-03-19T20:43:41Z")

</div>

to implement that, Do i just remove the aedes node and configure the mosquitto through the terminal?

---

<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:** [19 March 2021 20:58 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/11 "2021-03-19T20:58:52Z")

</div>

You don't usually need to do any configuration with mosquitto. Just install it and it goes. Take out aedes and uninstall it first so mosquitto can run as soon as you install it.

---

<div class="post-metadata">

**Author:** ![MegalomaniacGT](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/megalomaniacgt/32/39045_2.png) [@MegalomaniacGT](https://discourse.nodered.org/u/MegalomaniacGT)\
**Post date:** [19 March 2021 21:29 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/12 "2021-03-19T21:29:57Z")

</div>

Ok, I got rid of Aedes and reinstalled Mosquitto and used that instead.

I now learned two ways how to implement an MQTT server, thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 April 2021 21:30 UTC](https://discourse.nodered.org/t/mqtt-broker-error-1883-port-in-use/42894/13 "2021-04-02T21:30:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
