1. Open ports
firewall-cmd --zone=public --add-port=5672/tcp --permanent # Open port 5672
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #Close port 5672
firewall-cmd --reload # Configuration takes effect immediately
2. View all open ports of the firewall
firewall-cmd --zone=public --list-ports
3. Turn off the firewall
If there are too many ports to be opened, which is troublesome, you can turn off the firewall and evaluate the security by yourself
systemctl stop firewalld.service
4. Check the firewall status
firewall-cmd --state
5. View the listening port
netstat -lnpt
PS: centos7 does not have a netstat command by default, you need to install the net-tools tool, yum install -y net-tools
6. Check which process the port is occupied by
netstat -lnpt | grep 5672
7. View the details of the process
ps 6832
8. Abort the process
kill -9 6832