What ports does RabbitMQ use?

后端 未结 4 1935
独厮守ぢ
独厮守ぢ 2020-12-12 11:09

What ports does RabbitMQ Server use or need to have open on the firewall for a cluster of nodes?

My /usr/lib/rabbitmq/bin/rabbitmq-env is set below whic

4条回答
  •  失恋的感觉
    2020-12-12 11:40

    What ports is RabbitMQ using?

    Default: 5672, the manual has the answer. It's defined in the RABBITMQ_NODE_PORT variable.

    https://www.rabbitmq.com/configure.html#define-environment-variables

    The number might be differently if changed by someone in the rabbitmq configuration file:

    vi /etc/rabbitmq/rabbitmq-env.conf
    

    Ask the computer to tell you:

    sudo nmap -p 1-65535 localhost
    
    Starting Nmap 5.51 ( http://nmap.org ) at 2014-09-19 13:50 EDT
    Nmap scan report for localhost (127.0.0.1)
    Host is up (0.00041s latency).
    PORT      STATE         SERVICE
    443/tcp   open          https
    5672/tcp  open          amqp
    15672/tcp open  unknown
    35102/tcp open  unknown
    59440/tcp open  unknown
    

    Oh look, 5672, and 15672

    Use netstat:

    netstat -lntu
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State
    tcp        0      0 0.0.0.0:15672               0.0.0.0:*                   LISTEN
    tcp        0      0 0.0.0.0:55672               0.0.0.0:*                   LISTEN
    tcp        0      0 :::5672                     :::*                        LISTEN
    

    Oh look 5672.

    use lsof:

    eric@dev ~$ sudo lsof -i | grep beam
    beam.smp  21216    rabbitmq   17u  IPv4 33148214      0t0  TCP *:55672 (LISTEN)
    beam.smp  21216    rabbitmq   18u  IPv4 33148219      0t0  TCP *:15672 (LISTEN)
    

    use nmap from a different machine, find out if 5672 is open:

    sudo nmap -p 5672 10.0.1.71
    Starting Nmap 5.51 ( http://nmap.org ) at 2014-09-19 13:19 EDT
    Nmap scan report for 10.0.1.71
    Host is up (0.00011s latency).
    PORT     STATE SERVICE
    5672/tcp open  amqp
    MAC Address: 0A:40:0E:8C:75:6C (Unknown)    
    Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
    

    Try to connect to a port manually with telnet, 5671 is CLOSED:

    telnet localhost 5671
    Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused
    

    Try to connect to a port manually with telnet, 5672 is OPEN:

    telnet localhost 5672
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    

    Check your firewall:

    sudo cat /etc/sysconfig/iptables  
    

    It should tell you what ports are made open:

    -A INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
    

    Reapply your firewall:

    sudo service iptables restart
    iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
    iptables: Flushing firewall rules:                         [  OK  ]
    iptables: Unloading modules:                               [  OK  ]
    iptables: Applying firewall rules:                         [  OK  ]
    

提交回复
热议问题