Multi-machine-room flow automatic switching method and device and storage medium

By configuring the traffic switching configuration in multi-computer room deployment and combining the load balancing mode of lvs and nginx, automatic switching of traffic in multi-computer room is achieved, solving the problem of time-consuming traditional manual switching processes and improving service availability and user experience.

CN119583319APending Publication Date: 2025-03-07JIALIAN PAYMENTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411530578.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

When facing force majeure factors such as instability in the public network, sudden failures in a single computer room, optical cable interruption, etc., the traditional multi-computer room deployment strategy takes a long time and is inefficient, resulting in an extended service interruption time, affecting user experience and business continuity.

Method used

Provide a method of automatic switching of traffic in multiple computer rooms, by configuring basic resources for target services, including traffic switching configurations of service servers and at least two computer rooms. Using the load balancing mode combined with lvs and nginx, traffic is switched between computer rooms, and traffic is automatically switched from the computer room where interruptions occur to other computer rooms.

Benefits of technology

It realizes automation and rapid response of traffic switching, reduces service interruption time, improves business availability and user experience, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583319A_ABST
    Figure CN119583319A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-machine-room flow automatic switching method and device and a storage medium, and is used for improving the flow switching efficiency. The multi-machine-room flow automatic switching method comprises the steps that basic resources are configured for a target service, the basic resources comprise a service server corresponding to the target service and at least two machine rooms for constructing the service server, and flow switching configuration of the at least two machine rooms is set in the service server; when any one of the at least two machine rooms is subjected to flow interruption, the flow sent to the first machine room is switched to the second machine room according to the flow switching configuration, and the first machine room is the machine room subjected to flow interruption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for automatic switching of traffic in multiple computer rooms. Background Art

[0002] In the current context of accelerated digital transformation, enterprises, in pursuit of higher service availability and lower latency, choose to deploy core businesses in multiple data center rooms and across different regions to form a wide range of business coverage and redundancy guarantee mechanisms. However, although this multi-room and multi-region deployment strategy improves the resilience and scalability of services, it is also accompanied by operation and maintenance challenges. In particular, in the face of force majeure factors such as public network instability, sudden failures in a single room, and optical cable interruptions, traditional fault detection and manual switching processes are often time-consuming and inefficient, which can easily lead to extended service interruptions, directly affecting user experience and business continuity, and thus causing significant losses to the company's reputation and economic benefits. Summary of the invention

[0003] In order to solve the above technical problems, the present application provides a method, device and storage medium for automatic switching of traffic in multiple computer rooms, which are used to improve the efficiency of traffic switching.

[0004] The technical solution provided in this application is described below:

[0005] The first aspect of the present application provides a method for automatically switching traffic in multiple computer rooms, comprising:

[0006] Configuring basic resources for the target business, the basic resources comprising a business server corresponding to the target business and at least two computer rooms for constructing the business server, the business server being provided with flow switching configurations of the at least two computer rooms;

[0007] When traffic interruption occurs in any one of the at least two computer rooms, traffic sent to the first computer room is switched to the second computer room according to the traffic switching configuration, and the first computer room is the computer room where the traffic interruption occurs.

[0008] Optionally, when each computer room realizes multiple target services simultaneously, the computer rooms in the basic resources are: a plurality of multi-service computer rooms, each of which constructs multiple service servers.

[0009] Optionally, when at least two computer rooms realize a target business at the same time, the computer rooms in the basic resources are: multiple single-business computer rooms, and the business server constructed in each single-business computer room is the same business server.

[0010] Optionally, the flow switching configuration is:

[0011] According to the load balancing mode combining lvs and nginx, configuration rules for traffic switching are performed in the at least two computer rooms.

[0012] Optionally, the load balancing mode of the combination of lvs and nginx is:

[0013] Based on the load balancing working mode of lvs on the TCP / IP four-layer model, the forwarding of the request of the target business is realized, and based on the load balancing working mode of nginx on the OSI seven-layer model, the traffic weight distribution of the at least two computer rooms is realized.

[0014] Optionally, the traffic switching configuration further includes IP addresses of all computer rooms, and the configuration rule for switching the traffic to the at least two computer rooms includes:

[0015] When the at least two computer rooms include one main computer room and one or more auxiliary computer rooms, the flow weight of the main computer room is set to a first weight, and the flow weight of the auxiliary computer room is set to a second weight, and the first weight is greater than the second weight;

[0016] Allocate traffic according to the first weight and the second weight to obtain an allocation result;

[0017] The request for the target service is forwarded according to the allocation result and the IP address.

[0018] Optionally, the traffic interruption occurring in any one of the at least two computer rooms includes:

[0019] Sending access requests to the at least two computer rooms;

[0020] If no feedback is received from all the computer rooms in the at least two computer rooms, obtaining the corresponding computer room in the at least two computer rooms that has no feedback, wherein the feedback is information in response to the access request and with a return value;

[0021] It is determined that the corresponding computer room is the computer room where the traffic interruption occurs.

[0022] Optionally, before switching the traffic sent to the first computer room to the second computer room according to the traffic switching configuration, the method further includes:

[0023] The computer room with the smallest current resource usage ratio among the at least two computer rooms is obtained, and the computer room with the smallest current resource usage ratio is the second computer room.

[0024] A second aspect of the present application provides a device for automatically switching traffic in multiple computer rooms, comprising:

[0025] A configuration unit, configured to configure basic resources for a target business, wherein the basic resources include a business server corresponding to the target business and at least two computer rooms for constructing the business server, wherein the business server is provided with a traffic switching configuration of the at least two computer rooms;

[0026] The switching unit is used to switch the traffic sent to the first computer room to the second computer room according to the traffic switching configuration when traffic interruption occurs in any one of the at least two computer rooms, and the first computer room is the computer room where the traffic interruption occurs.

[0027] A third aspect of the present application provides a device for automatically switching traffic in multiple computer rooms, the device comprising:

[0028] Processor, memory, input-output unit, and bus;

[0029] The processor is connected to the memory, the input and output unit, and the bus;

[0030] The memory stores a program, and the processor calls the program to execute the first aspect and the method for automatic switching of multi-computer room traffic optionally in any one of the first aspect.

[0031] The fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the method for automatically switching the multi-computer room traffic according to the first aspect and any optional item in the first aspect is executed.

[0032] It can be seen from the above technical solutions that this application has the following advantages:

[0033] The present application provides a method for automatic switching of traffic in multiple computer rooms. The method first configures basic resources for the target business. The basic resources include a business server corresponding to the target business and at least two computer rooms for constructing the business server. The business server is provided with traffic switching configurations for at least two computer rooms. When traffic interruption occurs in any of the at least two computer rooms, the traffic sent to the first computer room is switched to the second computer room according to the traffic switching configuration. The first computer room is the computer room where the traffic interruption occurs. The present application optimizes the network architecture based on the hot standby mode of multiple computer rooms, carries business at the same time, and distributes traffic to multiple computer rooms according to the configuration rules of basic resources, so as to achieve the purpose of high-availability cluster load balancing. When one of the computer rooms fails, the traffic of the failed computer room can be automatically, quickly and timely transferred to other computer rooms to ensure the normal operation of the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0035] Figure 1 A flow chart of an embodiment of a method for automatic switching of multi-machine room traffic provided by the present application;

[0036] Figure 2 A flowchart of another embodiment of the method for automatic switching of multi-machine room traffic provided by the present application;

[0037] Figure 3 A flowchart of another embodiment of the method for automatic switching of multi-machine room traffic provided by the present application;

[0038] Figure 4 A schematic diagram of the structure of an embodiment of the multi-machine room flow automatic switching device provided in the present application;

[0039] Figure 5 This is a structural schematic diagram of another embodiment of the multi-machine room traffic automatic switching device provided in this application. DETAILED DESCRIPTION

[0040] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0041] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0042] In the description of the present invention, it should be understood that descriptions involving orientation, such as up, down, left, right, front, back, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0043] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0044] In the description of the present invention, it should be noted that, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution. In addition, the identification of specific steps below does not represent a limitation on the order of steps and execution logic, and the execution order and execution logic between each step should be understood and inferred with reference to the contents described in the embodiment.

[0045] It should be noted that the method for automatic switching of multi-computer room traffic provided in this application can be applied to terminals, systems, and servers. For example, the terminal can be a smart phone or a computer, a tablet computer, a portable computer terminal, or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses the terminal as an example for explanation.

[0046] It should also be noted that the terms "first", "second", etc. in the specification and drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order, sequence or importance.

[0047] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a method, device and storage medium for automatically switching traffic in multiple computer rooms.

[0048] See also Figure 1 , Figure 1 A flow chart of an embodiment of a method for automatic switching of multi-machine room traffic provided by the present application, the method comprising:

[0049] Step S101, configuring basic resources for the target business, the basic resources including a business server corresponding to the target business and at least two computer rooms for constructing the business server, and the business server is provided with flow switching configurations of at least two computer rooms;

[0050] Step S102: When traffic interruption occurs in any one of the at least two computer rooms, traffic sent to the first computer room is switched to the second computer room according to the traffic switching configuration, and the first computer room is the computer room where the traffic interruption occurs.

[0051] The method for automatic switching of multi-computer room traffic of the present invention first configures basic resources for the target business, the basic resources include the business server corresponding to the target business, and at least two computer rooms for constructing the business server, and the business server is provided with traffic switching configurations of at least two computer rooms; when traffic interruption occurs in any of the at least two computer rooms, the traffic sent to the first computer room is switched to the second computer room according to the traffic switching configuration, and the first computer room is the computer room where the traffic interruption occurs. The optimization of the network architecture of the present application is based on the hot standby mode of multiple computer rooms, carrying services at the same time, and distributing traffic to multiple computer rooms according to the configuration rules of basic resources, so as to achieve the purpose of high-availability cluster load balancing. When one of the computer rooms fails, the traffic of the failed computer room can be automatically, quickly and timely transferred to other computer rooms to ensure the normal operation of the business.

[0052] In step S101 of some embodiments, basic resources are configured for the target business, and the basic resources include a business server corresponding to the target business, and at least two computer rooms for constructing the business server, and the business server is provided with traffic switching configurations of at least two computer rooms. According to the needs of the target business, an appropriate business server is selected or deployed. The business server is a virtual server that carries the core logic, data processing and other functions of the business. At least two computer rooms are constructed in advance based on factors such as business scale and performance requirements to store business servers and other necessary network equipment. The selection and layout of the computer room should take into account factors such as geographical dispersion, network connection quality and physical security to improve the disaster recovery capability and stability of the overall system. Then, the traffic switching configuration is set in the business server to achieve flexible scheduling of traffic between computer rooms. Through reasonable configuration, it can be ensured that when a computer room fails, the traffic can be quickly and accurately switched to other computer rooms, thereby ensuring the continuity of the business.

[0053] It should be noted that there are two situations in which a computer room is responsible for business. One is that each computer room realizes multiple target businesses at the same time, and the other is that multiple computer rooms realize multiple target businesses at the same time. In the first situation, each computer room is a multi-business computer room, so each multi-business computer room will build multiple business servers according to the number of businesses, and respond to different business requests through multiple business servers to improve business efficiency; in the second situation, multiple computer rooms are single-business computer rooms, and the business server built in each single-business computer room is the same business server, and then respond to the same business request through the same business server, realizing data intercommunication and sharing between multiple computer rooms of the same business, avoiding the problem that one computer room is paralyzed and all computer rooms cannot work. In addition, in occasions with a wide range of businesses, the above two situations may occur at the same time, that is, a computer room can realize multiple different businesses by itself, and can also cooperate with other computer rooms to realize the same business.

[0054] It should also be noted that the traffic switching configuration is a configuration rule for traffic switching in at least two computer rooms, which is constructed based on the load balancing mode combining lvs and nginx. The business server will distribute the traffic of the target business in at least two computer rooms according to the above configuration rules to improve the stability and reliability of the system. Specifically, based on the load balancing working mode of lvs on the TCP / IP four-layer model, the forwarding of the request of the target business is realized, and based on the load balancing working mode of nginx on the OSI seven-layer model, the traffic weight distribution of at least two computer rooms is realized. Among them, lvs, as a high-performance load balancing solution under the Linux operating system, mainly works on the TCP / IP four-layer model. Lvs processes the data packets of the transport layer and distributes them to different business servers, realizes the accurate forwarding of the target business request, effectively balances the load, and avoids the situation of single point overload. This load balancing mode based on the TCP / IP four-layer model is efficient and flexible, can handle a large number of concurrent businesses, and ensures the high availability of the business.

[0055] In order to further improve the flexibility and intelligence of the system, nginx will be introduced as another layer of load balancer. Nginx works on the OSI seven-layer model, so it can perform more detailed traffic management according to the specific content of HTTP requests. By configuring various load balancing algorithms, Nginx can distribute traffic according to the traffic weight ratio between at least two computer rooms, that is, it can dynamically adjust the traffic distribution ratio according to multiple factors such as real-time load, geographical location, network delay, etc. in multiple computer rooms to achieve the best load balancing effect. When a computer room fails or the load is too high, our traffic switching configuration can respond quickly. The linkage mechanism of Lvs and nginx can detect the status changes of the computer room in real time and automatically adjust the traffic distribution strategy. For example, if the server in a computer room goes down or the response time becomes longer, Lvs and nginx can immediately reduce or stop sending requests to the computer room, and instead distribute the traffic to other healthy computer rooms. Flexible and efficient traffic switching and load balancing between multiple computer rooms are realized, providing users with a smoother and more reliable service experience.

[0056] Reference Figure 2 The traffic switching configuration also includes the IP addresses of all computer rooms. The configuration rules for switching traffic to at least two computer rooms may include, but are not limited to, the following:

[0057] Step S201: when the at least two computer rooms include one main computer room and one or more auxiliary computer rooms, the flow weight of the main computer room is set to a first weight, and the flow weight of the auxiliary computer room is set to a second weight, and the first weight is greater than the second weight;

[0058] Step S202, allocating traffic according to the first weight and the second weight to obtain an allocation result;

[0059] Step S203: forwarding the request of the target service according to the allocation result and the IP address.

[0060] In steps S201 to S203 of some embodiments, when at least two computer rooms include one main computer room and more than one auxiliary computer room, the traffic weight of the main computer room is set to the first weight, and the traffic weight of the auxiliary computer room is set to the second weight, and the first weight is greater than the second weight; then the traffic is allocated according to the first weight and the second weight to obtain the allocation result; and the request of the target service is forwarded according to the allocation result and the IP address. According to the processing power, the network environment of the location of the computer room or other higher priority factors, one computer room is selected as the main computer room from at least two computer rooms, and the other computer rooms are selected as auxiliary computer rooms, and the traffic weight of the main computer room is used as the first weight, and the traffic weight of the auxiliary computer room is used as the second weight. Since the main computer room has advantages such as stronger processing power and better network environment, it can undertake more business or an important part of the business, so the first weight is greater than the second weight, so that the traffic allocated to the main computer room is greater than that of the auxiliary computer room.

[0061] After determining the weight of each computer room, the number or proportion of requests that each computer room should receive is calculated based on the weight ratio of the main computer room and the secondary computer room. This process can be dynamic and can be adjusted as factors such as network conditions and computer room load change. Then, based on the allocation results and the corresponding IP address, each business request entering the system is forwarded to the corresponding computer room to ensure that the business traffic can reach the designated computer room correctly and efficiently. In addition, during the forwarding process, the load and network conditions of each computer room will be continuously monitored. If a computer room is overloaded or fails, the load balancer will immediately adjust the traffic distribution strategy to transfer part or all of the traffic to other healthy computer rooms.

[0062] In step S102 of some embodiments, when a flow interruption occurs in any one of at least two computer rooms, the flow sent to the first computer room is switched to the second computer room according to the flow switching configuration, and the first computer room is the computer room where the flow interruption occurs. The flow status of the computer room can be monitored in real time by means of flow monitoring, log analysis, alarm system, etc. Once it is found that the flow of a certain computer room (the first computer room) is abnormally interrupted or greatly reduced, the flow sent to the first computer room is immediately switched to the second computer room according to the flow switching configuration in step S101, and the fault detection mechanism is triggered. The flow interruption in the first computer room means that the first computer room can no longer transmit data at this time and can no longer communicate with the data control center or other computer rooms. Therefore, the subsequent flow originally to be sent to the first computer room must be switched to the second computer room. The switching process should be as fast and smooth as possible to reduce the impact on the business. At the same time, after the switch, it should be ensured that the second computer room can carry the switched flow and maintain the normal operation of the business. In addition, after the traffic switching is completed, the fault of the first computer room can be immediately checked and handled: take appropriate repair measures according to the cause of the fault, such as restarting the equipment, repairing network faults, updating software, etc. After the fault handling is completed, the first computer room can also be restored to ensure that it can be reconnected to the system and work normally.

[0063] It should be noted that before switching the traffic sent to the first computer room to the second computer room according to the traffic switching configuration, it should also be determined whether there is the most suitable second computer room to receive the traffic that should have been sent to the first computer room. The judgment is based on, for example, the resource usage ratio. Specifically, the computer room with the lowest current resource usage ratio among at least two computer rooms is obtained, and the computer room with the lowest current resource usage ratio is the second computer room. The lowest resource usage ratio means that the computer room has the most idle space among all computer rooms. Sending the traffic that should have been sent to the first computer room to the second computer room with the most idle space can maximize the efficiency and quality of responding to the target business.

[0064] Reference Figure 3 The steps for determining whether a flow interruption occurs in any one of at least two computer rooms may specifically include, but are not limited to, the following:

[0065] Step S301, sending access requests to at least two computer rooms;

[0066] Step S302: If no feedback is received from all the computer rooms in the at least two computer rooms, the corresponding computer room in the at least two computer rooms that has no feedback is obtained, and the feedback is information of responding to the access request and attaching a return value;

[0067] Step S303: determine that the corresponding computer room is the computer room where traffic interruption occurs.

[0068] In steps S301 to S303 of some embodiments, an access request is first sent to at least two computer rooms; if no feedback is received from all computer rooms in at least two computer rooms, the corresponding computer room without feedback in at least two computer rooms is obtained, and the feedback is information of responding to the access request and attaching a return value; then the corresponding computer room is determined to be the computer room where the traffic interruption occurs. In order to monitor the online status and response capability of each computer room in real time, by sending an access request and obtaining corresponding feedback, it is determined whether each computer room can normally receive and respond to the target service. After sending the access request to at least two computer rooms, wait to receive feedback from each computer room. At the same time, a timeout period can be pre-set for waiting for feedback from the computer room. If no feedback is received from a certain computer room within the timeout period, it is considered that the computer room has no response, and the information of the computer room that has not responded is recorded, and the computer room information may include the IP address of the computer room or the target service it is responsible for. Based on the information of the computer rooms that have not responded, these computer rooms are marked as "computer rooms where the traffic interruption occurs". Further measures can be taken based on the computer room information of all computer rooms, such as starting a backup computer room, etc. At the same time, error messages can be sent to the client to notify the staff, thereby ensuring service continuity and data availability.

[0069] The above embodiment describes the method for automatic switching of multi-machine room traffic provided by the present application. The following describes the device and storage medium for automatic switching of multi-machine room traffic provided by the present application:

[0070] See also Figure 4 , Figure 4 This is a schematic diagram of an embodiment of a device for automatically switching traffic between multiple computer rooms provided in the present application. The device for automatically switching traffic between multiple computer rooms includes:

[0071] The configuration unit 401 is used to configure basic resources for the target business, where the basic resources include a business server corresponding to the target business and at least two computer rooms for constructing the business server, and the business server is provided with flow switching configurations of at least two computer rooms;

[0072] The switching unit 402 is used to switch the traffic sent to the first computer room to the second computer room according to the traffic switching configuration when traffic interruption occurs in any one of the at least two computer rooms, and the first computer room is the computer room where the traffic interruption occurs.

[0073] Optionally, when each computer room realizes multiple target services simultaneously, the computer rooms in the basic resources are: a plurality of multi-service computer rooms, each of which constructs multiple service servers.

[0074] Optionally, when at least two computer rooms realize a target business at the same time, the computer rooms in the basic resources are: multiple single-business computer rooms, and the business server constructed in each single-business computer room is the same business server.

[0075] Optionally, the traffic switching configuration is:

[0076] According to the load balancing mode combining LVS and Nginx, configuration rules for traffic switching are performed in at least two computer rooms.

[0077] Optionally, the load balancing mode of lvs combined with nginx is:

[0078] Based on the load balancing working mode of lvs on the TCP / IP four-layer model, the forwarding of target business requests is realized, and based on the load balancing working mode of nginx on the OSI seven-layer model, the traffic weight distribution of at least two computer rooms is realized.

[0079] Optionally, the traffic switching configuration also includes the IP addresses of all computer rooms. The configuration rules for switching traffic to at least two computer rooms include:

[0080] When the at least two computer rooms include one main computer room and more than one auxiliary computer room, the flow weight of the main computer room is set to the first weight, and the flow weight of the auxiliary computer room is set to the second weight, and the first weight is greater than the second weight;

[0081] Allocate traffic according to the first weight and the second weight to obtain an allocation result;

[0082] The request for the target service is forwarded according to the allocated IP address.

[0083] Optionally, the switching unit 402 is specifically configured to:

[0084] Send access requests to at least two computer rooms;

[0085] If no feedback is received from all the computer rooms in at least two computer rooms, then the corresponding computer room in at least two computer rooms that has no feedback is obtained, and the feedback is information of responding to the access request and attaching a return value;

[0086] Determine the corresponding computer room as the one where traffic interruption occurs.

[0087] Optionally, before the switching unit 402, the method further includes:

[0088] The acquisition unit 403 is used to acquire the computer room with the smallest current resource usage ratio among the at least two computer rooms, and the computer room with the smallest current resource usage ratio is the second computer room.

[0089] This application also provides a device for automatically switching traffic in multiple computer rooms, please refer to Figure 5 The device for automatically switching the traffic of multiple computer rooms includes:

[0090] Processor 501, memory 502, input and output unit 503, bus 504;

[0091] The processor 501 is connected to the memory 502, the input and output unit 503 and the bus 504;

[0092] The memory 502 stores a program, and the processor 501 calls the program to execute the following steps: Figure 1-3 The method for automatically switching traffic in multiple computer rooms shown in any one of the embodiments.

[0093] The present application also relates to a computer-readable storage medium, on which a program is stored, and when the program is run on a computer, the computer executes the following Figure 1-3 The method for automatically switching traffic in multiple computer rooms shown in any one of the embodiments.

[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0095] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0097] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A method for automatically switching traffic in multiple computer rooms, characterized in that: The method comprises: Configuring basic resources for the target business, the basic resources comprising a business server corresponding to the target business and at least two computer rooms for constructing the business server, the business server being provided with flow switching configurations of the at least two computer rooms; When traffic interruption occurs in any one of the at least two computer rooms, traffic sent to the first computer room is switched to the second computer room according to the traffic switching configuration, and the first computer room is the computer room where the traffic interruption occurs.

2. The method according to claim 1, characterized in that When each computer room realizes multiple target services simultaneously, the computer rooms in the basic resources are: a plurality of multi-service computer rooms, each of which constructs multiple service servers.

3. The method according to claim 1, characterized in that When at least two computer rooms realize a target business at the same time, the computer rooms in the basic resources are: multiple single-business computer rooms, and the business server constructed in each single-business computer room is the same business server.

4. The method according to claim 1, characterized in that The flow switching configuration is: According to the load balancing mode combining lvs and nginx, configuration rules for traffic switching are performed in the at least two computer rooms.

5. The method according to claim 4, characterized in that The load balancing mode of the combination of lvs and nginx is: Based on the load balancing working mode of lvs on the TCP / IP four-layer model, the forwarding of the request of the target business is realized, and based on the load balancing working mode of nginx on the OSI seven-layer model, the traffic weight distribution of the at least two computer rooms is realized.

6. The method according to claim 5, characterized in that The traffic switching configuration also includes the IP addresses of all computer rooms, and the configuration rules for switching the traffic to the at least two computer rooms include: When the at least two computer rooms include one main computer room and one or more auxiliary computer rooms, the flow weight of the main computer room is set to a first weight, and the flow weight of the auxiliary computer room is set to a second weight, and the first weight is greater than the second weight; Allocate traffic according to the first weight and the second weight to obtain an allocation result; The request for the target service is forwarded according to the allocation result and the IP address.

7. The method according to claim 1, characterized in that Traffic interruption in any one of the at least two computer rooms includes: Sending access requests to the at least two computer rooms; If no feedback is received from all the computer rooms in the at least two computer rooms, obtaining the corresponding computer room in the at least two computer rooms that has no feedback, wherein the feedback is information in response to the access request and attached with a return value; It is determined that the corresponding computer room is the computer room where the traffic interruption occurs.

8. The method according to any one of claims 1 to 7, characterized in that Before switching the traffic sent to the first computer room to the second computer room according to the traffic switching configuration, the method further includes: The computer room with the smallest current resource usage ratio among the at least two computer rooms is obtained, and the computer room with the smallest current resource usage ratio is the second computer room.

9. A device for automatically switching traffic between multiple computer rooms, characterized in that: The device comprises: A configuration unit, configured to configure basic resources for a target business, wherein the basic resources include a business server corresponding to the target business and at least two computer rooms for constructing the business server, wherein the business server is provided with a traffic switching configuration of the at least two computer rooms; The switching unit is used to switch the traffic sent to the first computer room to the second computer room according to the traffic switching configuration when traffic interruption occurs in any one of the at least two computer rooms, and the first computer room is the computer room where the traffic interruption occurs.

10. A device for automatically switching traffic in multiple computer rooms, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method for automatic switching of multi-computer room traffic as described in any one of claims 1 to 8.