Solve the problem that the redis server cannot be connected remotely

Problem description
The remote connection to redis is unsuccessful.
The ip is correct, the port number is correct, and the redis service is also enabled, but it is unsuccessful.

Solution
process Solution 1:
The server port number is not open, or the pagoda is used, and the 6379 port number of redis is not set. You
need to add the 6379 port number in the server security group and the pagoda’s security settings, and
finally restart the redis service

Method 2:
Local redis.conf configuration file problem
find / -name "redis.conf" Find the redis.conf file and make the following modifications:

1.bind 127.0.0.1 修改为 bind 0.0.0.0
127.0.0.1  	表示只允许本地访问,无法远程连接
0.0.0.0     表示任何ip都可以访问

2.protected-mode yes 改为 protected-mode no
yes			  保护模式,只允许本地链接
no			  保护模式关闭

3.daemonize yes 改为 daemonize no 
yes: 代表开启守护进程模式。此时是单进程多线程的模式,redis将在后台运行。
no: 当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具都会导致redis进程退出

Finally restart the redis service
redis-server redis.conf
or
restart redis: systemctl restart redis.service

Guess you like

Origin blog.csdn.net/a0405221/article/details/128047270