查看端口 netstat -lntp | grep 6379(防火墙开启状态,开放单独端口)查询端口 firewall-cmd --query-port=80/tcp开启端口firewall-cmd --zone=public --add-port=80/tcp --permanent命令含义:--zone #作用域--add-port=80/tcp #添加端口,格式为:端口/通讯协议--permanent #永久生效,没有此参数重启后失效重启防火墙firewall-cmd --reload查看所有开放的端口firewall-cmd --list-ports
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
问题原因:centOS7.x 除了firewall对端口开放状态有影响外,还有一个服务会影响-seLinux,我把seLinux的服务关掉了,重启服务器就好了
vi /etc/selinux/config#修改config文件
#SELINUX=enforcing
SELINUX=disabled
#注释掉SELINUX=enforcing, 改用disabled
查看是否关闭
getenforce
