2015-06-04 99 views
1

我想在同一個系統上橋接兩個MQTT經紀人,HiveMQMosquittoHiveMQ正在關注端口1884Mosquitto正在運行於1883。然而,當我使用mosquitto_pub命令在端口1883發佈到mosquitto經紀人,它不會在端口1884顯示(使用MQTT.fx作爲客戶端訂閱端口的所有主題1884橋接mqtt經紀人hivemq和蚊子

這是當我只配置了經紀人與一座橋。 當我配置了HiveMQ時,它只在HiveMQ命令窗口中顯示unable to connect to Bridge1, disconnected消息。我已經包含了下面的配置。有人請幫忙。

mosquitto.config文件中,我在bridges下完成了以下操作。

connection hivemq 
    address 127.0.0.1:1884 
    start_type automatic 
    clientid clientno1 
    notifications true 

同時,我也editted的HiveMQ bridges.xml文件讀取

<?xml version="1.0" encoding="UTF-8"?> 
<bridges xsi:noNamespaceSchemaLocation="http://www.hivemq.com/bridges/bridge.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

<bridge> 
    <connectionName>Bridge1</connectionName> 
    <addresses> 
     <address> 
      <host>localhost</host> 
      <port>1883</port> 
     </address> 
    </addresses> 
    <clientId>bridgeClient</clientId> 
    <topicPatterns> 
     <topicPattern> 
      <topic>#</topic> 
      <qos>1</qos> 
      <direction>both</direction> 
      <localPrefix>local/</localPrefix> 
      <remotePrefix>remote/</remotePrefix> 
     </topicPattern> 
    </topicPatterns> 
    <cleanSession>true</cleanSession> 
    <idleTimeout>10</idleTimeout> 
    <notificationsEnabled>true</notificationsEnabled> 
    <tryPrivate>true</tryPrivate> 

</bridge> 

The image below is when I tried the same process on another system. Here, the brokers are bridged. Comparing this to what I was doing earlier, the only difference is that on my original system there is no statement saying opening ipv4 listen socket on 1883. Is this the problem?

所示的圖像是當我試圖在另一個系統上相同的過程。在這裏,經紀人是橋接的。將它和我之前做的比較起來,唯一的區別是在我的原始系統上沒有聲明說在1883年打開ipv4偵聽套接字。這是問題嗎?

回答

0

橋接應該只在發佈/客戶端(在你的情況mosquitto)進行設置,在Hivemq(服務器)保留默認設置應罰款

嘗試更改您的mosquitto.conf

connection bridge-mosquitto-to-hivemq 
address 127.0.0.1:1884 
topic room1/# both 2 sensor/ myhouse/ 
bridge_protocol_version mqttv311 
notifications true 
cleansession true 
try_private true 

重新啓動後的經紀人,在mosquitto經紀人,嘗試發佈以下

的示例消息
mosquitto_pub -t sensor/room1/temperature -m '26.3' 
0

你應該只需要在經紀人的一個配置的橋,其配置爲兩橋會導致的問題,最可能的消息循環

爲了您mosquitto的配置,你需要添加一個話題線您mosquitto橋,所以它知道哪些主題發送(和接收)蜂巢經紀人

的話題指令詳細內容可以在mosquitto.conf手冊頁(http://mosquitto.org/man/mosquitto-conf-5.html)被找到,但基本是:

topic pattern [[[ out | in | both ] qos-level] local-prefix remote-prefix]

要鏡像的所有主題在兩個方向上

topiC# both 
+0

我只在'mosquitto'上配置了網橋,並且現在還在配置文件的主題行中添加了該網橋。仍然沒有橋接。 – avelampudi

+0

蚊子輸出是否顯示有關橋的任何事情? – hardillb

+0

什麼也沒有。我無法分辨它是否已配置或沒有。兩者都完全獨立,但「蚊子」並沒有顯示任何關於橋樑的信息。我有點困惑。 – avelampudi

相關問題