current position:Home>Ten minutes to understand rocketmq and installation application
Ten minutes to understand rocketmq and installation application
2022-01-27 02:30:12 【There are people on the mountain】
RocketMQ Introduction and construction
RocketMQ Introduce
Message Queuing Middleware is an important component of distributed system , Mainly solve application coupling , Asynchronous messaging , Flow cutting
Achieve high performance , High availability , Scalable and ultimately consistent architecture . Many message queues are ActiveMQ,RabbitMQ,ZeroMQ,Kafka,MetaMQ,RocketMQ, Let's focus on RocketMQ Construction and use of .RocketMQ It is a message middleware of queue model developed by Ali , Open source to apache The foundation became apache Top open source projects , High performance 、 Highly reliable 、 High real time 、 Distributed features .
Application scenarios
Message queuing is widely used in the development of Internet technology , It is mainly used to solve the problem of application coupling , Message delivery , Flow cutting . The following describes the common use scenarios of message queuing in practical applications ( Take the user's order as an example ).
The application of decoupling
The scene that : A simple scenario in which users increase their points according to the payment amount after placing an order , In the traditional mode, the order module needs to call the integral module interface , In this way, the order module and the integral module form a system coupling , Once the integral module is modified or abnormal, it will affect the function of the order module . After introducing the message queue scheme , After the user orders successfully , Just write the message to the message queue . The point module only needs to subscribe to the order message , Get data from the message queue for consumption , In this way, the order module and integral module only need to focus on realizing their own functions , Realize decoupling .
Data dissemination
The scene that : After the user places an order, the log module shall record the order log , The inventory module needs to reduce the corresponding inventory , The integration module needs to add user points and other business operations of other modules caused by the success of the order , At this time, the message queue can make the data flow more among multiple systems . Data producers don't need to care who uses the data , Just send the data to the message queue , The data user can get the data directly in the message queue .
Peak shaving and valley filling
The scene that : The request traffic received by the system soared during the double 11 , It's possible to crush the system . The traditional approach is to ensure the stability of the system , Generally, the server configuration is increased 、 Load balancing for new servers is a waste of server performance when the service can be met in normal time , It's not worth it ! Another approach is if the system load exceeds the threshold , Will prevent the user from requesting , But this can affect the user experience during peak traffic . This problem can be solved perfectly through message queuing , After the introduction of message queuing scheme, a large number of requests can be cached , Spread over a long period of time , This can greatly mention the stability of the system and the user experience .
RocketMQ install
RocketMQ It's pure. Java、 Distributed 、 Open source message middleware of queue model , build RocketMQ Configuration required JAVA environment variable .
Download installation package
Go to the official website and select the required version to download the installation package ( The following 4.8.0 For example ). Official website download address : Download from the official website
Download the compiled binary file , You can also choose your own source file . It is mainly installed in the form of binary package .
The download is also shown in the figure below :
install RocketMQ
1、 Unzip the installation package , Go to the installation directory bin Folder , This includes MQ The startup script , Include sh and cmd Script ;
2、 Modify virtual machine memory ,RocketMQ The default virtual machine has large memory , start-up Broker perhaps NameServer May fail due to insufficient memory , It needs to be modified according to the actual situation Broker and NameServer Virtual machine memory for . compile runbroker and runserver file (win Modify in environment cmd Script ,linux Modify in environment sh The script can be ), The following are the reference settings :
# With linux In the environment, for example , edit runbroker.sh and runserver.sh Change the default JVM size
$ vi bin/runbroker.sh
# modify -server Parameters
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g"
$ vi bin/runserver.sh
# modify -server Parameters
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
start-up RocketMQ
1、 start-up NameServer
# windows Start in environment
.\mqnamesrv
# linux Start in environment
sh mqnamesrv
# Background start
nohup sh mqnamesrv &
2、 start-up Broker
# windows Start in environment
.\mqbroker -n 127.0.0.1:9876
# linux Start in environment
sh mqbroker -n 127.0.0.1:9876
# Background start
nohup sh mqbroker -n localhost:9876 &
3、 close MQ service
# windows Start in environment
.\mqshutdown namesrv // close NameServer
.\mqshutdown broker // close Broker
# linux Start in environment
sh bin/mqshutdown namesrv // close NameServer
sh bin/mqshutdown broker // close Broker
window If you can't start broker, Delete c:/user/ user name /store Ask all questions and restart .
Build a visual monitoring platform
rocketmq-dashboard yes RocketMQ An expanded open source project , It can be done to MQ Visual monitoring .
Download address :https://github.com/apache/rocketmq-dashboard
1、 Download the project and add the namesrv Change the address to your own NameServer Address ;
2、 Compile and package after configuration , Then start the packaged jar That's all right. ;
After successful startup, you can access... Through the browser http://ip Address : port Go to the console page , Visual query MQ Information about services , As shown in the figure below :
For detailed use of the console, you can view :https://github.com/apache/rocketmq-dashboard/blob/master/docs/1_0_0/UserGuide_CN.md
thus RocketMQ Installation completed .
copyright notice
author[There are people on the mountain],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270230093298.html
The sidebar is recommended
- Spring IOC container loading process
- [thinking] the difference between singleton mode and static method - object-oriented programming
- Hadoop environment setup (MySQL environment configuration)
- 10 minutes, using node JS creates a real-time early warning system for bad weather!
- Git tool
- Force deduction algorithm - 92 Reverse linked list II
- What is the sub problem of dynamic programming?
- C / C + +: static keyword summary
- Idea does not have the artifacts option when configuring Tomcat
- Anaconda can't open it
guess what you like
-
I don't know how to start this
-
Matlab simulation of transportation optimization algorithm based on PSO
-
MySQL slow log optimization
-
[Vue] as the window is stretched (larger, smaller, wider and higher), the text will not be displayed
-
Popular Linux distributions for embedded computing
-
Suzhou computer research
-
After installing SSL Certificate in Windows + tomcat, the domain name request is not successful. Please answer!!
-
Implementation time output and greetings of jQuery instance
-
The 72 year old uncle became popular. Wu Jing and Guo fan made his story into a film, which made countless dreamers blush
-
How to save computer research
Random recommended
- Springboot implements excel import and export, which is easy to use, and poi can be thrown away
- The final examination subjects of a class are mathematical programming, and the scores are sorted and output from high to low
- Two pronged approach, Tsinghua Professor Pro code JDK and hotspot source code notes, one-time learning to understand
- C + + recursive knapsack problem
- The use of GIT and GitHub and the latest git tutorial are easy to understand -- Video notes of crazy God speaking
- PostgreSQL statement query
- Ignition database test
- Context didn't understand why he got a high salary?, Nginxfair principle
- Bootstrap switch switch control user's guide, springcloud actual combat video
- A list that contains only strings. What other search methods can be used except sequential search
- [matlab path planning] multi ant colony algorithm grid map path planning [including GUI source code 650]
- [matlab path planning] improved genetic algorithm grid map path planning [including source code phase 525]
- Iinternet network path management system
- Appium settings app is not running after 5000ms
- Reactnative foundation - 07 (background image, status bar, statusbar)
- Reactnative foundation - 04 (custom rpx)
- If you want an embedded database (H2, hsql or Derby), please put it on the classpath
- When using stm32g070 Hal library, if you want to write to flash, you must perform an erase. If you don't let it, you can't write continuously.
- Linux checks where the software is installed and what files are installed
- SQL statement fuzzy query and time interval filtering
- 69. Sqrt (x) (c + + problem solving version with vs runnable source program)
- Fresh students are about to graduate. Do you choose Java development or big data?
- Java project: OA management system (java + SSM + bootstrap + MySQL + JSP)
- Titanic passenger survival prediction
- Vectorization of deep learning formula
- Configuration and use of private image warehouse of microservice architect docker
- Relearn JavaScript events
- For someone, delete return 1 and return 0
- How does Java dynamically obtain what type of data is passed? It is used to judge whether the data is the same, dynamic data type
- How does the database cow optimize SQL?
- [data structure] chain structure of binary tree (pre order traversal) (middle order traversal) (post order traversal) (sequence traversal)
- Webpack packaging optimization solution
- 5. Operation element
- Detailed explanation of red and black trees
- redhat7. 9 install database 19C
- Blue Bridge Cup notes: (the given elements are not repeated) complete arrangement (arrangement cannot be repeated, arrangement can be repeated)
- Detailed explanation of springboot default package scanning mechanism and @ componentscan specified scanning path
- How to solve the run-time exception of test times
- Detailed explanation of k8s management tool kubectl
- Android system view memory command