Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure redis sentinel mode in emqx? #199

Open
983674707 opened this issue Feb 7, 2021 · 0 comments
Open

How to configure redis sentinel mode in emqx? #199

983674707 opened this issue Feb 7, 2021 · 0 comments

Comments

@983674707
Copy link

983674707 commented Feb 7, 2021

How to configure redis sentinel password?

  • redis password: 123456
  • redis-sentinel password: 654321

emqx_auth_redis.conf

emqx version: 4.2.5

##--------------------------------------------------------------------
## Redis Auth/ACL Plugin
##--------------------------------------------------------------------
## Redis Server cluster type
## single    Single redis server
## sentinel  Redis cluster through sentinel
## cluster   Redis through cluster
auth.redis.type = sentinel

## Redis server address.
##
## Value: Port | IP:Port
##
## Single Redis Server: 127.0.0.1:6379, localhost:6379
## Redis Sentinel: 127.0.0.1:26379,127.0.0.2:26379,127.0.0.3:26379
## Redis Cluster: 127.0.0.1:6379,127.0.0.2:6379,127.0.0.3:6379
auth.redis.server = 127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381

## Redis sentinel cluster name.
##
## Value: String
auth.redis.sentinel = mymaster 

## Redis pool size.
##
## Value: Number
auth.redis.pool = 8

## Redis database no.
##
## Value: Number
auth.redis.database = 0

## Redis password.
##
## Value: String
auth.redis.password = 123456

## Redis query timeout
##
## Value: Duration
## auth.redis.query_timeout = 5s

## Authentication query command.
##
## Value: Redis cmd
##
## Variables:
##  - %u: username
##  - %c: clientid
##  - %C: common name of client TLS cert
##  - %d: subject of client TLS cert
##
## Examples:
##  - HGET mqtt_user:%u password
##  - HMGET mqtt_user:%u password
##  - HMGET mqtt_user:%u password salt
auth.redis.auth_cmd = HMGET mqtt_user:%u password

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

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

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

## bcrypt with salt prefix
## auth.redis.password_hash = salt,bcrypt

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

## Superuser query command.
##
## Value: Redis cmd
##
## Variables:
##  - %u: username
##  - %c: clientid
##  - %C: common name of client TLS cert
##  - %d: subject of client TLS cert
auth.redis.super_cmd = HGET mqtt_user:%u is_superuser

## ACL query command.
##
## Value: Redis cmd
##
## Variables:
##  - %u: username
##  - %c: clientid
auth.redis.acl_cmd = HGETALL mqtt_acl:%u

emqx_ctl plugins reload emqx_auth_redis

Reload plugin emqx_auth_redis error: {emqx_auth_redis,
                                      {bad_return,
                                       {{emqx_auth_redis_app,start,
                                         [normal,[]]},
                                        {'EXIT',
                                         {{badmatch,
                                           {error,
                                            {shutdown,
                                             {failed_to_start_child,
                                              emqx_auth_redis,
                                              {shutdown,
                                               {failed_to_start_child,
                                                worker_sup,
                                                {shutdown,
                                                 {failed_to_start_child,
                                                  {worker,1},
                                                  {sentinel_error,
                                                   sentinel_unreachable}}}}}}}}},
                                          [{emqx_auth_redis_app,start,2,
                                            [{file,"emqx_auth_redis_app.erl"},
                                             {line,30}]},
                                           {application_master,start_it_old,
                                            4,
                                            [{file,"application_master.erl"},
                                             {line,277}]}]}}}}}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant