centos emqttd 笔记

使用rpm包安装,可以到官网(“http://www.emqtt.com/downloads”)下载

配置文件目录:/etc/emqttd/

修改配置文件,如下:

## Allow Anonymous Authentication.

##
## Notice: Disable the option for production deployment.
##
## Value: true | false

mqtt.allow_anonymous = false


## Maximum MQTT packet size allowed.

##
## Value: Bytes
##
## Default: 64K

mqtt.max_packet_size = 6400KB

使用mysql插件进行认证,需要关闭其他认证插件;需要注意用户口令是否需要加密以及加密方式“auth.mysql.password_hash = plain

##--------------------------------------------------------------------
## MySQL Auth/ACL Plugin
##--------------------------------------------------------------------


## MySQL server address.
##
## Value: Port | IP:Port
##
## Examples: 3306, 127.0.0.1:3306, localhost:3306
auth.mysql.server = 127.0.0.1:3306


## MySQL pool size.
##
## Value: Number
auth.mysql.pool = 8


## MySQL username.
##
## Value: String
auth.mysql.username = root


## MySQL password.
##
## Value: String
## auth.mysql.password =


## MySQL database.
##
## Value: String
auth.mysql.database = emqttd


## Variables: %u = username, %c = clientid


## Authentication query.
##
## Note that column names should be 'password' and 'salt' (if used).
## In case column names differ in your DB - please use aliases,
## e.g. "my_column_name as password".
##
## Value: SQL
##
## Variables:
##  - %u: username
##  - %c: clientid
##
auth.mysql.auth_query = select password from mqtt_user where username = '%u' limit 1
## auth.mysql.auth_query = select password_hash as password from mqtt_user where username = '%u' limit 1


## Password hash.
##
## Value: plain | md5 | sha | sha256 | bcrypt
auth.mysql.password_hash = plain


## sha256 with salt prefix
## auth.mysql.password_hash = salt,sha256


## bcrypt with salt only prefix
## auth.mysql.password_hash = salt,bcrypt


## sha256 with salt suffix
## auth.mysql.password_hash = sha256,salt


## pbkdf2 with macfun iterations dklen
## macfun: md4, md5, ripemd160, sha, sha224, sha256, sha384, sha512
## auth.mysql.password_hash = pbkdf2,sha256,1000,20


## Superuser query.
##
## Value: SQL
##
## Variables:
##  - %u: username
##  - %c: clientid
auth.mysql.super_query = select is_superuser from mqtt_user where username = '%u' limit 1


## ACL query.
##
## Value: SQL
##
## Variables:
##  - %a: ipaddr
##  - %u: username
##  - %c: clientid
auth.mysql.acl_query = select allow, ipaddr, username, clientid, access, topic from mqtt_acl where ipaddr = '%a' or username = '%u' or username = '$all' or clientid = '%c'


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值