迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:mqtt-cluster开源软件地址:https://gitee.com/quickmsg/mqtt-cluster开源软件介绍:
|
管理 | 说明 | 其他 |
---|---|---|
113.90.145.99:18886 | mqtt端口 | 用户名:smqtt 密码:smqtt |
113.90.145.99:18888 | mqtt over websocket | 用户名:smqtt 密码:smqtt |
http://113.90.145.99:18887/smqtt/admin | 管理后台 | 用户名:smqtt 密码:smqtt |
引入依赖
<!--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();
在smqtt-bootstrap/target目录下生成jar
准备配置文件 config.yaml
启动服务
java -jar smqtt-bootstrap-1.0.1-SNAPSHOT.jar <config.yaml路径>
拉取镜像
# 拉取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
引入依赖
<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文件
启动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>
一款非常好用的IOT平台 thinglinks:
Lemon877164954
,拉入smqtt官方交流群700152283
请发表评论