redis用户验证
1配置密码认证功能
vim /opt/redis_6379/conf/redis_6379.conf
requirepass 123456
2使用密码登陆
方式1:
[root@elk101 ~]# redis-cli
127.0.0.1:6379> set k1 v1
(error) NOAUTH Authentication required.
127.0.0.1:6379> AUTH 123456
OK
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> KEYS *
1) "k1"
方式2:
[root@elk101 ~]# redis-cli -a '123456' get k1
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
"v1"