The previous article mentioned the use of MongoDB depressed, this blog is to try another new thing-rabbitmq results. The difference is that RABBITMQ gives me a great feeling. Strongly recommended.
installation
The RABBITMQ is based on Erlang, so you must first configure the Erlang environment.
Download the latest Erlang installation package from Erlang's official website http://www.erlang.org/download.html, the version i downloaded is otp_src_R14B03.tar.gz.
And then:
$ tar xvzf otp_src_R14B03.tar.gz
$ CD OTP_SRC_R14B03
$./configure
The compiled output is shown below:
Tip There is no wxwidgets and FOP, but the problem is not big. Go on:
$ make
$ sudo make install
" By default, ERLANG/OTP'll be installed in '/usr/local/{bin,lib/erlang} '. To instead install in ' <basedir>/{bin,lib/erlang} ' and use the '--prefix=<basedir> ' option. "
After installing Erlang, start installing Rabbitmq-server.
Main reference official documents: http://www.rabbitmq.com/build-server.html
You need to install a newer version of Python. Install slightly.
You need to install Simplejson. Download the latest version from here: Http://pypi.python.org/pypi/simplejson#downloads. The version I downloaded is simplejson-2.2.1.tar.gz
$ tar xvzf simplejson-2.2.1.tar.gz
$ CD simplejson-2.2.1
$ sudo python setup.py install
Then install RABBITMQ Server. Download the source code version of rabbitmq:http://www.rabbitmq.com/server.html from here. The version I downloaded is rabbitmq-server-2.6.1.tar.gz
$ tar xvzf rabbitmq-server-2.6.1.tar.gz
$ CD rabbitmq-server-2.6.1
$ make
# target_dir=/usr/local Sbin_dir=/usr/local/sbin Man_dir=/usr/local/man make install
Three commands appear under the sbin/directory:
Rabbitmqctl rabbitmq-env Rabbitmq-server
The installation was successful.
Run
Locate the sbin/directory and run the program:
/usr/local/sbin/rabbitmq-server–detached
Stop program:
/usr/local/sbin/rabbitmqctl stop
Configuration
Main reference official documents: http://www.rabbitmq.com/configure.html
In general, the default configuration for RABBITMQ is sufficient. If you want special settings, there are two ways:
One is the configuration file of environment variable rabbitmq-env.conf;
One is the configuration file Rabbitmq.config of config information;
Note that these two files are not by default and must be created by themselves if necessary.
Rabbitmq-env.conf
The location of this file is determined and immutable, located in:/etc/rabbitmq directory (this directory needs to be created by itself).
The contents of the file include some of the environment variables of RABBITMQ, which are commonly used:
#RABBITMQ_NODE_PORT =//Port number
#HOSTNAME =
Rabbitmq_nodename=mq
rabbitmq_config_file=//configuration file path
Rabbitmq_mnesia_base=/rabbitmq/data//The path to the Mnesia database that needs to be used
Path to Rabbitmq_log_base=/rabbitmq/log//log
Rabbitmq_plugins_dir=/rabbitmq/plugins//plugin path
See the specific list: Http://www.rabbitmq.com/configure.html#define-environment-variables
Rabbitmq.config
This is a standard Erlang configuration file. It must conform to the criteria for Erlang configuration files.
It has either the default directory or it can be configured in the rabbitmq-env.conf file.
The contents of the document are as detailed as: Http://www.rabbitmq.com/configure.html#config-items
Monitoring
Main reference official documents: http://www.rabbitmq.com/management.html
RABBITMQ provides a web monitoring page system that is invoked in a plugin manner.
First, configure the location of the plugins directory in rabbitmq-env.conf: Rabbitmq_config_file
Download the plugin required by the monitoring page to the plugins directory, which includes:
Mochiweb
Webmachine
Rabbitmq_mochiweb
Amqp_client
Rabbitmq_management_agent
Rabbitmq_management
Download path in: http://www.rabbitmq.com/plugins.html#rabbitmq_management
Reboot the RABBITMQ and enter http://server-name:55672/mgmt/to access the monitor page. The default user name and password are: Guest and guest. As shown in figure:
Then if you have time to make up a few more articles about usage and performance.