RabbitMQ is one of the more popular message broker solutions in the market, offered with an open-source license (Mozilla Public License v1.1) as an implementation of Advanced Message Queuing Protocol. Developed using the Erlang language, it is actually relatively easy to use and get started.
1. Robust messaging for applications.
2. Easy to use.
3. Runs on all major operating systems.
4. Supports a huge number of developer platforms and
5. Open source and commercially supported
Website :- https://www.rabbitmq.com
1. Robust messaging for applications.
2. Easy to use.
3. Runs on all major operating systems.
4. Supports a huge number of developer platforms and
5. Open source and commercially supported
Website :- https://www.rabbitmq.com
The latest release of RabbitMQ is 3.8.0
Downloading and Installing RabbitMQ
yum -y update
Below commands to get Erlang on our system
Step1 :- wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step2 :- wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Step2 :- sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Add the verification key for the package to avoid any unsigned packages.
Step3 :- rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
Updating, Download and Install RabbitMQ
Step4 :- yum install -y erlang
Step5 :- wget http://www.rabbitmq.com/releases/rabbitmq-server/v5.0.5/rabbitmq-server-5.0.5-1.noarch.rpm
Install the Management GUI
Install the .RPM package using YUM
Step6 :- yum install rabbitmq-server-5.0.5-1.noarch.rpm
To have RabbitMQ start as a daemon by default, run the following:
Step7 :- chkconfig rabbitmq-server on
To manage your RabbitMQ server, you can use the rabbitmq-management plugin. This plugin allows you to manage and monitor your RabbitMQ server in a variety of ways, such as listing and deleting exchanges, queues, bindings and users. You can send and receive messages, and monitor activity on specific queues.
Managing RabbitMQ
Step8 :- sudo rabbitmq-plugins enable rabbitmq_management
Once you've enabled the console, it can be accessed using your favourite web browser.
Step9 :- http://[your IP address]:15672
The default username and password are both set “guest” for the log in.
Add Management User
To create a new user
Step10 :- sudo rabbitmqctl add_user admin 123
Step11 :- sudo rabbitmqctl set_user_tags admin administrator
Step12 :- sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Step13 :- sudo rabbitmqctl delete_user guest
Step14 :- sudo service rabbitmq-server restart
Web GUI should now be accessible to the new user
URL :- http://127.0.0.1:15672/
Remote Access
Add rule, restart service
Step15 :- sudo iptables -A INPUT -p tcp --dport 15672 -m state --state NEW,ESTABLISHED -j ACCEPT
Step16 :- sudo service ufw reload
Verify port is listening
Step17 :- netstat -tulpn
Managing on Ubuntu / Debian Based Systems
To start the service:
service rabbitmq-server start
# To stop the service:
service rabbitmq-server stop
# To restart the service:
service rabbitmq-server restart
# To check the status:
service rabbitmq-server status
And that's it! You now have your own message queue working on your virtual server.
Configuring RabbitMQ
http://www.rabbitmq.com/configure.html
Install Redis as PHP Extension
You can start and stop redis with these commands
Step20 :- sudo apt-get -y install php5-redis
Install Redis extension of PHP using Source
Step21 :- sudo apt-get -y install php5-dev
Download phpredis from git repository
Step22 :- sudo apt-get -y install git
Step23 :- git clone git://github.com/nicolasff/phpredis.git
Compile and install phpRedis by running
Step24 :- cd phpredis
Step25 :- phpize
Step26 :- ./configure
Step27 :- make
Step28 :- sudo -s make install
Next we need to add extension with php configuration so that php can enable this
Step29 :- sudo -s
Step30 :- echo "extension=redis.so">/etc/php5/conf.d/redis.ini
To check Redis is working with php
Step31 :- vi phpredis.php
Write the following code in the phpredis.php
<?php
redis=new Redis() or die("Can not load Redis.");
$redis->connect('127.0.0.1');
$redis->set('Redis test_key', 1);
Run the phpredis.php file either using your browser or command line
Step32 :- php phpredis.php
Redis Operations
Step8 :- SET users:CloudNetwork "job: CEO, born:1988, dislikes: cherry trees“
Step8 :- GET users:CloudNetwork
Ranges:
Step8 :- LRANGE ROYGBV 0 3
1) "red"
2) "orange"
3) "yellow"
4) "green“
Expiration:
Step8 :- SET classified:information "Secret Stuff“
EXPIRE classified:information 45
TTL classified:information
GET classified:information
Removing Redis
Step33 :- sudo apt-get remove redis-server
Below commands to get Erlang on our system
Step1 :- wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step2 :- wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Step2 :- sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Add the verification key for the package to avoid any unsigned packages.
Step3 :- rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
Updating, Download and Install RabbitMQ
Step4 :- yum install -y erlang
Step5 :- wget http://www.rabbitmq.com/releases/rabbitmq-server/v5.0.5/rabbitmq-server-5.0.5-1.noarch.rpm
Install the Management GUI
Install the .RPM package using YUM
Step6 :- yum install rabbitmq-server-5.0.5-1.noarch.rpm
To have RabbitMQ start as a daemon by default, run the following:
Step7 :- chkconfig rabbitmq-server on
To manage your RabbitMQ server, you can use the rabbitmq-management plugin. This plugin allows you to manage and monitor your RabbitMQ server in a variety of ways, such as listing and deleting exchanges, queues, bindings and users. You can send and receive messages, and monitor activity on specific queues.
Managing RabbitMQ
Step8 :- sudo rabbitmq-plugins enable rabbitmq_management
Once you've enabled the console, it can be accessed using your favourite web browser.
Step9 :- http://[your IP address]:15672
The default username and password are both set “guest” for the log in.
Add Management User
To create a new user
Step10 :- sudo rabbitmqctl add_user admin 123
Step11 :- sudo rabbitmqctl set_user_tags admin administrator
Step12 :- sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Step13 :- sudo rabbitmqctl delete_user guest
Step14 :- sudo service rabbitmq-server restart
Web GUI should now be accessible to the new user
URL :- http://127.0.0.1:15672/
Remote Access
Add rule, restart service
Step15 :- sudo iptables -A INPUT -p tcp --dport 15672 -m state --state NEW,ESTABLISHED -j ACCEPT
Step16 :- sudo service ufw reload
Verify port is listening
Step17 :- netstat -tulpn
Managing on Ubuntu / Debian Based Systems
To start the service:
service rabbitmq-server start
# To stop the service:
service rabbitmq-server stop
# To restart the service:
service rabbitmq-server restart
# To check the status:
service rabbitmq-server status
And that's it! You now have your own message queue working on your virtual server.
Configuring RabbitMQ
http://www.rabbitmq.com/configure.html
Install Redis as PHP Extension
You can start and stop redis with these commands
Step20 :- sudo apt-get -y install php5-redis
Install Redis extension of PHP using Source
Step21 :- sudo apt-get -y install php5-dev
Download phpredis from git repository
Step22 :- sudo apt-get -y install git
Step23 :- git clone git://github.com/nicolasff/phpredis.git
Compile and install phpRedis by running
Step24 :- cd phpredis
Step25 :- phpize
Step26 :- ./configure
Step27 :- make
Step28 :- sudo -s make install
Next we need to add extension with php configuration so that php can enable this
Step29 :- sudo -s
Step30 :- echo "extension=redis.so">/etc/php5/conf.d/redis.ini
To check Redis is working with php
Step31 :- vi phpredis.php
Write the following code in the phpredis.php
<?php
redis=new Redis() or die("Can not load Redis.");
$redis->connect('127.0.0.1');
$redis->set('Redis test_key', 1);
Run the phpredis.php file either using your browser or command line
Step32 :- php phpredis.php
Redis Operations
Step8 :- SET users:CloudNetwork "job: CEO, born:1988, dislikes: cherry trees“
Step8 :- GET users:CloudNetwork
Ranges:
Step8 :- LRANGE ROYGBV 0 3
1) "red"
2) "orange"
3) "yellow"
4) "green“
Expiration:
Step8 :- SET classified:information "Secret Stuff“
EXPIRE classified:information 45
TTL classified:information
GET classified:information
Removing Redis
Step33 :- sudo apt-get remove redis-server