验证本地mosquitto MQTT Broker已桥接到test.mosquitto.org [英] Verify that local mosquitto MQTT Broker is bridged to test.mosquitto.org

查看:668
本文介绍了验证本地mosquitto MQTT Broker已桥接到test.mosquitto.org的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行以下配置的本地(OSX 11)蚊子代理(1.4.7):

I have a local (OSX 11) mosquitto broker (1.4.7) running with the following config:

connection test
address test.mosquitto.org
topic in_topic in 0
topic out_topic out 0
try_private false
notifications false
bridge_attempt_unsubscribe true

我在这里获得了conf设置表格:将本地蚊子桥接到云代理(谢谢)

I got the conf settings form here: bridge local mosquitto to cloud broker (thanks)

我现在有3个终端.

A :直接使用ruby脚本和ruby-mqtt订阅了test.mosquitto.org.

A: subscribed to test.mosquitto.org directly using a ruby script and ruby-mqtt.

B :通过mosquitto_sub -t in_topic

C :使用以下命令发布:mosquitto_pub -h test.mosquitto.org -t in_topic -m "hello world1"

C: publishes using this command: mosquitto_pub -h test.mosquitto.org -t in_topic -m "hello world1"

现在,当我这样做时,我会在 A B 中得到响应,这使我认为我的桥接连接正在工作.但是,如果我放下-h test.mosquitto.org,则不会收到 A 的消息.因此,如果我包含-h选项,则该消息仅发送给该代理(test.mosquitto.org).

Now, when I do this I get the response in A and B so that makes me think my bridging connection is working. However, if I drop the -h test.mosquitto.org I don't get the message from A. So, the message is only going to that broker (test.mosquitto.org) if I include the -h option.

另一方面,如果我停止本地蚊子经纪人,然后运行包含-h选项的相同命令,则 A 仍会收到消息,而 B 没有.实际上, B 甚至无法启动,因为由于本地代理未运行而导致连接被拒绝.

On the other hand, if I stop the local mosquitto broker and then run the same command including the -h option then the A still gets the message and B doesn't. B actually doesn't even start up since the connection is refused since local broker is not running.

所以,我的问题是,此配置是否确实确定了代理正在桥接?我不知道.

So, my question is, does this configuration actually establish that the brokers are bridging? I am not sure.

更新: 正如 hardillb 指出的那样,我的错误是我用于发布的主题未配置为发布给其他代理.当我将conf更新为topic in_topic out 0时,我成功地直接从test.mosquitto.org代理获取消息,而没有包括-h test.mosquitto.org.消息根据配置传播.

Update: As hardillb pointed out my mistake was that the topic that I was using to publish was not configured to publish out to the other broker. When I updated the conf to topic in_topic out 0 I succeeded in getting the message directly from the test.mosquitto.org broker without including the -h test.mosquitto.org in other words. The message propagated based on the configuration.

我出错的文档可以在以下桥接部分找到: http ://mosquitto.org/man/mosquitto-conf-5.html

The documentation for what I got wrong can be found under the bridging section here: http://mosquitto.org/man/mosquitto-conf-5.html

推荐答案

运行以下命令不会在终端 A 中获得任何帮助

You won't get anything in terminal A from running the following

mosquitto_pub -t in_topic -m "hello world1"

因为您的网桥设置为仅将out_topic上的内容从本地代理转发到远程(test.mosquitto.org)

Because your bridge is set up to only forward things on out_topic from the local broker to the remote (test.mosquitto.org)

topic out_topic out 0

这篇关于验证本地mosquitto MQTT Broker已桥接到test.mosquitto.org的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆