In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "what is the concept of distributed, micro-service and cluster", so the editor summarizes the following contents, with detailed contents and clear steps, which can be used for reference. I hope you can get something after reading this article. Let's take a look at this "what is the concept of distributed, micro-service and cluster".
I. distributed
Pony is running an online shopping site called TT Cat, which has modules such as commodity management, order management, user management, payment management, shopping cart and so on, each of which is deployed to a separate cloud service host.
Now, programmer Xiao Ming visits the TT cat and wants to buy a powerful cherry mechanical keyboard to improve his work efficiency. So he opened the TT cat home page, searched for products, browsed details and comments, added shopping carts, placed orders, paid, and so on. Xiaoming completed the shopping fluently in one go, and of course spent a lot of money.
But the system is how to carry out this series of operations, the following figure intricate invocation relationship (ignore some of the details). Users can't see or touch it, but the whole process of placing an order walks between the networks.
TT cat distributes all the functional modules in different places and finally completes a series of user requests, which is probably a distributed system.
Second, micro-service
Bloggers believe that micro-service is an architecture and is also within the scope of distribution. How micro is called micro? In distributed systems, microservices put more emphasis on single responsibility, lightweight communication (HTTP), independence and process isolation. Well, there is nothing more to say. We should learn more about Spring-Cloud-related micro-service components.
TT cats hold some activities every year, such as Singles Day, which is a favorite of girls (Singles Day). In the dead of night, a large number of users will pour in in an instant, and they may knock down a service.
At this time, the problem comes to the user to issue an order timed out, or directly 500 errors, how to solve?
Third, load balancing cluster
How can such a thing happen in such an important event? In fact, Dad Ma bought a number of servers in advance, and the engineers have copied and deployed multiple copies of each business function module.
Each module with the same function forms a group and is managed in a single system mode. When a girl places an order, she actually has a relationship with a cluster group, but the system will ensure that only one of them has a relationship with whom, and the cluster group has its own scheduling algorithm. Don't worry about not having a relationship with a girl.
For example, if you live in ancient times, 18 years old, unmarried, rich and handsome, there is an urgent need to solve personal physical problems. Therefore, you came to the legendary wind and moon field, ahem, this ancient time is legal. At this time, the procuress or the big teapot comes to greet you. If there is no special request, you will be taken into a house where there is a dusty woman.
As soon as the painting style changes, there are no blinded titanium alloy dog eyes of their own programmers. You can understand that the pimp is the load balancer, the built-in scheduling algorithm, and the windy woman is one of the sets.
All right, let's get back to the point. Ellipsis makes up for itself. Friends who see this may ask, what do we use as load balancers in the production environment?
Those with deep pockets use hardware F5, those who are not short of money use DNS load balancing technology, and small start-up companies that struggle with LVS can only use Nginx.
Of course, there are more than the above load balancers, interested students Google to understand.
The article "on knowledge and Action" says: knowing what it is and why, let's briefly talk about how these load balancers walk in the network. Friends who have studied the network probably know the seven-layer network model.
First of all, a picture for you to review the basic courses of the university.
Is there an instant feeling of books in class that is not enjoyable? And a TCP/IP five-layer model.
There are different devices working on each layer. For example, the F5 used by state-owned enterprises with deep pockets and no shortage of money works in layer 4-7. The LVS used by Internet enterprises generally works in the transport layer, and the most widely used Nginx works in the application layer.
Finally, let's talk about DNS load balancer. Although DNS is the most primitive and simplest method, the control of DNS load balancer is in the hands of domain name service providers. NDS has the problem of multi-level resolution, caching A records, and the website itself cannot do more management. As a result, small and medium-sized companies rarely use it.
Of course, its own strength is hard enough, DNS load balancing is also a good choice. The following figure shows some of the information obtained from the A record of the TT cat domain name, which is for reference only and can be understood by yourself.
IV. Highly available clusters
Since it is a cluster, there can be no single point of failure. If you pay attention to cloud services, you may be exposed to the following words, such as "dual-computer hot backup", "two places and three centers" and so on.
Dual-machine hot backup is a form of high availability. As shown in the figure above, we have two load balancer nodes in the production environment. The primary node is active and the other node is in standby state. When the primary node goes down unexpectedly, it can be detected by keepalived and quickly switched to standby service to ensure normal business operation. As for the two places and three centers, the following picture may make you understand more clearly, the picture is from the Internet.
5. Elastic cloud
Brother Ma purchased a large number of servers in order to prepare for Singles Day, but after the activity, the usual user visits could not meet the reception capacity of the server, resulting in a large number of servers in the empty window period.
This is also good, can not be idle ah, smart pony a pat on the head, set up the TT cloud team. Through years of efforts to develop pay-per-view cloud, elastic IP, shared bandwidth and other products for small and medium-sized enterprises to increase revenue and reduce expenditure.
VI. Failover
Xiaoming students think this keyboard is good, happily click the buy button, suddenly jumped to the landing page.
What the heck, I took off my pants, and that's what you showed me? Ordinary users may not think there is any problem, just log in again. But Xiaoming, as a serious programmer, wants to figure out what's going on.
After careful inspection and analysis of the data, Xiaoming came to the following conclusions:
❝
In the event of the above failure, Xiaoming thought the service in which he placed the order hung up and the request was distributed to another service, but why did he skip to the landing page? As a programmer, Xiao Ming clearly knows that services are divided into stateful and stateless. Although our usual HTTP requests are stateless, we usually use cookie or session to determine the user status.
At this point, you should understand what kind of ghost it is. Take Tomcat, which we are familiar with. Our user information is generally stored in session, while session is stored in Tomcat memory. The browser authenticates with the server through JSESSIONID in cookie.
However, the server hung up, the order request was distributed to another service, and naturally Xiaoming could no longer find his session.
Xiao Ming fed back the problem to the TT cat. Brother Ma saw that it was all right, and the cluster was still poor, so he hurriedly asked the engineers to come up with a solution.
The engineer finally came up with two options:
Server user status replication (high cost, hardware and software support, delay, risk of failure) uniformly stores user status (if I don't speak, I smile)
In the end, the engineers adopted the second option, using Redis to store user state data.
Knowledge supplement
Recently I came into contact with and used Aliyun's load balancer SLB to get a general understanding of the load balancer implementation of TT cats. The following architecture implementation comes from TT cats.
Load balancer uses cluster deployment to achieve session synchronization to eliminate a single point of failure of the server, enhance redundancy and ensure the stability of the service. Aliyun currently provides load balancing services at layer 4 (TCP protocol and UDP protocol) and layer 7 (HTTP and HTTPS protocol).
The fourth layer uses open source software LVS (Linux Virtual Server) + keepalived to achieve load balancing. The seventh layer uses Tengine to achieve load balancing.
As shown in the following figure, layer-4 load balancing in each region is actually run by multiple LVS machines deployed into a LVS cluster. The adoption of cluster deployment model greatly ensures the availability, stability and scalability of load balancing service in abnormal cases.
Each LVS in the LVS cluster carries out conversations and synchronizes the multicast messages to other LVS machines in the cluster, thus realizing the session synchronization among the machines in the LVS cluster. As shown in the following figure, when the client transmits three packets to the server, session An established on LVS1 begins to synchronize to other LVS machines. The solid line in the figure represents the existing connection, and the dotted line in the figure indicates that when the LVS1 fails or is maintained, this part of the traffic will go to a functioning machine LVS2. Therefore, the load balancing cluster supports hot upgrade, and is most transparent to users in case of machine failure and cluster maintenance, and does not affect user business.
The above is the content of this article on "what is the concept of distribution, micro-service and cluster". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.