bridges 命令

bridges 命令用于在多台 EMQ X 服务器节点间创建桥接:

  1. --------- ---------
  2. Publisher --> | node1 | --Bridge Forward--> | node2 | --> Subscriber
  3. --------- ---------
bridges list查询全部桥接
bridges start <Name>开启一个桥接
bridges stop <Name>停止一个桥接
bridges forwards <Name>列出指定 bridge 的转发主题
bridges add-forward <Name> <Topic>向指定 bridge 添加转发主题
bridges del-forward <Name> <Topic>从指定 bridge 删除转发主题
bridges subscriptions <Name>列出指定 bridge 的订阅主题
bridges add-subscription <Name> <Topic> <QoS>向指定 bridge 添加订阅主题
bridges del-subscription <Name> <Topic>从指定 bridge 删除订阅主题

关于 bridges 的配置项在 emqx/emqx.config 文件内。

bridges list

查询全部桥接:

  1. $ ./bin/emqx_ctl bridges list
  2. name: emqx status: Stopped

bridges start <Name>

开启一个桥接:

  1. $ ./bin/emqx_ctl bridges start emqx
  2. Start bridge successfully.

bridges stop <Name>

停止一个桥接:

  1. $ ./bin/emqx_ctl bridges stop emqx
  2. Stop bridge successfully.

bridges forwards <Name>

列出指定 bridge 的转发主题:

  1. $ ./bin/emqx_ctl bridges forwards emqx
  2. topic: sensor/#

bridges add-forward <Name> <Topic>

向指定 bridge 添加转发主题:

  1. $ ./bin/emqx_ctl bridges add-forward emqx device_status/#
  2. Add-forward topic successfully.

bridges del-forward <Name> <Topic>

从指定 bridge 删除转发主题:

  1. $ ./bin/emqx_ctl bridges del-forward emqx device_status/#
  2. Del-forward topic successfully.

bridges add-subscription <Name> <Topic> <QoS>

向指定 bridge 添加订阅主题:

  1. $ ./bin/emqx_ctl bridges add-subscription emqx cmd/topic 1
  2. Add-subscription topic successfully.

bridges subscriptions <Name>

列出指定 bridge 的订阅:

  1. $ ./bin/emqx_ctl bridges subscriptions emqx
  2. topic: cmd/topic, qos: 1

bridges del-subscription <Name> <Topic>

从指定 bridge 删除订阅主题:

  1. $ ./bin/emqx_ctl bridges del-subscription emqx cmd/topic
  2. Del-subscription topic successfully.