Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ: Simple Test Program has Possible Network Issues

Tags:

rabbitmq

I have a simple RabbitMQ test program that sends and then receives a message to a RabbitMQ server. I have two computers and I've found that whether or not my code works depends on which computer hosts the RabbitMQ server. Here is my situation (excuse my MS Paint):

enter image description here

  1. If computer A hosts the server and runs the code, sending a message from A to A, it works.
  2. If computer A hosts the server and my code runs on computer B, sending a message from B to A, it works.
  3. If computer B hosts the server and my code runs on computer A, sending a message from A to B, I get an exception that says "None of the specified endpoints were reachable".
  4. If computer B hosts the server and runs the code, sending a message from B to B, it works.

I can't figure out why scenario #3 doesn't work for me.

  • I don't think it's the code because three of my scenarios work exactly as I expect them to.
  • I don't think it's a firewall issue because I ran these tests with my firewalls turned off on both computers.
  • I don't think it's a problem with the RabbitMQ server on computer B because it is able to communicate with itself just fine (scenario #4).
  • I checked the RabbitMQ log files on computer B after trying scenario #3, but I don't see anything that says something about an attempted connection. I think computer A is simply unable to see computer B when sending requests.

My question, very generally is, what are some things that I should be looking for that might point to my problem? There must be some setting that is checked on computer A but is not checked on computer B. Computer B has the default installation of Erlang and RabbitMQ. I'm pretty sure computer A is also set to the defaults (I didn't install it as recently).

Please help.

like image 952
user1214135 Avatar asked Jan 23 '26 13:01

user1214135


1 Answers

The issue is only evident when A tries to connect to B, so:

  • Check that A can resolve the host name for B to an IP address. Use nslookup b for this.
  • Check that A can reach B. Running ping b will be helpful for this.
  • Use telnet to connect from A to B's RabbitMQ port (probably 5672): telnet b 5672. If you get a blank screen that means the connection was accepted. I'm betting you'll get some sort of error though. Try this trick first using b's IP address and then if that works try it with the hostname of b to make sure it resolves.

In summary, just strip it down to pure network checks (no RabbitMQ involved) and work from there.

like image 111
Brian Kelly Avatar answered Jan 27 '26 01:01

Brian Kelly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!