Multiple instances of hass connected to same mqtt broker. Best practice?

Hi everyone,

I have multiple instances of home assistant, running on several devices (RPI, X86, …).
All of them are connected to the same MQTT-broker.
On each configiguration.yaml, I configured a separte topic for each connection, i.e.

# ===============================================
# MQTT
# ===============================================
mqtt:
  discovery: true
  broker: 192.168.4.87
  port: 1883
  client_id: "hass-17"
  username: "hass-17"
  password: "********"
  keepalive: 60
  birth_message:
    topic: 'hass/hass-17/status'
    payload: 'online'
  will_message:
    topic: 'hass/hass-17/status'
    payload: 'offline'

and another server has i.e.:

# ===============================================
# MQTT
# ===============================================
mqtt:
  discovery: true
  broker: 192.168.4.87
  port: 1883
  client_id: "hass-86"
  username: "hass-86"
  password: "********"
  keepalive: 60
  birth_message:
    topic: 'hass/hass-86/status'
    payload: 'online'
  will_message:
    topic: 'hass/hass-86/status'
    payload: 'offline'

and so on.

On mqtt explorer, I can see the status topics of the individual servers (1), but I can also see a “common” topic “homeassistant” (2)

Question: is this a problem? Can this cause interference between the different setups?
How to avoid this? Is there a way to instruct home assistant to have another root topic?

any advice is appreciated,
kind regards,
Bart

Every device that publishes mqtt discovery information will publish to this topic. This means all your home assistant servers will see these devices. You can choose to integrate them or ignore them individually in each home assistant instance. So it shouldn’t be an issue.

Why do you have so many Home Assistant servers?

Why do you have so many Home Assistant servers?

Addiction? :slight_smile:

No, real reason:

  1. backend. Just running zigbee2mqtt, mqtt broker, nginx, and some other basic stuff. Here I don’t run any automations or other “complex” things. Main purpose is having this server always on.
  2. frontend: running GUI for everyone. Hosting automations also.
  3. testserver: playground for testing some things
  4. DR-server: I don’t want to have a dropout if 1 or 2 fail. So running a single-server instance with all config in sync. Kind of a “hot spare”. If 1/2 fail → I can reconfig my internal DNS and everything will keep running.

Thanx for response,
B

Sorry for the stupid question.
Does the configuration of the mqtt goes into the configuration.yaml?

Not anymore. Used to, but it is already a long time config flow only.

So, I have to put it in the mqtt.yaml.

MQTT is installed using config flow. (GUI)
Settings → Devices & services → + Add Integration → MQTT

Manually defined sensors/switches/light/… can go in mqtt.yaml

Ok. I found it, it’s all in de configaration of the mqtt integration.
Kind of you to help me out. Thanks a lot.

Can you tell me what to put on the zigbee2mqtt add-on.
mqtt
server: mqtt://core-mosquitto:1883
user: hass-17
password: ******
Is this correct?