启动方式
main方式启动
引入依赖
<!--smqtt依赖 -->
<dependency>
<groupId>io.github.quickmsg</groupId>
<artifactId>smqtt-core</artifactId>
<version>${Latest version}</version>
</dependency>
<!--集群依赖 -->
<dependency>
<artifactId>smqtt-registry-scube</artifactId>
<groupId>io.github.quickmsg</groupId>
<version>${Latest version}</version>
</dependency>
<!--管理ui依赖 -->
<dependency>
<artifactId>smqtt-ui</artifactId>
<groupId>io.github.quickmsg</groupId>
<version>${Latest version}</version>
</dependency>
Bootstrap.builder()
.rootLevel(Level.INFO)
.websocketConfig(
BootstrapConfig.WebsocketConfig
.builder()
.enable(false)
.path("/mqtt")
.port(8888)
.build()
)
.tcpConfig(
BootstrapConfig
.TcpConfig
.builder()
.port(1883)
.ssl(SslContext.builder().enable(false).build())
.build())
.httpConfig(
BootstrapConfig
.HttpConfig
.builder()
.enable(false)
.accessLog(true)
.admin(BootstrapConfig.HttpAdmin.builder().enable(true).username("smqtt").password("smqtt").build())
.build())
.clusterConfig(
BootstrapConfig.
ClusterConfig
.builder()
.enable(false)
.namespace("smqtt")
.node("node-1")
.port(7773)
.url("127.0.0.1:7771,127.0.0.1:7772").
build())
.build()
.startAwait();
Bootstrap bootstrap = Bootstrap.builder()
.rootLevel(Level.INFO)
.websocketConfig(
BootstrapConfig.WebsocketConfig
.builder()
.enable(false)
.path("/mqtt")
.port(8888)
.build()
)
.tcpConfig(
BootstrapConfig
.TcpConfig
.builder()
.port(1883)
.ssl(SslContext.builder().enable(false).build())
.build())
.httpConfig(
BootstrapConfig
.HttpConfig
.builder()
.enable(false)
.accessLog(true)
.admin(BootstrapConfig.HttpAdmin.builder().enable(true).username("smqtt").password("smqtt").build())
.build())
.clusterConfig(
BootstrapConfig.
ClusterConfig
.builder()
.enable(false)
.namespace("smqtt")
.node("node-1")
.port(7773)
.url("127.0.0.1:7771,127.0.0.1:7772").
build())
.build()
.start().block();
jar方式
- 下载源码 mvn compile package -Dmaven.test.skip=true -P jar,web
在smqtt-bootstrap/target目录下生成jar
-
准备配置文件 config.yaml
config.yaml
-
启动服务
java -jar smqtt-bootstrap-1.0.1-SNAPSHOT.jar <config.yaml路径>
docker 方式
拉取镜像
# 拉取docker镜像地址
docker pull 1ssqq1lxr/smqtt:latest
启动镜像默认配置
# 启动服务
docker run -it -p 1883:1883 1ssqq1lxr/smqtt
启动镜像使用自定义配置(同上准备配置文件config.yaml)
# 启动服务
docker run -it -v <配置文件路径目录>:/conf -p 1883:1883 -p 1999:1999 1ssqq1lxr/smqtt
springboot方式
-
引入依赖
<dependency>
<groupId>io.github.quickmsg</groupId>
<artifactId>smqtt-spring-boot-starter</artifactId>
<version>${Latest version >= 1.0.8}</version>
</dependency>
-
启动类Application上添加注解 @EnableMqttServer
-
配置application.yml文件
properties也支持,但是需要自己转换,没有提供demo文件
config.yaml
-
启动springboot服务服务即可
-
如果引入的是spring-boot-starter-parent的管理包,如果启动报错,则需要添加以下依赖
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.9</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>1.0.10</version>
</dependency>
官网地址
wiki地址
管理后台
image
监控页面
Mqtt监控
image
Jvm监控
image
Netty监控
image
License
Apache License, Version 2.0
商业版本
友情链接
一款非常好用的IOT平台 thinglinks:
相关技术文档
麻烦关注下公众号!
image
- 添加微信号
Lemon877164954,拉入smqtt官方交流群
- 加入qq群
700152283
|