For mysql database, redis database, etc. need to enable remote access, follow these steps
E.g:
1. Open iptables 3306 port
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables save #保存iptables规则
2. Open iptables 6379 port
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 6379 -j ACCEPT
service iptables save #保存iptables规则
-----------------------------------------------------------------------------------
如果出现以下二种情况
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT 指令报错 :iptables: Index of insertion too big.
service iptables save 指令报错 : The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
solution:
1. Install or update the service yum install iptables-services
2.启动iptables systemctl enable iptables
3. Open iptable systemctl start iptables
4. Finally execute service iptables save
5. Restart service iptables restart
Finally, it should be noted that the firewall policy of the server also needs to add the corresponding port