Linux CentOS7 防火墙及常用端口

启动防火墙

systemctl start firewalld

关闭防火墙

systemctl stop firewalld

查看防火墙状态

firewall-cmd --state

如果该命令报错:ERROR:dbus.proxies:Introspect error on :1.577:/org/fedoraproject/FirewallD1: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

可能是由于dbus包存在问题,可以使用yum install dbus或者yum update dbus进行下载和更新dbus包。更新之后,使用systemctl restart dbus重启dbus

查看开放端口列表

firewall-cmd --zone=public --list-ports

开放6379端口

firewall-cmd --zone=public --add-port=6379/tcp --permanent ##开放端口
firewall-cmd --reload ##防火墙配置生效

关闭6379端口

firewall-cmd --zone=public --remove-port=6379/tcp --permanent  ##关闭端口
firewall-cmd --reload ##防火墙配置生效

开放一段端口

firewall-cmd --zone=public --add-port=8121-8124/tcp --permanent

常见端口

中间件/组件端口号
Redis

默认6379和16379

MongoDB默认27017
Zookeeper默认2181、2888(集群同步数据)和3888(选举)
Kafka默认9092
MySQL默认3306
Elasticsearch默认9200
Kibana(ES可视化客户端)默认5601
Nacos默认8848、9848(客户端连接)、9849(不用开端口,但要注意端口占用)

使用Zookeeper需要安装jdk,使用Kafka需要安装并启动Zookeeper

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值