mosquitto 服务器 硬件配置,MAC 下配置MQTT 服务器Mosquitto

本文介绍了如何在MacOS上通过Homebrew安装mosquitto MQTT服务器,并详细说明了启动、停止服务的命令,以及如何修改配置文件`mosquitto.conf`以允许连接。推荐使用MQTTBox作为MQTT客户端进行连接和测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

macos下启动mqtt服务

brew install mosquitto

Updating Homebrew...

==> Auto-updated Homebrew!

Updated 3 taps (jenkins-x/jx, homebrew/core and homebrew/cask).

==> New Formulae

llvm@9 vroom

==> Updated Formulae

jenkins-x/jx/jx ✔ gitfs libgit2 rke

anycable-go gitg libgit2-glib salt

apache-geode gitless libphonenumber samurai

awscli gnome-builder literate-git unrar

bee goreleaser llvm vapoursynth

dhall graph-tool manticoresearch vapoursynth-imwri

dhall-json helmfile monero vapoursynth-ocr

dhall-lsp-server imapsync oclgrind vapoursynth-sub

dhall-yaml janet octant vert.x

etcd jenkins pgformatter wireguard-go

eye-d3 jfrog-cli-go phpunit xcodegen

firebase-cli kyma-cli rancher-cli zabbix

fluent-bit lazygit ripgrep zero-install

==> Updated Casks

5kplayer hbuilderx qt-creator

anydo imgotv rar

bibdesk iridium reaper

boinc joplin riot

cocktail lark scaleft

comparemerge lego-mindstorms-ev3 script-debugger

dashcam-viewer lehreroffice snowflake-snowsql

downie lens sound-control

electorrent marginnote sourcetrail

fedora-media-writer megasync telegram

feishu microsoft-edge telegram-desktop

freac mps use-engine

freeyourmusic nightfall webcatalog

gnucash plex-media-server yinxiangbiji

google-chrome prezi-next

grandtotal protonmail-bridge

==> Deleted Casks

synfigstudio

==> Installing dependencies for mosquitto: libuv and libwebsockets

==> Installing mosquitto dependency: libuv

==> Downloading https://homebrew.bintray.com/bottles/libuv-1.35.0.catalina.bottl

==> Downloading from https://akamai.bintray.com/f9/f9e218fe31eec56662a5a10b0e736

######################################################################## 100.0%

==> Pouring libuv-1.35.0.catalina.bottle.tar.gz

🍺 /usr/local/Cellar/libuv/1.35.0: 48 files, 3.0MB

==> Installing mosquitto dependency: libwebsockets

==> Downloading https://homebrew.bintray.com/bottles/libwebsockets-4.0.1.catalin

==> Downloading from https://akamai.bintray.com/a5/a5f2a171607549355e6958d260c94

######################################################################## 100.0%

==> Pouring libwebsockets-4.0.1.catalina.bottle.tar.gz

🍺 /usr/local/Cellar/libwebsockets/4.0.1: 87 files, 1.4MB

==> Installing mosquitto

==> Downloading https://homebrew.bintray.com/bottles/mosquitto-1.6.9.catalina.bo

==> Downloading from https://akamai.bintray.com/fc/fcbdbcbd2f8abdb5880c6468a0c84

######################################################################## 100.0%

==> Pouring mosquitto-1.6.9.catalina.bottle.tar.gz

==> Caveats

mosquitto has been installed with a default configuration file.

You can make changes to the configuration by editing:

/usr/local/etc/mosquitto/mosquitto.conf

To have launchd start mosquitto now and restart at login:

brew services start mosquitto

Or, if you don't want/need a background service you can just run:

mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf

==> Summary

🍺 /usr/local/Cellar/mosquitto/1.6.9: 38 files, 997.1KB

==> Caveats

==> mosquitto

mosquitto has been installed with a default configuration file.

You can make changes to the configuration by editing:

/usr/local/etc/mosquitto/mosquitto.conf

To have launchd start mosquitto now and restart at login:

brew services start mosquitto

Or, if you don't want/need a background service you can just run:

mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf

(base)

Wed 1 Apr - 08:52  ~ 

@whatled  brew services start mosquitto

==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)

(base)

停止服务  brew services stop mosquitto

启动服务  brew services start mosquitto

mosquitto 服务器的配置环境文件路径 /usr/local/etc/mosquitto/mosquitto.conf

若连接不上mosquitto 服务器,可以检查配置文件

需要配置下mosquitto.conf ,解开IP和Port的注释

打开mosquitto.conf文件按照下面来配置你自己的IP和端口号

=================================================================

Default listener

=================================================================

IP address/hostname to bind the default listener to. If not

given, the default listener will not be bound to a specific

address and so will be accessible to all network interfaces.

bind_address ip-address/host name

#bind_address

Port to use for the default listener.

#port 1883

改成如下

bind_address 127.0.0.1

Port to use for the default listener.

port 1883

这边安装好后,启动用MQTTBox就可以直接连上了。

MacOs可以使用mqtt broker的软件:MQTTBox

post-8889.html

GitHub地址:https://github.com/workswithweb/MQTTBox

官网网站的介绍为:使用MQTTBox增强你的物联网流程

MQTT客户端特性

支持TCP、TLS、Web Sockets和安全的Web Sockets连接MQTT服务器

支持各种MQTT 客户端的设置

支持发布和订阅多个主题

支持主题的单级和多级订阅

复制/重新发布有效负载

支持查看每个主题已发布/已订阅消息的历史记录

MQTT负载测试

负载测试MQTT的架构(MQTT设备和服务器)

可以定义发布/订阅的消息的速率

为同一个测试用例创建最多10个实例

可在仪表面板查看实时情况

使用图表查看测试结果

查看所有的发送和接收的负载测试数据

这款软件支持在Windows、Mac和Linux上面运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值