eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Bridge not working with a specific kind of topic #3067

Open Anzal-calixto opened 3 months ago

Anzal-calixto commented 3 months ago

Here is the my broker configuration bridge file.

address broker.emqx.io:1883
#bridge_cafile /etc/mosquitto/certs/ca.crt
#bridge_certfile /etc/mosquitto/certs/client.crt
#bridge_keyfile /etc/mosquitto/certs/client.key
topic home-15646/# out 0
topic home-15646/# in 0

instead of this if give home/# the bridge will work fine.

1718281051: mosquitto version 2.0.11 starting
1718281051: Config loaded from /etc/mosquitto/mosquitto.conf.
1718281051: Opening ipv4 listen socket on port 1883.
1718281051: Opening ipv6 listen socket on port 1883.
1718281051: Connecting bridge (step 1) home_connection-15646 (test.mosquitto.org:1883)
1718281051: mosquitto version 2.0.11 running
1718281052: Connecting bridge (step 2) home_connection-15646 (test.mosquitto.org:1883)
1718281052: Error creating bridge: Broken pipe.
1718281052: New connection from 127.0.0.1:47960 on port 1883.
1718281052: New client connected from 127.0.0.1:47960 as mqttjs_1fbb6b9b (p2, c1, k60).

also its giving a broken pipe error.

Daedaluz commented 3 months ago

try

address broker.emqx.io:1883
#bridge_cafile /etc/mosquitto/certs/ca.crt
#bridge_certfile /etc/mosquitto/certs/client.crt
#bridge_keyfile /etc/mosquitto/certs/client.key
topic home-15646/# both 0

But it feels like this might be something else.

tls settings good?

Anzal-calixto commented 3 months ago

Tls settings are working fine when I try with emqx broker it's working but if I am connecting to mosquito broker it's not bridging

hardillb commented 3 months ago

Try wrapping the topic in quotes

address broker.emqx.io:1883
#bridge_cafile /etc/mosquitto/certs/ca.crt
#bridge_certfile /etc/mosquitto/certs/client.crt
#bridge_keyfile /etc/mosquitto/certs/client.key
topic "home-15646/#" out 0
topic "home-15646/#" in 0
Anzal-calixto commented 3 months ago

thanks @hardillb i tried using above method it doesn't seems to be working

Daedaluz commented 3 months ago

I think there should be a "both" variant to "in" and "out", try that instead of in and out separately.

Anzal-calixto commented 3 months ago

1719215263: Error creating bridge: Broken pipe. 1719215294: Connecting bridge (step 1) home_connection-15646(test.mosquitto.org:1883) @Daedaluz tried that still gives the same error

Daedaluz commented 3 months ago

What does emqx logs say?

Anzal-calixto commented 3 months ago

1719220419: mosquitto version 2.0.11 starting 1719220419: Config loaded from /etc/mosquitto/mosquitto.conf. 1719220419: Opening ipv4 listen socket on port 1883. 1719220419: Opening ipv6 listen socket on port 1883. 1719220419: Connecting bridge (step 1) home_connection-15646 (broker.emqx.io:1883) 1719220419: mosquitto version 2.0.11 running 1719220420: Connecting bridge (step 2) home_connection-15646 (broker.emqx.io:1883) 1719220420: New connection from 127.0.0.1:60498 on port 1883. 1719220420: New client connected from 127.0.0.1:60498 as mqttjs_b48cce68 (p2, c1, k60). 1719220473: New connection from 192.168.1.174:52561 on port 1883. 1719220473: New client connected from 192.168.1.174:52561 as mqttx_384adf50 (p5,

this is the log for emqx

Daedaluz commented 3 months ago

that looks like logs from mosquitto.

Anzal-calixto commented 3 months ago

@Daedaluz In my setting my local broker is mosquitto and when i am trying to bridge this local broker to a mosquitto broker thats when it gives the error and bridge is not being connected. If i try to bridge it to an emqx broker bridge is working fine. my cloud broker is a mosquitto broker and the emqx broker is an open broker

Anzal-calixto commented 3 months ago

@Daedaluz @hardillb any suggestions

ckrey commented 3 months ago

@Anzal-calixto "home-15646/#" is not a valid topic filter (because the # is not at the end).

Please correct to home-15646/# which is probably what you intended

ckrey commented 3 months ago

Can you try with a more recent version of mosquitto (2.0.18)? 2.0.11 is 3 years old

Anzal-calixto commented 3 months ago

@ckrey i tried home-1546/# it was also havig the issue i will update mosquitto and try again

Anzal-calixto commented 3 months ago

hello @ckrey i am using debian 11 it seems the latest version that is available for dedian 11 is 2.0.11

ckrey commented 3 months ago

Setting up a brigde to test.mosquitto.org:1883 works well with mosquitto 2.0.11 and 2.0.18

Please show us your complete config with bridge to test.mosquitto.org (all your snippets above show the config with emqx)

Anzal-calixto commented 3 months ago

sure here is the settings


address test.mosquitto.org:1883
topic home-15646/# both 0 
Anzal-calixto commented 2 months ago

@ckrey @Daedaluz @hardillb can you guys provide any other methods. it would be a great help