温馨提示×

如何修改redis的防火墙

小新
213
2020-12-16 16:09:00
栏目: 云计算

如何修改redis的防火墙

修改redis防火墙的示例:

CentOS 7.0默认使用的是firewall作为防火墙,将其改成iptables防火墙示例:

1.redis的端口放到了防火墙计划中,例如:

/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT

/etc/rc.d/init.d/iptables save

2.关闭firewall,命令:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

3.更改redis.conf 文件,例如:

vi /etc/redis/6379.conf

bind 127.0.0.1

protected-mode yes

# bind 127.0.0.1

protected-mode no

将其默认的127.0.0.1改为0.0.0.0(代表不做限制)

bind 0.0.0.0

//关闭

redis-cli -h 127.0.0.1 -p 6379 -a 3E=2DR?bReHem7n1 shutdown

//启动

/etc/init.d/redis_6379 start

0