快速开始
本文将帮助你在 5 分钟内快速启动并运行 smart-mqtt。
- Java: JDK 8 或更高版本
- 操作系统: Linux / Windows / macOS
- Docker: (可选) 用于容器化部署
方式一:使用 Docker 部署(推荐)
Section titled “方式一:使用 Docker 部署(推荐)”smart-mqtt 提供了 Docker 镜像,这是最简单的部署方式。
1. 使用 docker-compose
Section titled “1. 使用 docker-compose”version: '3.8'services: smart-mqtt: image: smartboot/smart-mqtt:latest container_name: smart-mqtt ports: - "1883:1883" - "18083:18083"保存为 docker-compose.yml,然后执行:
docker-compose up -d2. 直接运行 Docker 容器
Section titled “2. 直接运行 Docker 容器”docker run -d \ --name smart-mqtt \ -p 1883:1883 \ -p 18083:18083 \ smartboot/smart-mqtt:latest方式二:手动部署
Section titled “方式二:手动部署”1. 下载发行包
Section titled “1. 下载发行包”从 Gitee Releases 或 GitHub Releases 下载最新版本的 smart-mqtt。
wget https://gitee.com/smartboot/smart-mqtt/releases/download/v1.5.1/smart-mqtt-full-v1.5.1.zipunzip smart-mqtt-full-v1.5.1.zipcd smart-mqtt-full-v1.5.12. 启动服务
Section titled “2. 启动服务”./bin/start.sh1. 检查服务状态
Section titled “1. 检查服务状态”# 查看进程ps aux | grep smart-mqtt
# 查看端口监听netstat -tlnp | grep 18832. 使用 MQTT 客户端测试
Section titled “2. 使用 MQTT 客户端测试”你可以使用任何 MQTT 客户端进行测试,例如 MQTT X 或命令行工具 mosquitto:
# 订阅主题mosquitto_sub -h localhost -p 1883 -t test/topic
# 发布消息(在另一个终端)mosquitto_pub -h localhost -p 1883 -t test/topic -m "Hello smart-mqtt"访问 Dashboard
Section titled “访问 Dashboard”如果使用的是企业版,可以通过浏览器访问 Dashboard:
http://localhost:8083默认账号密码:
- 账号:
smart-mqtt - 密码:
smart-mqtt