Simple application based on rabbitmq (detailed explanation)

Although the read-write separation technology is used in the background, which can resist high concurrency to a certain extent, if the amount of concurrency is particularly huge, the main database cannot process high concurrency requests at the same time, and the database is prone to downtime.

Question:

The problem now is how to ensure the normal operation of the database and realize the warehousing operation of user data?

Solution:

Introducing rabbitmq Technology:

explain:

When the access pressure of the database is overloaded, the overloaded data will be saved to rabbitmq first. The data structure is in the form of queue, first in first out. At this time, the database fetches data from the queue for execution. Until all data operations in the queue are completed.

Rabbitmq is the message middleware.

Rabbitmq introduction:

Rabbitmq performance analysis:

1. MSMQ: it is a Microsoft product applied to Net framework

2. ActiveMQ: it is a product of Apache. It is widely used for business

3. Rabbitqm: Ericsson's products (early mobile phone manufacturers) are based on Erlang language (functional programming big data Scala language)

4. Zeromq: it is widely used in big data, but it is easy to lose data However, the utilization rate in the business system is less

5. Kafkamq: used in big data projects, 500000 / S is now the mainstream

5. Rabbitmq environment construction:

1. Configure JDK:

2. Fixed virtual machine IP address:

3. Connect virtual machine:

Edit file jump path:

Vim go

Cd /usr/local/src

2. Install rabbitmq:

1. Create a new file rabbitmq

/usr/local/src/rabbitmq

2. Import the installation file

3. Install rabbitmq

4. Enable remote user access:

Copy the file to the specified directory:

cp /usr/share/doc/rabbitmq-server-3.6. 1/rabbitmq. config. example /etc/rabbitmq/rabbitmq. config

Modify the newly copied file 64 lines

1. Remove%%

2. Remove the number

Amend to read:

5. Open rabbitmq:

Execute command:

rabbitmq-plugins enable rabbitmq_ management

Indicates successful startup

6. Open ports 15672 and 5672

iptables -I INPUT -p tcp --dport 15672 -j ACCEPT

Access the console of rabbitmq

iptables -I INPUT -p tcp --dport 5672 -j ACCEPT

The port on which the program connects to rabbitmq

Or turn off the firewall

7. Start / stop service

Service rabbitmq server start

Service rabbitmq server stop

Service rabbitmq server restart

8. Remote login:

visit:

http://192.168.154.137:15672/

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>