Redis After successful installation, the default is not set to start redis-cli, no authentication password may be operated directly, as follows:
redis-cli 127.0.0.1:6379>
1, set a password
Before redis has been set for the self-starting, and configuration files in the /etc/redis/6379.conf
Use vim editor 6379.conf, find the following line
Requirepass foobared # # add a line to set a password for requirepass 123456 123456 # requirepass foobared requirepass 123456 # save and exit. # Restart redis service # redis client starts, the need for verification before operation
After setting the password, the following error may occur when you close redis service:
[root@izwz991stxdwj560bfmadtz redis]# service redisd stop
Stopping ...
(error) NOAUTH Authentication required.
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Sign in with redis-cli password ( redis-cli -a password ) on OK.
Then ps -ef | grep redis redis can see that the process has exited normally.
Redis service modify the script, add the following information can be shown in red authorization:
Want to open an external authority, then one is allowed access to all external ip (this unsafe, it is recommended to specify a particular ip)
Such as:
bind 0.0.0.0
The second is designated ip, separated by spaces between multiple ip
bind 127.0.0.1 192.168.3.3
Reference: https: //www.cnblogs.com/zuidongfeng/p/8033710.html
Check whether to open ports 3306
firewall-cmd --query-port=6379/tcp
Open port 6379:
firewall-cmd --zone=public --add-port=6379/tcp --permanent
Restart the firewall
firewall-cmd --reload