jar启动

# jar包启动

  1. 下载源码

     git clone https://gitee.com/quickmsg/mqtt-cluster
     git clone https://github.com/quickmsg/smqtt
    
    1
    2
  2. 打包

    1. smqtt-ui安装前端依赖

        npm install
      
      1
    2. 打包java代码

       mvn compile package -Dmaven.test.skip=true -P jar,web
      
      1

      在smqtt-bootstrap/target目录下生成jar包

或者直接去下载最新的jar

  • https://github.com/quickmsg/smqtt/releases
  • https://gitee.com/quickmsg/mqtt-cluster/releases
  1. 准备配置文件

    选择空目录下新建一个config.yaml文件

     smqtt:
       logLevel: DEBUG # 系统日志
       tcp: # tcp配置
         port: 1883 # mqtt端口号
         wiretap: true  # 二进制日志 前提是 smqtt.logLevel = DEBUG
         bossThreadSize: 4  # boss线程
         workThreadSize: 8  # work线程
         lowWaterMark: 4000000 # 不建议配置 默认 32768
         highWaterMark: 80000000 # 不建议配置 默认 65536
         businessThreadSize: 16 # 业务线程数 默认=cpu核心数*10
         businessQueueSize: 100000 #业务队列 默认=100000
       # globalReadWriteSize: 10000000,100000000  全局读写大小限制
       # channelReadWriteSize: 10000000,100000000 单个channel读写大小限制
         ssl: # ssl配置
           enable: false # 开关
           key: /user/server.key # 指定ssl文件 默认系统生成
           crt: /user/server.crt # 指定ssl文件 默认系统生成
       http: # http相关配置 端口固定60000
         enable: true # 开关
         accessLog: true # http访问日志
         ssl: # ssl配置
           enable: false
         admin: # 后台管理配置
           enable: true  # 开关
           username: smqtt # 访问用户名
           password: smqtt # 访问密码
       ws: # websocket配置
         enable: true # 开关
         port: 8999 # 端口
         path: /mqtt # ws 的访问path mqtt.js请设置此选项
       cluster: # 集群配置
         enable: false # 集群开关
         url: 127.0.0.1:7771,127.0.0.1:7772 # 启动节点
         port: 7771  # 端口
         node: node-1 # 集群节点名称 唯一
         external:
           host: localhost # 用于映射容器ip 请不要随意设置,如果不需要请移除此选项
           port: 7777 # 用于映射容器端口 请不要随意设置,如果不需要请移除此选项
     db: # 数据库相关设置 请参考 https://doc.smqtt.cc/%E5%85%B6%E4%BB%96/1.store.html 【如果没有引入相关依赖请移除此配置】
       driverClassName: com.mysql.jdbc.Driver
       url: jdbc:mysql://127.0.0.1:3306/smqtt?characterEncoding=utf-8&useSSL=false&useInformationSchema=true&serverTimezone=UTC
       username: root
       password: 123
       initialSize: 10
       maxActive: 300
       maxWait: 60000
       minIdle: 2
     redis: # redis 请参考 https://doc.smqtt.cc/%E5%85%B6%E4%BB%96/1.store.html 【如果没有引入相关依赖请移除此配置】
       mode: single
       database: 0
       password:
       timeout: 3000
       poolMinIdle: 8
       poolConnTimeout: 3000
       poolSize: 10
       single:
         address: 127.0.0.1:6379
       cluster:
         scanInterval: 1000
         nodes: 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003,127.0.0.1:7004,127.0.0.1:7005
         readMode: SLAVE
         retryAttempts: 3
         slaveConnectionPoolSize: 64
         masterConnectionPoolSize: 64
         retryInterval: 1500
       sentinel:
         master: mymaster
         nodes: 127.0.0.1:26379,127.0.0.1:26379,127.0.0.1:26379
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
  2. 启动服务

       java -jar smqtt-bootstrap-1.0.1-SNAPSHOT.jar <conf.yaml路径>
    
    1
Last Updated: 5/28/2022, 2:44:06 PM