User Tools

Site Tools


toolsandtechnologies:rabbitmq_and_rehl

Install RabbitMQ on RedHat 6.6

If docker is available on the machine then rabbit can be setup via :

docker run -d -p 5672:5672 -p 15672:15672 -p 15674:15674 -e RABBITMQ_DEFAULT_VHOST=admin -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin --hostname rab1 --name rab1con -e RABBITMQ_ERLANG_COOKIE='secret cookie here' rabbitmq:3-management

# Open url http://localhost:15672 (create user and virtual-host using UI)

Else if docker is not available then the setup is as follows:

# Install Erlang Latest Lightweight
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v1.4.8/erlang-19.1.5-1.el6.x86_64.rpm
sudo rpm -Uvh erlang-19.1.5-1.el6.x86_64.rpm

# Install socat if needed
cd /etc/yum.repos.d
sudo wget --no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo
sudo  yum install socat

# Install RabbitMQ
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm
sudo rpm -Uvh rabbitmq-server-3.6.5-1.noarch.rpm

# This will enable the Web GUI
sudo rabbitmq-plugins enable rabbitmq_management

# Add the hostname as the node node
sudo nano /etc/rabbitmq/rabbitmq-env.conf 
NODENAME=hostname

# Run babbitmq in the backgroun
sudo rabbitmq-server start -detached

# Install WebStomp for Web Socket Connections
sudo rabbitmq-plugins enable rabbitmq_web_stomp

# Set up the admin user
sudo rabbitmqctl add_user admin admin
sudo rabbitmqctl set_user_tags admin administrator


# Adding Virtual Hosts + Setting Permissions
sudo rabbitmqctl add_vhost /admin
sudo rabbitmqctl add_vhost admin
sudo rabbitmqctl set_permissions -p /admin admin ".*" ".*" "."
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" "."
sudo rabbitmqctl set_permissions -p admin admin ".*" ".*" "."
sudo rabbitmqctl set_permissions -p  admin ".*" ".*" "."

# Allowing the admin user to access rabbit outside localhost - will require a restart
sudo nano /etc/rabbitmq/rabbitmq.config
Paste in :
[{rabbit, [{loopback_users, [admin]}]}].

Notes

# Delete Virutal Host
sudo rabbitmqctl delete_vhost /admin
sudo rabbitmqctl delete_vhost admin

# Uninstall
sudo rpm -e rabbitmq-server-3.6.5-1.noarch

# If you want to try run Rabbitmq as a non root user -  Editing Ownership
#sudo chown -R scotty:scotty /var/lib/rabbitmq/
#sudo chown -R scotty:scotty /var/log/rabbitmq
#sudo chown -R scotty:scotty /etc/rabbitmq

Alarm Cache Preparation

[30/05/2017, 15:00:35] Colm Carew: # Set up the admin user
rabbitmqctl add_user rabbit_ems '#rabbit321!#'
rabbitmqctl set_user_tags rabbit_ems administrator

rabbitmqctl add_vhost ems
rabbitmqctl set_permissions -p ems rabbit_ems ".*" ".*" "."
[30/05/2017, 15:02:13] Colm Carew: update db_app_configuration 
set 
    rabbitmq_url = 'http://localhost:15674/stomp',
    rabbitmq_password = 'Y86of/e0dKirTJ1RX5G13w==',
    rabbitmq_username = 'rabbit_ems',
    rabbitmqvhost = 'ems',
    rabbit_exchange_to_listen_to = '/exchange/ems_push_notification_topic/',
    routing_keys_of_exchange = 'AlarmCacheUpdate',
    rabbitmq_enabled = true
where
    id = 1;

Alarm Cache JSON Update Message

{"activeAlarm":{"id":149515,"carrierAlarm":[{"id":1}],
"cleared":false,"clusterAlarm":[{"id":1}],
"component":null,
"createDate":"2017-06-16T08:08:59Z",
"networkElement":{"id":206690},"sectionAlarm":[{"id":1}],"severity":"critical"},
"networkElement":
{"id":206690,"activeAlarm":[{"id":149515}],"parent":{"id":206689}},"cluster":{"id":305,"clusterAlarm":[{"id":1}],"name":"MI - Verizon Wireless"},
"carriers":[{"id":1,"carrierAlarm":[{"id":1}],"name":"AT&T"}],"sections":[{"id":1,"name":"Section A","sectionAlarm":[{"id":1}]}]}

Dockerfile

FROM rabbitmq:latest

RUN rabbitmq-plugins enable rabbitmq_management
RUN rabbitmq-plugins enable rabbitmq_stomp
RUN rabbitmq-plugins enable rabbitmq_web_stomp

EXPOSE 61613
EXPOSE 15674
EXPOSE 15672
EXPOSE 5672
toolsandtechnologies/rabbitmq_and_rehl.txt · Last modified: 2021/06/25 10:09 by 127.0.0.1