一、 防火墙放行端口的方法
以80为例
查看 firewall 状态 :
# firewall-cmd --state # eg :running
重启防火墙
# systemctl restart firewalld
#在public中永久开放80端口
# firewall-cmd --zone=public --add-port=80/tcp –permanent
#从public zone中移除服务
# firewall-cmd --permanent --zone=public --remove-service=ssh
#重新加载配置
# firewall-cmd –reload
二、 zookeeper放行端口
#以下操作zookeeper机器三台都要操作
firewall-cmd --zone=public --add-port=2181/tcp --permanent
firewall-cmd --zone=public --add-port=2888/tcp --permanent
firewall-cmd --zone=public --add-port=3888/tcp --permanent
# reload防火墙配置
[root@node2 ~]# firewall-cmd --reload
Success
#查看是否成功开启
[root@node2 ~]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: ssh dhcpv6-client
ports: 2181/tcp 2888/tcp 3888/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
最终效果