NoSQL database case combat--Redis password protection

Redis password protection

Preface

This environment is based on the Centos 7.8 system to build a Redis learning environment. For
specific construction, please refer to Redis-5.0.9 Environment Deployment

Set a password for the redis server, so that the client connection to the redis service requires password authentication, which can make your redis service more secure.


See the redis password

192.168.5.12:6379> config get requirepass
1) "requirepass"
2) ""

Temporary setting

192.168.5.12:6379> config set requirepass '123'
OK
192.168.5.12:6379> auth 123
OK
192.168.5.12:6379> config get requirepass
1) "requirepass"
2) "123"

Permanently set

[root@reids_source_code ~]# vim /etc/redis/redis.conf 
[root@reids_source_code ~]# systemctl restart redis
# 登录一
[root@reids_source_code ~]# redis-cli -h 192.168.5.12 
192.168.5.12:6379> auth 123
OK
192.168.5.12:6379> config get requirepass
1) "requirepass"
2) "123"
# 登录二
[root@reids_source_code ~]# redis-cli -h 192.168.5.12 -a 123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.5.12:6379> config get requirepass
1) "requirepass"
2) "123"

Note: the redis service password is saved in plain text

Guess you like

Origin blog.csdn.net/XY0918ZWQ/article/details/113803035