1. Add port 6379 to the firewall
Make sure the firewall opens port 6379.
2. Modify redis.conf
Modify the following parameters in redis.conf
# 允许任何主机连接、访问
bind 127.0.0.1 改为 bind 0.0.0.0
# 关闭保护模式
protected-mode yes 改为 protected-mode no
# 允许启动后在后台运行,即关闭命令行窗口后仍能运行
daemonize no 改为 daemonize yes
Note: redis6 must set a password, otherwise it cannot connect remotely
# 获取redis密码
config get requirepass
# 设置reids密码
config set requirepass "123456"
Then restart redis
You will need to enter your password to use it again.
auth 123456
Then you can use it normally