After redis and other service starts, the default external network is not accessible, because the firewall is not allowed, so to open the firewall, so that it could access the port number.
Use firewall command
Open port
firewall-cmd --zone=public --add-port=6379/tcp --permanent
# 参数含义:
–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
Close ports
firewall-cmd --zone=public --remove-port=6379/tcp --permanent
Restart the firewall
firewall-cmd --reload
# 或者
service firewalld restart
Check the port number is open
firewall-cmd --query-port=6379/tcp
See all open port numbers
firewall-cmd --list-ports
View Status
systemctl status firewalld
# 或者
firewall-cmd --state
Turn off the firewall
systemctl stop firewalld.service
Set firewall boot from the start
systemctl enable firewalld
Prohibit firewall boot
systemctl disable firewalld.service