Janet previous chapter "Looking at the Big Data era of IT Architecture" (2) Message Queuing rabbitmq-Basic concept detailed introduction, roughly speaking, the current message queue of several common products of the pros and cons of the comparison, the next few chapters will be elaborated in detail, this chapter introduces RABBITMQ, okay, nonsense less say, Official start:
First, installation1. Installing Erlang1) System compilation Environment (Linux/unix environment is used here) ① Installation Environment
Virtual machines: VMware? Workstation 10.0.1 Build
Linux system: CentOS6.5
RABBITMQ official website Download:http://www.rabbitmq.com/download.html
Erlang's official website download: http://www.erlang.org/download.html
2) Installation of RABBITMQ (Erlang, Simplejson) required: ① Installing Erlang
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:
- Then unzip the downloaded GZ package tar zxcf *.tar.gz
- CD into the extracted folder
- Execution ./configure--prefix=/opt/erlang will start compiling the installation will be compiled to/opt/erlang and executed
- Make and make install
- when the compilation is complete, enter /opt/erlang , enter Erl Test Erlang whether the installation was successful.
- Modify /etc/profile file, add the following environment variables:
- #set Erlang Environment
- Export path= $PATH:/opt/erlang/bin
- Source Profile make the file effective
- Ken will be able to find the case of the package can not be found, directly yum install it!
After installing Erlang, start loading rabbitmq-server, the main reference is Official document: http://www.rabbitmq.com/build-server.html ;
② Installing Simplejson (if you need to install a Python version )
A newer version of Python needs to be installed. Easy to install.
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
2, Installation RABBITMQThen install RABBITMQ Server. Download the source code version of RABBITMQ from here:http://www.rabbitmq.com/server.html. The version I downloaded israbbitmq-server-generic-unix-2.7.1.tar.gz
- There are many versions of RABBITMQ installed, and we use the Generic Unix version.
- CD/
- wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.7.1/rabbitmq-server-generic-unix-2.7.1.tar.gz Download RABBITMQ
- Tar zxvf rabbitmq-server-generic-unix-2.7.1.tar.gz-c/opt unzip to the specified folder
- Cd/opt, establishing a soft link ln-s rabbitmq-server-generic-unix rabbitmq
- CD Rabbitmq/sbin,./rabbitmq-server-detached to enable background startup
- modifying /etc/profile, adding environment variables
- #set RABBITMQ Environment
- Export path= $PATH:/opt/rabbitmq/sbin
- Source profile makes the file effective
- Cd/opt/rabbitmq/sbin,./rabbitmqctl stop close rabbitmq
- This completes the installation
This will make the installation successful.
3. Trial run
- Enable Admin mode (manage MQ with Web page) cd/opt/rabbitmq/sbin/
- Execute./rabbitmq-plugin Enable Rabbitmq-management
- Then visit http://localhost:55672
Second, the configuration
Main references official documents:http://www.rabbitmq.com/configure.html
In general, the default configuration for RABBITMQ is sufficient. If you want a special setting, there are two ways:
- One is the environment variable configuration file rabbitmq-env.conf;
- A configuration file that is configuration information rabbitmq.config;
Note that these two files are not by default and must be created yourself if necessary.
Rabbitmq-env.conf
The location of this file is deterministic 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, commonly used are:
- #RABBITMQ_NODE_PORT =//Port number
- #HOSTNAME =
- Rabbitmq_nodename=mq
- rabbitmq_config_file=//path of the configuration file
- Rabbitmq_mnesia_base=/rabbitmq/data//path of the MNESIA database to be used
- Rabbitmq_log_base=/rabbitmq/log//log's Path
- Rabbitmq_plugins_dir=/rabbitmq/plugins//plug-in Path
For a specific list, see:http://www.rabbitmq.com/configure.html#define-environment-variables
Rabbitmq.config
This is a standard Erlang configuration file. It must conform to the standards of the Erlang profile.
It has both a default directory and can be configured in the rabbitmq-env.conf file.
The contents of the file are described in:http://www.rabbitmq.com/configure.html#config-items
Third, monitoring
Main references official documents:http://www.rabbitmq.com/management.html
RABBITMQ provides a web-based 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 for the monitoring page to the plugins directory, which includes the following plugin:
- Mochiweb
- Webmachine
- Rabbitmq_mochiweb
- Amqp_client
- Rabbitmq_management_agent
- Rabbitmq_management
The download path is located at:http://www.rabbitmq.com/plugins.html#rabbitmq_management
Restart the RABBITMQ and enter the http://server-name:55672/mgmt/to access the monitoring page. The default user name and password are: Guest and guest.
Janet: Looking at the IT architecture in the Big Data Era (3) rabbitmq-installation, configuration and monitoring of Message Queuing