Monday, December 19, 2016

ubuntu - RabbitMq Management plugin only on localhost



On RabbitMQ 3.5.7 Ubuntu 16.04.



I want to implement RabbitMq Management plugin only on localhost, the idea is to use a tunnel to reach the RabbitMq Management Web GUI from the computer I use to connect to my server using SSH.




I found this thread that seems to document everything to do.



Here is what I have done:
I edited /etc/rabbitmq/rabbitmq-env.conf, it looks like that:



export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbitmq.config"
# Defaults to rabbit. This can be useful if you want to run more than one node
# per machine - RABBITMQ_NODENAME should be unique per erlang-node-and-machine
# combination. See the clustering on a single machine guide for details:

# http://www.rabbitmq.com/clustering.html#single-machine
#NODENAME=rabbit

# By default RabbitMQ will bind to all interfaces, on IPv4 and IPv6 if
# available. Set this if you only want to bind to one network interface or#
# address family.
#NODE_IP_ADDRESS=127.0.0.1

# Defaults to 5672.
#NODE_PORT=5672


export RABBITMQ_NODENAME=rabbit@localhost
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
export ERL_EPMD_ADDRESS=127.0.0.1


Then I've created and edited "/etc/rabbitmq/rabbitmq.config":



[
{rabbitmq_management, [

{listener,[{port, 15672},{ip, "127.0.0.1"}]}
]},
{kernel, [
{inet_dist_use_interface,{127.0.0.1}}
]}
].


I've launched some service rabbitmq-server reload, service rabbitmq-server stop, service rabbitmq-server start.




It did not work.



I rebooted the machine it is still not working.



When I do a sudo lsof -i-n -P I see that:




beam 1199 rabbitmq 8u IPv4 13374 0t0 TCP *:25672 (LISTEN)



beam 1199 rabbitmq 9u IPv4 13376 0t0 TCP 127.0.0.1:60223-127.0.0.1:4369 (ESTABLISHED)




beam 1199 rabbitmq 18u IPv4 14714 0t0 TCP 127.0.0.1:5672 (LISTEN)



beam 1199 rabbitmq 19u IPv4 14716 0t0 TCP *:15672 (LISTEN)




In "/var/log/rabbitmq/rabbit@localhost.log", I can see:




"config file(s) : /etc/rabbitmq/rabbitmq.config (not found)"




Answer



I solved it, my mistake was:



export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbitmq.config" instead of export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbitmq" in "/etc/rabbitmq/rabbitmq-env.conf"



It is not necessary to specify the extention ".config" of the file.



And in "/etc/rabbitmq/rabbitmq.config", I just kept:




[
{rabbitmq_management, [
{listener,[{port, 15672},{ip, "127.0.0.1"}]}
]},
]


The node: {kernel, [{inet_dist_use_interface,{127.0.0.1}}]} was creating some conflict, I took it away with no further investigation.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...