发布于 

Redis外网访问配置修改

当我们在服务器安装了Redis之后,和MySQL一样都是只能在服务器本地进行访问,无法在服务器外部对服务器的Redis进行访问,所以我们需要对Redis的配置文件进行修改,从而使Redis可以远程访问,具体流程如下:

找到Redis的配置文件,一般情况下为**/etc/redis.conf**文件,修改该文件的bind和protect-mode

1
2
3
4
# 将bind注释掉,或者将其值修改为0.0.0.0
# bind 127.0.0.1
# 设置保护模式为no
protected-mode no

重启Redis服务

1
systemctl restart redis

开放Redis的运行端口并重置防火墙,Redis的默认运行端口为6379

1
2
firewall-cmd --add-port=6379 --permanent
firewall-cmd --reload



Copyright © 2023 ChenWei | Powered By Stellar
本站已运行 00 小时 00