跳转到内容

快速开始

本文将帮助你在 5 分钟内快速启动并运行 smart-mqtt。

  • Java: JDK 8 或更高版本
  • 操作系统: Linux / Windows / macOS
  • Docker: (可选) 用于容器化部署

方式一:使用 Docker 部署(推荐)

Section titled “方式一:使用 Docker 部署(推荐)”

smart-mqtt 提供了 Docker 镜像,这是最简单的部署方式。

docker-compose.yaml
version: '3.8'
services:
smart-mqtt:
image: smartboot/smart-mqtt:latest
container_name: smart-mqtt
ports:
- "1883:1883"
- "18083:18083"

保存为 docker-compose.yml,然后执行:

Terminal window
docker-compose up -d
Terminal window
docker run -d \
--name smart-mqtt \
-p 1883:1883 \
-p 18083:18083 \
smartboot/smart-mqtt:latest

Gitee ReleasesGitHub Releases 下载最新版本的 smart-mqtt。

Terminal window
wget https://gitee.com/smartboot/smart-mqtt/releases/download/v1.5.1/smart-mqtt-full-v1.5.1.zip
unzip smart-mqtt-full-v1.5.1.zip
cd smart-mqtt-full-v1.5.1
Terminal window
./bin/start.sh
Terminal window
# 查看进程
ps aux | grep smart-mqtt
# 查看端口监听
netstat -tlnp | grep 1883

你可以使用任何 MQTT 客户端进行测试,例如 MQTT X 或命令行工具 mosquitto

Terminal window
# 订阅主题
mosquitto_sub -h localhost -p 1883 -t test/topic
# 发布消息(在另一个终端)
mosquitto_pub -h localhost -p 1883 -t test/topic -m "Hello smart-mqtt"

如果使用的是企业版,可以通过浏览器访问 Dashboard:

http://localhost:8083

默认账号密码:

  • 账号:smart-mqtt
  • 密码:smart-mqtt