[rabbitmq-discuss] I'd like rabbitmq to be able to pick its own port(s)

Terry Jones terry at jon.es
Wed Oct 22 11:49:30 BST 2008

>>>>> "Paul" == Paul Jones <pauljones23 at gmail.com> writes:
Paul> I haven't tried this, so it may not work, but have you tried
Paul> configuring Rabbit to use a port of 0? When using socket apis
Paul> directly, I seem to recall that is how you ask it to assign you a
Paul> free port, and doing this from a config level may just work...

Hi Paul

Thanks for the suggestion. Running with NODE_PORT=0 does indeed get rabbit
going on an OS-assigned port. But I still need to figure out what the port
is :-)  Looking at netstat, I see two listeners

  # netstat -tupan
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 *               LISTEN      31912/beam
  tcp        0      0 *               LISTEN      31912/beam

So it's either 35073 or 58341. The log file doesn't help:

  # cat /var/log/rabbitmq/rabbit.log
  =INFO REPORT==== 22-Oct-2008::12:15:50 ===
  started TCP listener on

That's a good start...

Attached is a tiny patch to src/tcp_listener.erl that makes the log file
print the correct port number.

These are literally my first 2 lines ever of Erlang! Be gentle with me :-)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: d
Url: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20081022/e4a30af4/attachment.txt 

More information about the rabbitmq-discuss mailing list