In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
The files related to the rabbitmq environment installed by me can be downloaded from the Baidu cloud disk resources provided by me.
Link: https://pan.baidu.com/s/1bnofK3l password: whdm
A preface
Message queue, also known as MQ, is a message communication tool between applications, which is conducive to program decoupling, multi-language integration, asynchronous communication, extension and simple load balancing, etc., and is a typical representative of the production-consumer model. Common MQ products include RabbitMQ ZeroMQ Kafka and so on.
RabbitMQ, veteran MQ products, based on erlang language, achieve support for AMQP and other protocols, heavyweight, suitable for enterprise application development
Kafka,linkedin open source MQ products pursue high throughput and are suitable for a large amount of data collection business, such as a large amount of log data generated by Internet business
ZeroMQ, which claims to be the fastest MQ, provides a set of asynchronous message communication libraries to implement advanced complex queues that cannot be implemented by RabbitMQ.
Both Kafka and RabbitMQ need to build a message proxy server and adopt the middleware mode. ZeroMQ adopts non-middleware mode, so there is no need to build a message proxy server.
In the following period of time, I will spend most of my spare time studying these MQ products, but the level is limited for the time being, and I still need a little research on their specific usage scenarios and differences. Today, let's start with a simple RabbitMQ installation tutorial, the system is centos7.
Second, install erlang
RabbitMQ is implemented in Erlang language. Erlang is a new language designed to write concurrent, real-time, distributed systems. It was originally developed for telephone exchanges. The following source code is compiled and installed.
1. Download the source code
Http://www.erlang.org/download.html downloads the latest version of the erlang installation package.
two。 Decompression and installation
$tar xvf otp_src_19.1.tar.gz
$. / configure-prefix=/usr/local/erlang-without-javac
$make
$make install
3. Configure environment variables
Create a new erlang.sh under / etc/profile.d/
$vim / etc/profile.d/erlang.sh
Add the following:
PATH=$PATH:/usr/local/erlang/bin
Export PATH
Make the environment variable effective as follows
$source / etc/profile.d/erlang.sh
4. Simple experience
Hello World program experience:
$vim hello.erl
HellWorld example
We define a module called foo
-module (hello).
Export the function print that has 0 arguments
-export ([print/0])
Print ()->
Io:format ("Hello WorldShop n").
$erlc hello.erl / / compile
$erl / / Interactive command line mode execution
The effect is as follows:
The experiment was a success!
Third, install rabbitmq
1. Install dependencies
Everyone's system has installed some software by default. I need to install three dependencies here.
$yum install-y libxslt rsync zip
two。 Download the rabbitmq binary package
$cd / usr/local
$wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5.tar.xz
3. Installation
It is easy to install using a binary package, as follows:
$cd / usr/local/
$tar Jxvf rabbitmq-server-3.6.5.tar.xz-C.
$ln-s rabbitmq_server-3.6.5 rabbitmq
The rabbit installation directory is / usr/local/rabbitmq
4. Configure environment variables
Create a new rabbitmq.sh in / etc/profile.d/
$vim / etc/profile.d/rabbitmq.sh
Add the following:
PATH=$PATH:/usr/local/rabbitmq/sbin
Export PATH
Make the environment variable effective as follows
$source / etc/profile.d/rabbitmq.sh
5. About rabbitmq Operation
a. Start
The front desk runs:
$rabbitmq-server
Run in the background:
$rabbitmq-server-detached
b. Close
$rabbitmqctl stop
c. View statu
$rabbitmqctl status
Third, about the WEB management plug-in
RabbitMQ provides a set of plug-in mechanism to facilitate functional expansion. Here is one of the most commonly used plug-ins, rabbitmq_management. This plug-in provides comprehensive management and monitoring functions, as well as indicators, which will be described in a later article. First of all, try it and open it in the following way.
1. Enable plug-in
Through the rabbitmq-plugin Management snap-in, the rabbitmq_management plug-in is enabled as follows:
$rabbitmq-plugins enable rabbitmq_management
You can log in to access http://localhost:15672 by using the default user guest and password guest. However, remote access is not possible at this time, but most of the actual scenarios are remote.
The following addresses remote access issues:
two。 Confirm to turn off the firewall
If you cannot remotely log in to access the http://host:15672, make sure that the firewall is turned off. The firewall of my system has been turned on, and the method of closing it is as follows:
$iptables-F
My system centos7, the mechanism of different systems need to be confirmed by themselves.
3. Environment variable
There are three RabbitMQ environment variables:
"system built-in
"rabbitmq-env.conf set variable
"shell environment variable
Priority: shell environment variable > rabbit-env.conf > system built-in
Set by rabbit-env.conf here, etc/rabbitmq/rabbitmq-env.conf under the RabbitMQ installation directory:
$cd / usr/local/rabbitmq/
$vim etc/rabbitmq/rabbitmq-env.conf
Specify the rabbitmq profile as follows:
RABBITMQ_CONFIG_FILE=/usr/local/rabbitmq/etc/rabbitmq/rabbitmq
The above environment variable specifies the rabbitmq configuration file. You need to add the suffix .config, that is, the real file is / usr/local/rabbitmq/etc/rabbitmq/rabbitmq.config:
4. Configure remote access
For enabling guest remote access, the official website http://www.rabbitmq.com/access-control.html has the following paragraph:
Modify the RabbitMQ configuration file as required, as follows:
$vim etc/rabbitmq/rabbitmq.config
Add the following:
[{rabbit, [
{tcp_listeners, [5672]}
{loopback_users, []}
]}].
At this point, visit http://remote_ip:15672 as follows:
The default user name guest and password guest are as follows:
The above is an overview of the status of the RabbitMQ runtime.
At this point, RabbitMQ installs everything OK!
So much for the simple installation of RabbitMQ, specific configuration, use and monitoring and other system skills and other MQ-related knowledge can only be continued.
Reference documentation:
About getting started with Erlang
Http://www.erlang.org/downloads
Http://www.csdn.net/article/2015-10-26/2826038-Erlang
Http://www.csdn.net/article/2015-10-26/2826038-Erlang
About mq
Http://www.rabbitmq.com/access-control.html
Http://www.infoq.com/cn/articles/kafka-analysis-part-1/
Https://www.zhihu.com/question/22480085
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.