当前位置:   article > 正文

springboot集成mqtt(emqx)_springboot emqx

springboot emqx
emqx官网下载地址 :https://www.emqx.io/zh

选择开源版本 就够用

这里有各种操作系统版本供选择

先来windows 配置

下载完成后安装进入bin目录

直接cmd  

  1. .\emqx.cmd console //控制台启动
  2. .\emqx.cmd start //后台启动
  1. 启动完成 访问localhost:18083 默认控制台web端口
  2. 默认控制台账号密码 admin public
  3. 默认长连接 tcp://localhost:1883

 这里因为只有一台电脑就直接搭建伪集群了

  1. windows集群搭建
  2. //node称之为节点 name节点名称 每个节点唯一 cookie 当搭建集群时 cookie 是节点通信的关键
  3. node {
  4. name = "emqx2@127.0.0.1"
  5. cookie = "emqxsecretcookie"
  6. data_dir = "data"
  7. }
  8. //集群配置 name集群名称 集群下所有的节点都是这个名称 static静态配置集权节点 seeds 节点信息
  9. cluster {
  10. name = emqxcl
  11. discovery_strategy = static
  12. static {
  13. seeds = ["emqx@127.0.0.1","emqx2@127.0.0.1"]
  14. }
  15. }
  16. //默认监听端口tcp max_connections 最大连接数
  17. listeners.tcp.default{
  18. bind = "0.0.0.0:1885"
  19. max_connections = 1024000
  20. }
  21. listeners.ws.default{
  22. bind = "0.0.0.0:8085"
  23. }
  24. listeners.ssl.default{
  25. bind = "0.0.0.0:8885"
  26. }
  27. listeners.wss.default{
  28. bind = "0.0.0.0:8086"
  29. }
  30. //默认控制台端口
  31. dashboard {
  32. listeners.http {
  33. bind = 18084
  34. }
  35. }
  36. 这里修改端口是防止端口被占用
  1. node {
  2. name = "emqx@127.0.0.1"
  3. cookie = "emqxsecretcookie"
  4. data_dir = "data"
  5. }
  6. cluster {
  7. name = emqxcl
  8. discovery_strategy = static
  9. static {
  10. seeds = ["emqx@127.0.0.1","emqx2@127.0.0.1"]
  11. }
  12. }
  13. dashboard {
  14. listeners.http {
  15. bind = 18083
  16. }
  17. }
  18. 因为刚刚的实例已经把端口分开了这里直接使用默认端口了,这样集群就实现了

下期发布linux docker搭建emqx(单个以及集群)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/748085
推荐阅读
相关标签
  

闽ICP备14008679号