README.md 6.9 KB
Newer Older
L
md  
luxurong 已提交
1
## ![image](icon/logo.png) SMQTT开源的MQTT消息代理Broker
L
luxurong 已提交
2

L
luxurong 已提交
3 4
SMQTT基于reactor-netty(spring-webflux底层依赖)开发,底层采用Reactor3反应堆模型,支持单机部署,支持容器化部署,具备低延迟,高吞吐量,支持百万TCP连接,同时支持多种协议交互,是一款非常优秀的消息中间件!

L
luxurong 已提交
5
## smqtt目前拥有的功能如下:
L
icon  
luxurong 已提交
6
![架构图](icon/component.png)
L
luxurong 已提交
7

L
luxurong 已提交
8

L
luxurong 已提交
9 10
1. 消息质量等级实现(支持qos0,qos1,qos2)
2. topicFilter支持
L
luxurong 已提交
11 12 13
    - topic分级(test/test)
    - +支持(单层匹配)
    - #支持(多层匹配)
L
luxurong 已提交
14
3. 会话消息
L
luxurong 已提交
15 16
    - 默认内存存储
    - 支持持久化(redis/db)
L
luxurong 已提交
17
4. 保留消息
L
luxurong 已提交
18 19
     - 默认内存存储
     - 支持持久化(redis/db)
L
luxurong 已提交
20
5. 遗嘱消息
L
luxurong 已提交
21
     > 设备掉线时候触发
L
luxurong 已提交
22
6. 客户端认证
L
luxurong 已提交
23
     - 支持spi注入外部认证
L
luxurong 已提交
24
7. tls加密
L
luxurong 已提交
25
     - 支持tls加密(mqtt端口/http端口)
L
luxurong 已提交
26
8. websocket协议支持x
1ssqq1lxr's avatar
1ssqq1lxr 已提交
27
     > 使用mqtt over websocket
L
luxurong 已提交
28
9. http协议交互
L
luxurong 已提交
29 30
    - 支持http接口推送消息
    - 支持spi扩展http接口
L
luxurong 已提交
31 32 33 34 35 36 37
10. SPI接口扩展支持
     - 消息管理接口(会话消息/保留消息管理)
     - 通道管理接口 (管理系统的客户端连接)
     - 认证接口 (用于自定义外部认证)
     - 拦截器  (用户自定义拦截消息)
11. 集群支持(gossip协议实现)
12. 容器化支持 
L
luxurong 已提交
38
    > 默认镜像最新tag: 1ssqq1lxr/smqtt
L
luxurong 已提交
39 40 41 42
13. 持久化支持(session 保留消息)
14. 规则引擎支持(文档需要赞助提供)
15. 支持springboot starter启动
16. 管理后台
L
luxurong 已提交
43
    > 请参考smqtt文档如何启动管理后台
L
luxurong 已提交
44 45 46 47
17. grafana监控集成
    - 支持influxdb
    - 支持prometheus
    
L
luxurong 已提交
48
## 尝试一下
L
luxurong 已提交
49

L
luxurong 已提交
50 51 52 53 54 55 56
> 大家不要恶意链接,谢谢!

|  管理   | 说明  | 其他  |
|  ----  | ----  |----  |
| 123.57.69.210:1883  | mqtt端口 |用户名:smqtt 密码:smqtt |
| 123.57.69.210:8999  | mqtt over websocket |用户名:smqtt 密码:smqtt  |
| http://123.57.69.210:60000/smqtt/admin | 管理后台 |用户名:smqtt 密码:smqtt  |
L
luxurong 已提交
57

L
md  
luxurong 已提交
58
## 启动方式
L
luxurong 已提交
59

L
md  
luxurong 已提交
60
### main方式启动
L
luxurong 已提交
61 62 63

引入依赖
```markdown
L
luxurong 已提交
64
<!--smqtt依赖 -->
L
luxurong 已提交
65 66 67
<dependency>
  <groupId>io.github.quickmsg</groupId>
  <artifactId>smqtt-core</artifactId>
1ssqq1lxr's avatar
port  
1ssqq1lxr 已提交
68
  <version>${Latest version}</version>
L
luxurong 已提交
69
</dependency>
L
luxurong 已提交
70 71 72 73
<!--集群依赖 -->
<dependency>
   <artifactId>smqtt-registry-scube</artifactId>
   <groupId>io.github.quickmsg</groupId>
1ssqq1lxr's avatar
port  
1ssqq1lxr 已提交
74
   <version>${Latest version}</version>
L
luxurong 已提交
75 76 77 78 79
</dependency>
<!--管理ui依赖 -->
<dependency>
   <artifactId>smqtt-ui</artifactId>
   <groupId>io.github.quickmsg</groupId>
1ssqq1lxr's avatar
port  
1ssqq1lxr 已提交
80
   <version>${Latest version}</version>
L
luxurong 已提交
81
</dependency>
L
luxurong 已提交
82 83
```

L
md  
luxurong 已提交
84
- 阻塞式启动服务:
L
luxurong 已提交
85 86

```markdown
L
luxurong 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
  Bootstrap bootstrap = Bootstrap.builder()
                .rootLevel(Level.DEBUG)
                .tcpConfig(
                        BootstrapConfig
                                .TcpConfig
                                .builder()
                                .port(8888)
                                .username("smqtt")
                                .password("smqtt")
                                .build())
                .httpConfig(
                        BootstrapConfig
                                .HttpConfig
                                .builder()
                                .enable(true)
                                .accessLog(true)
                                .build())
                .clusterConfig(
                        BootstrapConfig.
                                ClusterConfig
                                .builder()
                                .enable(true)
                                .namespace("smqtt")
                                .node("node-1")
1ssqq1lxr's avatar
1ssqq1lxr 已提交
111
                                .port(7773)
L
luxurong 已提交
112 113 114 115
                                .url("127.0.0.1:7771,127.0.0.1:7772").
                                build())
                .build()
                .startAwait();
L
luxurong 已提交
116 117
```

L
md  
luxurong 已提交
118
- 非阻塞式启动服务:
L
luxurong 已提交
119 120

```markdown
L
luxurong 已提交
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145

  Bootstrap bootstrap = Bootstrap.builder()
                .rootLevel(Level.DEBUG)
                .tcpConfig(
                        BootstrapConfig
                                .TcpConfig
                                .builder()
                                .port(8888)
                                .username("smqtt")
                                .password("smqtt")
                                .build())
                .httpConfig(
                        BootstrapConfig
                                .HttpConfig
                                .builder()
                                .enable(true)
                                .accessLog(true)
                                .build())
                .clusterConfig(
                        BootstrapConfig.
                                ClusterConfig
                                .builder()
                                .enable(true)
                                .namespace("smqtt")
                                .node("node-1")
1ssqq1lxr's avatar
1ssqq1lxr 已提交
146
                                .port(7773)
L
luxurong 已提交
147 148 149 150
                                .url("127.0.0.1:7771,127.0.0.1:7772").
                                build())
                .build()
                .start().block();
L
luxurong 已提交
151 152
```

L
md  
luxurong 已提交
153
### jar方式
L
luxurong 已提交
154

1ssqq1lxr's avatar
1ssqq1lxr 已提交
155
1. 下载源码 mvn compile package -Dmaven.test.skip=true -P jar,web
L
luxurong 已提交
156

L
luxurong 已提交
157 158 159
```markdown
  在smqtt-bootstrap/target目录下生成jar
```
L
luxurong 已提交
160

L
yaml  
luxurong 已提交
161
2. 准备配置文件 config.yaml
L
luxurong 已提交
162

L
doc  
luxurong 已提交
163
   [config.yaml](config.yaml)
L
luxurong 已提交
164

1ssqq1lxr's avatar
1ssqq1lxr 已提交
165
3. 启动服务
L
luxurong 已提交
166

L
luxurong 已提交
167
```markdown
L
yaml  
luxurong 已提交
168
  java -jar smqtt-bootstrap-1.0.1-SNAPSHOT.jar <config.yaml路径>
L
luxurong 已提交
169
```
L
luxurong 已提交
170 171 172



L
md  
luxurong 已提交
173
### docker 方式
L
luxurong 已提交
174

L
luxurong 已提交
175 176

拉取镜像
L
luxurong 已提交
177 178

``` 
L
luxurong 已提交
179
# 拉取docker镜像地址
L
luxurong 已提交
180 181 182
docker pull 1ssqq1lxr/smqtt:latest
```

L
luxurong 已提交
183
启动镜像默认配置
L
luxurong 已提交
184 185

``` 
L
luxurong 已提交
186
# 启动服务
L
luxurong 已提交
187 188 189
docker run -it  -p 1883:1883 1ssqq1lxr/smqtt
```

1
1091927336@qq.com 已提交
190
启动镜像使用自定义配置(同上准备配置文件config.yaml)
L
luxurong 已提交
191 192 193 194 195 196 197 198 199


``` 
# 启动服务
docker run -it  -v <配置文件路径目录>:/conf -p 1883:1883  -p 1999:1999 1ssqq1lxr/smqtt
```



L
md  
luxurong 已提交
200
### springboot方式
L
luxurong 已提交
201

L
md  
luxurong 已提交
202 203 204 205 206 207 208
1. 引入依赖
   
    ```markdown
    <dependency>
        <groupId>io.github.quickmsg</groupId>
        <artifactId>smqtt-spring-boot-starter</artifactId>
        <version>${Latest version >= 1.0.8}</version>
L
luxurong 已提交
209
    </dependency>
L
md  
luxurong 已提交
210
    ```
L
luxurong 已提交
211

L
md  
luxurong 已提交
212 213 214
2. 启动类Application上添加注解 `  @EnableMqttServer`

3. 配置application.yml文件
L
luxurong 已提交
215
     > properties也支持,但是需要自己转换,没有提供demo文件 
L
md  
luxurong 已提交
216

L
luxurong 已提交
217
   [config.yaml](config/config.yaml)
1ssqq1lxr's avatar
1ssqq1lxr 已提交
218

L
luxurong 已提交
219
5. 启动springboot服务服务即可
L
luxurong 已提交
220

L
doc  
luxurong 已提交
221
## 官网地址
L
luxurong 已提交
222

L
doc  
luxurong 已提交
223
[smqtt官网](https://www.smqtt.cc/)
1ssqq1lxr's avatar
pages  
1ssqq1lxr 已提交
224

L
doc  
luxurong 已提交
225
## wiki地址
L
luxurong 已提交
226

L
doc  
luxurong 已提交
227
[wiki地址](https://wiki.smqtt.cc/)
L
version  
luxurong 已提交
228

L
luxurong 已提交
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247

## 管理后台
![image](icon/admin.png)


## 监控页面

### Mqtt监控
![image](icon/application.png)


### Jvm监控
![image](icon/jvm.png)

### Netty监控
![image](icon/netty.png)



L
luxurong 已提交
248
## License
L
luxurong 已提交
249

L
doc  
luxurong 已提交
250
[Apache License, Version 2.0](LICENSE)
L
luxurong 已提交
251

L
luxurong 已提交
252

L
luxurong 已提交
253
## 相关技术文档
L
event  
luxurong 已提交
254 255
- [reactor3](https://projectreactor.io/docs/core/release/reference/)
- [reactor-netty](https://projectreactor.io/docs/netty/1.0.12/reference/index.html)
L
luxurong 已提交
256

1ssqq1lxr's avatar
pages  
1ssqq1lxr 已提交
257
## 麻烦关注下公众号!
L
luxurong 已提交
258
![image](icon/icon.jpg)
L
luxurong 已提交
259

1ssqq1lxr's avatar
pages  
1ssqq1lxr 已提交
260 261 262 263
- 添加微信号`Lemon877164954`,拉入smqtt官方交流群
- 加入qq群 `700152283`