Skip to content

Fork MQTT traffic from broker A to B like it's potatoes 🥔.

License

Notifications You must be signed in to change notification settings

4nte/mqtt-mirror

Repository files navigation

mqtt-mirror

docker docker version license

mqtt-mirror diagram

mqtt-mirror

Fork MQTT traffic with no fuss, deploy in seconds. Kubernetes ready.


Mqtt-mirror subscribes to the source broker and publishes replicated messages to the target broker.
Replicated messages preserve the original QoS and Retain message options.

All topics are mirrored by default, you can cherry pick topics to be mirrored by specifying topic filters. Standard MQTT wildcards + and # are available, see wildcard spec.

Example usage

Should I use this in production?

mqtt-mirror is not tested well enough to be relied upon for critical purposes. Until a stable 1.0 release, use with caution.

Take in consideration that outbound traffic will increase by the amount of inbound traffic.
Use topic filters to prevent mirroring of unecessary messages.

mqtt-mirror is used in production at spotsie.io ! ✨

1.0 (GA) roadmap

  • Helm chart liveness probe
  • Integration test
  • Stress test
  • Expose Prometheus metrics

Get started

Mqtt-mirror is available as a standalone binary, docker image and helm chart.

Install

Docker 🐳

docker run antegulin/mqtt-mirror ./mqtt-mirror \
tcp://username:pass@source.xyz:1883 \
tcp://target.xyz:1883 \
--topic_filter=events,sensors/+/temperature/+,logs# \
--verbose

Helm chart 📦

helm repo add 4nte https://4nte.github.io/helm-charts/
helm install mqtt-mirror 4nte/mqtt-mirror \
--set mqtt.source=$SOURCE_BROKER \
--set mqtt.target=$TARGET_BROKER \
--set mqtt.topic_filter=foo,bar,device/+/ping \

Homebrew 🍺

brew tap 4nte/homebrew-tap
brew install mqtt-mirror

Shell script 📋

curl -sfL https://raw.githubusercontent.com/4nte/mqtt-mirror/master/install.sh | sh

Compile from source 🔨

# Clone it outside GO path
git clone https://github.com/4nte/mqtt-mirror
cd mqtt-mirror

# Get dependencies
go get ./..


# Build, duh.
go build -o mqtt-mirror

# Use it like there's no tomorrow
./mqtt-mirror --version

Sponsors

spotsie

Development

If you like this project, please consider helping out. All contributions are welcome.