redisredis-clustersentinelredis-sentinelredis-server

How to set password for redis-server


I have a 3-instance high availability redis deployed. On each server I have redis and sentinel installed. I am trying to set a password so that it requests it at the moment of entering with the command "redis-cli".

I am modifying the value of the "requirepass" parameter of the "redis.conf" file.

requirepass password123

Also inside the redis terminal, I am setting the password with the following commands

config set requirepass password123
auth password123

When I connect with the following command

redis-cli --tls --cert /<path>/redis.crt --key /<path>/redis.key --cacert /<path>/ca.crt -a password123

It works fine, my problem is when I restart the redis service, for some reason the password settings are not kept and I get the following message

Warning: AUTH failed

I do not know what configuration I need to do so that the change is maintained after restarting the redis service.

The version of redis that I have installed is "Redis server v=6.0.6"


Solution

  • Check your ACL configuration,Your requirepass configuration will be ignored with ACL operation. I get follow infomation from redis.conf example file.

    IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility layer on top of the new ACL system. The option effect will be just setting the password for the default user. Clients will still authenticate using AUTH as usually, or more explicitly with AUTH default if they follow the new protocol: both will work. The requirepass is not compatable with aclfile option and the ACL LOAD command, these will cause requirepass to be ignored.