|
1 | 1 | --- |
2 | | -title: smart-mqtt |
| 2 | +title: 快速开始 |
3 | 3 | --- |
4 | 4 |
|
5 | | -import {Card, CardGrid, LinkCard} from '@astrojs/starlight/components'; |
6 | | - |
7 | | -# smart-mqtt 文档中心 |
8 | | - |
9 | | -欢迎来到 smart-mqtt 的官方文档中心!smart-mqtt 是 smartboot 开源组织推出的商业化 MQTT Broker 产品,专为拥有上万级设备连接量的企业级物联网场景设计。 |
10 | | - |
11 | | -## 为什么选择 smart-mqtt? |
12 | | - |
13 | | -<CardGrid stagger> |
14 | | - <Card title="超高性能" icon="rocket"> |
15 | | - 单机支持百万级连接,消息吞吐量可达 790万/秒(QoS0),基于自研通信框架 smart-socket 打造。 |
16 | | - </Card> |
17 | | - <Card title="纯国产血统" icon="badge-check"> |
18 | | - 符合信创场景需求,底层采用自研通信框架,无外部依赖,代码可控。 |
19 | | - </Card> |
20 | | - <Card title="插件化架构" icon="puzzle"> |
21 | | - 基于事件总线的插件化设计,支持热插拔,可根据需求灵活扩展功能。 |
22 | | - </Card> |
23 | | - <Card title="轻量级" icon="feather"> |
24 | | - v1.4.0 版本包体积不足 800KB,资源占用低,部署简单。 |
25 | | - </Card> |
26 | | - <Card title="Java 生态" icon="seti:java"> |
27 | | - 基于 Java 开发,天然适合 Java 技术栈企业,易于集成和二次开发。 |
28 | | - </Card> |
29 | | - <Card title="企业级特性" icon="shield"> |
30 | | - 支持集群部署、数据持久化、数据桥接、WebSocket、Dashboard 等企业级功能。 |
31 | | - </Card> |
32 | | -</CardGrid> |
33 | | - |
34 | | -## 快速导航 |
35 | | - |
36 | | -<CardGrid> |
37 | | - <LinkCard |
38 | | - title="快速开始" |
39 | | - description="5分钟快速上手 smart-mqtt" |
40 | | - href="/smart-mqtt/getting-started/quickstart/" |
41 | | - /> |
42 | | - <LinkCard |
43 | | - title="产品手册" |
44 | | - description="了解产品特性、版本对比和使用说明" |
45 | | - href="/smart-mqtt/product/introduction/" |
46 | | - /> |
47 | | - <LinkCard |
48 | | - title="开发参考" |
49 | | - description="插件开发、事件总线等技术文档" |
50 | | - href="/smart-mqtt/development/plugin/" |
51 | | - /> |
52 | | -</CardGrid> |
53 | | - |
54 | | -## 社区与支持 |
55 | | - |
56 | | -- **代码仓库**: |
57 | | - - Gitee(主仓库):[https://gitee.com/smartboot/smart-mqtt](https://gitee.com/smartboot/smart-mqtt) |
58 | | - - Github(镜像):[https://github.com/smartboot/smart-mqtt](https://github.com/smartboot/smart-mqtt) |
59 | | -- **在线体验**:[http://115.190.30.166:8083/](http://115.190.30.166:8083/) |
60 | | - - 账号:smart-mqtt |
61 | | - - 密码:smart-mqtt |
| 5 | +本文将帮助你在 5 分钟内快速启动并运行 smart-mqtt。 |
62 | 6 |
|
63 | | ---- |
| 7 | +## 环境要求 |
| 8 | + |
| 9 | +- **Java**: JDK 8 或更高版本 |
| 10 | +- **操作系统**: Linux / Windows / macOS |
| 11 | +- **Docker**: (可选) 用于容器化部署 |
| 12 | + |
| 13 | +## 方式一:使用 Docker 部署(推荐) |
| 14 | + |
| 15 | +smart-mqtt 提供了 Docker 镜像,这是最简单的部署方式。 |
| 16 | + |
| 17 | +### 1. 使用 docker-compose |
| 18 | + |
| 19 | +```yaml |
| 20 | +version: '3.8' |
| 21 | +services: |
| 22 | + smart-mqtt: |
| 23 | + image: smartboot/smart-mqtt:latest |
| 24 | + container_name: smart-mqtt |
| 25 | + ports: |
| 26 | + - "1883:1883" |
| 27 | + - "8083:8083" |
| 28 | + environment: |
| 29 | + - TZ=Asia/Shanghai |
| 30 | + volumes: |
| 31 | + - ./data:/data |
| 32 | + restart: unless-stopped |
| 33 | +``` |
| 34 | +
|
| 35 | +保存为 `docker-compose.yml`,然后执行: |
| 36 | + |
| 37 | +```bash |
| 38 | +docker-compose up -d |
| 39 | +``` |
| 40 | + |
| 41 | +### 2. 直接运行 Docker 容器 |
| 42 | + |
| 43 | +```bash |
| 44 | +docker run -d \ |
| 45 | + --name smart-mqtt \ |
| 46 | + -p 1883:1883 \ |
| 47 | + -p 8083:8083 \ |
| 48 | + -e TZ=Asia/Shanghai \ |
| 49 | + -v $(pwd)/data:/data \ |
| 50 | + --restart unless-stopped \ |
| 51 | + smartboot/smart-mqtt:latest |
| 52 | +``` |
| 53 | + |
| 54 | +## 方式二:手动部署 |
| 55 | + |
| 56 | +### 1. 下载发行包 |
| 57 | + |
| 58 | +从 [Gitee Releases](https://gitee.com/smartboot/smart-mqtt/releases) 或 [GitHub Releases](https://github.com/smartboot/smart-mqtt/releases) 下载最新版本的 smart-mqtt。 |
| 59 | + |
| 60 | +```bash |
| 61 | +wget https://gitee.com/smartboot/smart-mqtt/releases/download/v1.4.0/smart-mqtt-1.4.0.tar.gz |
| 62 | +tar -xzf smart-mqtt-1.4.0.tar.gz |
| 63 | +cd smart-mqtt-1.4.0 |
| 64 | +``` |
| 65 | + |
| 66 | +### 2. 启动服务 |
| 67 | + |
| 68 | +```bash |
| 69 | +./bin/start.sh |
| 70 | +``` |
| 71 | + |
| 72 | +Windows 用户请运行: |
| 73 | + |
| 74 | +```bash |
| 75 | +bin/start.bat |
| 76 | +``` |
| 77 | + |
| 78 | +## 验证部署 |
| 79 | + |
| 80 | +### 1. 检查服务状态 |
| 81 | + |
| 82 | +```bash |
| 83 | +# 查看进程 |
| 84 | +ps aux | grep smart-mqtt |
| 85 | +
|
| 86 | +# 查看端口监听 |
| 87 | +netstat -tlnp | grep 1883 |
| 88 | +``` |
| 89 | + |
| 90 | +### 2. 使用 MQTT 客户端测试 |
| 91 | + |
| 92 | +你可以使用任何 MQTT 客户端进行测试,例如 [MQTT X](https://mqttx.app/) 或命令行工具 `mosquitto`: |
| 93 | + |
| 94 | +```bash |
| 95 | +# 订阅主题 |
| 96 | +mosquitto_sub -h localhost -p 1883 -t test/topic |
| 97 | +
|
| 98 | +# 发布消息(在另一个终端) |
| 99 | +mosquitto_pub -h localhost -p 1883 -t test/topic -m "Hello smart-mqtt" |
| 100 | +``` |
| 101 | + |
| 102 | +## 访问 Dashboard |
| 103 | + |
| 104 | +如果使用的是企业版,可以通过浏览器访问 Dashboard: |
| 105 | + |
| 106 | +``` |
| 107 | +http://localhost:8083 |
| 108 | +``` |
| 109 | +
|
| 110 | +默认账号密码: |
| 111 | +- 账号:`smart-mqtt` |
| 112 | +- 密码:`smart-mqtt` |
| 113 | +
|
| 114 | +## 下一步 |
| 115 | +
|
| 116 | +- [产品手册](/smart-mqtt/product/introduction/) - 深入了解 smart-mqtt 的功能特性 |
| 117 | +- [插件开发](/smart-mqtt/development/plugin/) - 学习如何开发自定义插件 |
| 118 | +- [性能压测](/smart-mqtt/development/benchmark/) - 了解如何进行性能测试 |
| 119 | +
|
| 120 | +## 常见问题 |
| 121 | +
|
| 122 | +### Q: 启动失败,提示端口被占用? |
| 123 | +A: 检查 1883(MQTT)或 8083(HTTP/Dashboard)端口是否已被其他服务占用。 |
| 124 | +
|
| 125 | +### Q: 如何修改默认配置? |
| 126 | +A: 编辑 `conf/smart-mqtt.properties` 文件,重启服务生效。 |
64 | 127 |
|
65 | | -:::tip[开源不易] |
66 | | -我们始于热爱,敬于技术,更要忠于生活。smart-mqtt 探索商业化路线是为了让项目能够持续发展,为用户提供更好的服务。 |
67 | | -::: |
| 128 | +### Q: 如何查看日志? |
| 129 | +A: 日志文件位于 `logs/` 目录下,可以通过 `tail -f logs/smart-mqtt.log` 实时查看。 |
0 commit comments