centos服务器ssh连接被拒绝,Connection refused

排查

  1. 检测服务是否正常启动
    ps -ef | grep rabbit
    如果服务未启动,则启动服务
    centos服务器ssh连接被拒绝,Connection refused
    centos服务器ssh连接被拒绝,Connection refused
    然后,查看服务是否正确监听了端口
    netstat -anp | grep pid
    centos服务器ssh连接被拒绝,Connection refused

  2. 检查服务端防火墙是否开启
    systemctl status firewalld
    centos服务器ssh连接被拒绝,Connection refused
    为了服务器安全,强烈建议打开防火墙

  3. 检查服务器端口是否开放
    firewall-cmd --query-port=5672/tcp
    centos服务器ssh连接被拒绝,Connection refused
    如上,端口没有开放,使用如下命令打开端口
    firewall-cmd --permanent --add-port=5672/tcp
    centos服务器ssh连接被拒绝,Connection refused
    然后,reload 端口开放规则
    firewall-cmd --reload
    centos服务器ssh连接被拒绝,Connection refused
    再次检测端口是否开放
    centos服务器ssh连接被拒绝,Connection refused

  4. 使用 nc 检测端口是否可连接成功
    centos服务器ssh连接被拒绝,Connection refused

参考文档