1、防火墙添加6379端口
确保防火墙开启了对6379端口的放行。
2、修改redis.conf
在 redis.conf 中修改以下参数
# 允许任何主机连接、访问
bind 127.0.0.1 改为 bind 0.0.0.0
# 关闭保护模式
protected-mode yes 改为 protected-mode no
# 允许启动后在后台运行,即关闭命令行窗口后仍能运行
daemonize no 改为 daemonize yes
注意:redis6必须要设置密码否则不能远程连接
# 获取redis密码
config get requirepass
# 设置reids密码
config set requirepass "123456"
然后重启redis
再次使用就需要输入密码啦
auth 123456
接下来就可以正常使用了