Moving LAN MQTT Broker to new machine by text editing flows.json

Background
I need to move old Win10 machine that is running my LAN broker to a place with no wire connection so enabled WiFi on it, removed ethernet cable - changed reservation in my router to swap IP over to WiFI MAC address - computer works fine - no NR MQTT node can connect to it :frowning:

Ignoring that problem - Long term , I've really just wanted to setup mosquitto on new machine and get all my NR instances using that instead so I may as well do that now

I reckon I can manually edit my flows .json files on all my instances and just change

    {
        "id": "c6e3938e.73397",
        "type": "mqtt-broker",
        "name": "Win8",
        "broker": "192.168.0.23",
        "port": "1883",

to

    {
        "id": "c6e3938e.73397",
        "type": "mqtt-broker",
        "name": "NewHP",
        "broker": "192.168.0.9",
        "port": "1883",

and it'll work

tried a little test and seemed to work

Is this a valid technique or will something bite me?

Perfectly reasonable and workable Simon.

Ps, just in case you weren't aware, you have to enter settings in mosquitto conf file to permit connection from other computers across your Lan (v2 mosquitto defaults to only permitting localhost connectivity for security reasons).

2 Likes

Thanks Steve - yes mosquitto.conf fine

After a break I resumed the battle against original fault and found that although computer said firewall was off on the Wifi, the public one setting was turned on - once I turned it off - everything sprung back into life :slight_smile:

So I can do the change at my leisure again :slight_smile:

On a linux system it is better not to modify the main conf file (as that may get overwritten during an upgrade). Instead you can add a conf file to the directory /etc/mosquitto/conf.d which overrides settings in the main one. So I add a file /etc/mosquitto/conf.d/mossy.conf containing

listener 1883
allow_anonymous true
3 Likes