RabbitMQ is a message broker. Its core principle is very simple: receive and send messages. You can think of it like a post office: you put your letter in the mailbox, and the postman delivers it to your recipient. In this metaphor, RabbitMQ is a mailbox, a post office, and a postman. The main difference between RabbitMQ and the post office is that it does not deal with paper, but receives, stores and sends binary data - messages.
The first step is to install the dependencies of erlang rabbitmq
wget http://www.erlang.org/download/otp_src_17.4.tar.gz
tar -zxvf otp_src_17.4.tar.gz
cd otp_src_17.4
./configure - -prefix=/data/klj/erlang #I specify the location myself
make
make install
cd /data/klj/erlang/
#set erlang environment
export PATH=$PATH: /data/klj/erlang/bin #Modify ~/.bash_profile
source profile to make the file effective
It was said online that I needed to download and install simplejson and install rabbitmq’s dependencies myself
wget https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gz
tar -zxvf simplejson-3.6.5.tar.gz
cd simplejson-3.6.5
python setup.py install
The second step is to get the latest stable version of rabbitmq3.4.2
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.4.2/rabbitmq-server-generic-unix-3.4.2. tar.gz
tar -zxvf rabbitmq-server-generic-unix-3.4.2.tar.gz
cd rabbitmq_server-3.4.2/
cd sbin/
#./rabbitmq-server - detached #Online it says background execution but not on mac
./rabbitmq-server #Start rabbitmq service
./rabbitmq-plugins enable rabbitmq_management #Enter management mode web
Access address: http://127.0.0.1:15672/ guest guest
User configuration: http://www.rabbitmq.com/man /rabbitmqctl.1.man.html#
rabbitmqctl add_user konglj 123456 #Set user name
rabbitmqctl set_user_tags konglj administrator #Set user type
The third step is to install rabbitmq-c first and then install the amqp extension
Download rabbitmq-c-0.5.2.tar.gz via browser https://github.com/alanxz/rabbitmq-c/
cd rabbitmq-c-0.5.2
./configure
make && make install
./examples/amqp_listen localhost 5672 amq.direct test
./examples/amqp_sendstring localhost 5672 amq.direct test "hello world"
./examples/amqp_sendstring localhost 5672 amq. direct test "hello world"
./examples/amqp_sendstring 127.0.0.1 5672 amq.direct test "hello world"
Install the php-amqp extension immediately after the previous step
wget http://pecl.php.net/get/amqp-1.3.0.tgz
tar -zxvf amqp-1.3.0.tgz
cd amqp-1.3.0
/data/klj/php/bin/phpize
./configure --with-php-config=/data/klj/php/bin/php-config --with -amqp
make
make install
Error: Please reinstall the librabbit-mq distribution http://jingyan.baidu.com/article/e4511cf3362b872b845eafb9.html Solve the librabbit-mq installation problem
#./configure --with-php-config =/data/klj/php/bin/php-config --with-amqp --with-librabbitmq-dir=/data/source/rabbitmq-c-0.5.2
The fourth step is to use php-amqplib provided by the official website
Download php-amqplib https://github.com/videlalvaro/php-amqplib
If the download is not completed through git, download the compressed package and decompress it
Installation Modify the document couponer.json
and then execute composer.phar install and replace it with /usr/local/bin/composer install #If there is no composer, you need to install composer first
Install the dependency environment of composer php-amqplib
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
php-amqplib environment setup
The entire environment has been set up and is ready for testing and development.
Reference article
http://www.rabbitmq.com/features.html rabbitmq official website
https://github.com/videlalvaro/php-amqplib php-amqplib official website
https:// getcomposer.org/doc/00-intro.md#installation-nix composer official website
http://www.yuansir-web.com/2013/05/31/rabbitmq%E5%AE%98%E6%96% B9%E4%B8%AD%E6%96%87%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8Bphp%E7%89%88-%E7%AC%AC %E4%BA%8C%E9%83%A8%E5%88%86%E5%B7%A5%E4%BD%9C%E9%98%9F%E5%88%97%EF%BC%88work-queues %EF%BC%89/ Learning Blog
http://jingyan.baidu.com/article/e4511cf3362b872b845eafb9.html Solve the librabbit-mq installation problem
http://www.cnblogs.com/astroboyx/archive/2012/04/09/2739902.html Installation and configuration of RabbitMQ