A method, system, device and storage medium compatible with multiple policies
By configuring multiple policies under the DNS domain name and mapping the client IP, the problem of single DNS domain name load balancing policy is solved, and flexible multi-policy application and usability are improved.
Patent Information
- Application Number
- CN202310182993.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-02-24
AI Technical Summary
In the existing DNS domain name load balancing strategy, one domain name can only correspond to one strategy, and different balancing strategies cannot be used simultaneously on different clients, resulting in limited application scenarios and poor usability.
By configuring different balancing strategies under the domain name and mapping the client IP and balancing strategy, a configuration file is formed. The corresponding balancing strategy is found according to the domain name request and client IP, the IP group is determined, and the IP is returned.
It realizes setting different balancing strategies for different clients through one domain name, expands the multi-strategy application scenarios of load balancing, improves the flexibility and ease of use of the application, and ensures the uniqueness of the storage entry.
Smart Images

Figure CN116170451B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed file systems, and more specifically, to a method, system, device and storage medium compatible with multiple policies. Background Art
[0002] DNS (Domain Name Server) is responsible for converting domain names (such as www.cctv.com) into IP addresses (such as 202.108.249.208). There is a one-to-one correspondence between domain names and IP addresses. The conversion between them is called domain name resolution, which needs to be completed by a dedicated domain name resolution server. There are multiple balancing strategies in the current DNS domain name load balancing strategy, such as polling strategy, number of connections strategy, CPU utilization strategy, bandwidth utilization strategy, etc. Under the current solution, if you want to use a certain strategy, you must configure the corresponding domain name, that is, one domain name corresponds to one strategy. When different clients need to use different balancing strategies at the same time, it is impossible to have a single domain name entry. Summary of the Invention
[0003] In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device and computer-readable storage medium that are compatible with multiple strategies. The present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, and make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios. It also simplifies the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0004] Based on the above-mentioned purpose, one aspect of an embodiment of the present invention provides a method for being compatible with multiple strategies, comprising the following steps: configuring different balancing strategies under a domain name, and mapping the client IP and the balancing strategy to form a configuration file; in response to receiving a domain name request from a client, searching for a corresponding configuration file based on the domain name and client IP in the domain name request; obtaining the balancing strategy corresponding to the domain name and client IP from the corresponding configuration file, and determining a corresponding IP group based on the corresponding balancing strategy; and obtaining an IP from the corresponding IP group based on the corresponding balancing strategy, and returning the IP to the client.
[0005] In some implementations, mapping the client IP address and the balancing strategy to form a configuration file includes mapping each client IP address to only one balancing strategy, and setting different balancing strategies for different IP addresses of the same client address.
[0006] In some implementations, mapping and configuring the client IP address and the balancing policy to form a configuration file includes: setting a unique domain name, and configuring different balancing policies under the domain name.
[0007] In some implementations, mapping and configuring the client IP and the balancing policy to form a configuration file includes: setting different policies to correspond to different IP groups, and the same IP group can belong to multiple balancing policies.
[0008] In some implementations, mapping and configuring the client IP address and the balancing policy to form a configuration file includes: configuring the configuration file using standard XML formatting.
[0009] In some implementations, mapping the client IP and the balancing policy to form a configuration file includes: adding functions for adding, deleting, modifying, and searching the mapping relationship between the client IP and the balancing policy, and setting the modification function to only modify the balancing policy of the client IP.
[0010] In some implementations, the method further includes: in response to starting the load balancing service, loading the configuration file content, and performing a structured analysis of the configuration file content and saving it in a structure of a global variable.
[0011] Another aspect of an embodiment of the present invention provides a system compatible with multiple policies, including: a setting module, configured to configure different balancing policies under a domain name, and map the client IP and the balancing policy to form a configuration file; a search module, configured to respond to a domain name request received from a client, and search for a corresponding configuration file based on the domain name and client IP in the domain name request; a matching module, configured to obtain the balancing policy corresponding to the domain name and client IP from the corresponding configuration file, and determine the corresponding IP group based on the corresponding balancing policy; and a feedback module, configured to obtain an IP from the corresponding IP group based on the corresponding balancing policy, and return the IP to the client.
[0012] According to another aspect of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores computer instructions that can be run on the processor, and the instructions implement the steps of the above method when executed by the processor.
[0013] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.
[0014] The present invention has the following beneficial technical effects: different balancing strategies can be set for different clients through a domain name, which expands the multi-strategy application scenarios of load balancing, makes the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and simplifies the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 A schematic diagram of an embodiment of a method for compatibility with multiple strategies provided by the present invention;
[0017] Figure 2 A schematic diagram of an embodiment of a system compatible with multiple strategies provided by the present invention;
[0018] Figure 3 A schematic diagram of the hardware structure of an embodiment of a computer device compatible with multiple strategies provided by the present invention;
[0019] Figure 4 A schematic diagram of an embodiment of a computer storage medium compatible with multiple policies provided by the present invention. DETAILED DESCRIPTION
[0020] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0021] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. Subsequent embodiments will not explain this one by one.
[0022] A first aspect of the embodiments of the present invention provides an embodiment of a method for being compatible with multiple strategies. Figure 1 FIG. 1 is a schematic diagram of an embodiment of a method for being compatible with multiple strategies provided by the present invention. Figure 1 As shown, the embodiment of the present invention includes the following steps:
[0023] S1. Configure different balancing policies under the domain name and map the client IP address and balancing policy to form a configuration file.
[0024] S2. In response to receiving a domain name request from the client, searching for a corresponding configuration file based on the domain name in the domain name request and the client IP address;
[0025] S3. Obtaining a balancing policy corresponding to the domain name and the client IP from the corresponding configuration file, and determining a corresponding IP group according to the corresponding balancing policy; and
[0026] S4. Obtain an IP from the corresponding IP group according to the corresponding balancing strategy, and return the IP to the client.
[0027] The implementation principle of DNS load balancing technology is to configure multiple IP addresses for the same host name in the DNS server. When responding to DNS queries, the DNS server will return different resolution results for each query in sequence using the IP address of the host record in the DNS file, guiding the client's access to different machines, allowing different clients to access different servers, thereby achieving the purpose of load balancing.
[0028] Load balancing refers to: In a distributed file system, a domain name resolution balancing service based on PDNS provides controllable polling strategy, connection number strategy and bandwidth utilization balancing strategy. PDNS: refers to PowerDNS, which is a cross-platform open source DNS service component. DNS record queries can be roughly divided into two types: querying the local cache and upward recursive queries. Unlike other DNS software such as BIND and dnsmasq that integrate these functions together, PowerDNS divides it into two, PowerDNS Authoritative Server and PowerDNS Recursor, corresponding to these two main needs respectively. The commonly mentioned PDNS refers to PowerDNS Authoritative Server, which is mainly used as an authoritative domain name server. Of course, it can also provide DNS query functions as an ordinary DNS server.
[0029] The load balancing strategies include weighted round-robin, CPU utilization, number of connections, port bandwidth utilization, and comprehensive load. Weighted round-robin: When a client accesses through a domain name, each IP that requires load under the same domain name is randomly selected to handle the client's business. CPU utilization: When a client accesses through a domain name, the weight is calculated based on the CPU utilization performance data of each node, and the weight is used as the probability to select a node to handle the client's business. Port bandwidth utilization: When a client accesses through a domain name, the weight is calculated based on the total bandwidth utilization performance data of each node, and the weight is used as the probability to select a node to handle the client's business. Number of connections: When a client accesses through a domain name, the weight is calculated based on the NAS connection number performance data of each node, and the weight is used as the probability to select a node to handle the client's business. Comprehensive load: When a client accesses through a domain name, a node is selected to handle the client's business based on the comprehensive load of the node in the performance data. The node load is calculated based on CPU utilization, bandwidth utilization, and the number of NAS connections. The lower the load, the higher the probability of being selected.
[0030] The embodiments of the present invention can set different balancing strategies for different clients through a single domain name, thus expanding the application scenarios of multiple strategies for load balancing. This makes the application of load balancing strategies more flexible and diverse for more complex application business scenarios, and also simplifies the application of multiple strategies, making the entire storage external entrance unique and making it easier for customers to use. Under the premise of a unified domain name, the embodiments of the present invention enable multiple load balancing strategies to work together, improving the cluster pressure balance in multi-business and complex scenarios and the specific client balancing business needs.
[0031] Configure different balancing policies under the domain name and map the client IP address to the balancing policy to form a configuration file. Set the domain name and make each domain name unique.
[0032] In some embodiments, mapping the client IP address and the balancing policy to form a configuration file includes mapping each client IP address to only one balancing policy, and configuring different balancing policies for different IP addresses of the same client. Mapping the client IP address or IP address group to the balancing policy.
[0033] In some embodiments, mapping client IP addresses to balancing policies to form a configuration file includes setting a unique domain name and configuring different balancing policies under that domain name. In this embodiment, each client IP address is unique, meaning that each client IP address has only one balancing policy. However, different network segment IP addresses for the same client address can correspond to different balancing policies. For example, a node with a Gigabit IP address corresponds to a round-robin policy, while a 10 Gigabit IP address corresponds to a connection count policy.
[0034] In some embodiments, mapping the client IP address and the balancing policy to form a configuration file includes: configuring different policies to correspond to different IP groups, and the same IP group can belong to multiple balancing policies. Different balancing policies are configured under the domain name, and different policies correspond to different IP groups, and the same IP can belong to multiple balancing policies.
[0035] In some implementations, mapping and configuring the client IP address and the balancing policy to form a configuration file includes: configuring the configuration file using standard XML formatting.
[0036] Set the domain name, client IP / IP group, and balancing policy. Verify the IP format to determine if the client IP / IP group already exists. If so, the addition fails. If not, the addition succeeds. Once all client IP / IP groups are added, add the corresponding balancing policy to the client IP / IP group. Once all balancing policies for all client IP / IP groups are added, the setup is complete.
[0037] In some embodiments, mapping and configuring client IP addresses and balancing policies to form a configuration file includes: adding functionality for adding, deleting, modifying, and searching the mapping relationship between client IP addresses and balancing policies, and configuring the modification function to only modify the balancing policy for the client IP address. The load balancing configuration file still utilizes the existing standard XML formatting configuration, and the domain name, associated policies, and IP group still utilize existing commands, with the following modifications: adding functionality for adding, deleting, modifying, and searching the mapping relationship between client IP addresses and balancing policies, wherein modifications only modify the balancing policy for the IP address; and enabling the addition of multiple load balancing policies under a domain name, each with its own IP group.
[0038] In some embodiments, the method further comprises: in response to starting the load balancing service, loading the configuration file content, and storing the structured parsed configuration file content in a structure of global variables. When the advanced load balancing service is started, the configuration file content is first loaded, and the structured parsed configuration file content is stored in a structure of global variables.
[0039] In response to receiving a domain name request from a client, the system searches a configuration file corresponding to the domain name and client IP address in the domain name request. A balancing policy corresponding to the domain name and client IP address is obtained from the configuration file, and a corresponding IP group is determined based on the balancing policy. An IP address is obtained from the IP group based on the balancing policy, and the IP address is returned to the client.
[0040] When a domain name request is received from a client, it is parsed. The request includes the domain name and client IP address. Based on the domain name and client IP address in the domain name request, the configuration file is searched and parsed to find the balancing policy corresponding to the client IP address under the corresponding domain name. If the client IP address does not exist in the configuration file, an exception is returned. The corresponding IP group is searched based on the balancing policy, and the IP address is parsed based on the balancing policy. The resolved IP address is returned to the client.
[0041] The present invention improves the use scenarios of advanced load balancing, especially in scenarios with multiple storage nodes and multiple client services. Different client services may have different pressure manifestations, such as high bandwidth requirements and high IOPS (Input / Output Operations Per Second, a performance test measurement method for computer storage devices such as hard disks (HDDs), solid-state drives (SSDs) or storage area networks (SANs), which can be regarded as the number of reads and writes per second). Different balancing strategies are needed to ensure that the pressure of each node is balanced as much as possible. On the premise of improving service balance in complex scenarios, the product's usability and competitiveness are improved.
[0042] The embodiment of the present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and also simplify the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0043] It should be pointed out in particular that the various steps in the various embodiments of the above-mentioned method for being compatible with multiple strategies can be cross-linked, replaced, added, or deleted with each other. Therefore, these reasonable permutations, combinations, and transformations of the method for being compatible with multiple strategies should also fall within the scope of protection of the present invention, and the scope of protection of the present invention should not be limited to the embodiments.
[0044] Based on the above purpose, the second aspect of the embodiment of the present invention proposes a system compatible with multiple strategies. Figure 2 As shown, the system 200 includes the following modules: a setting module, configured to configure different balancing strategies under a domain name, and map the client IP and the balancing strategy to form a configuration file; a search module, configured to respond to a domain name request received from a client, and search for a corresponding configuration file according to the domain name and client IP in the domain name request; a matching module, configured to obtain the balancing strategy corresponding to the domain name and client IP from the corresponding configuration file, and determine the corresponding IP group according to the corresponding balancing strategy; and a feedback module, configured to obtain an IP from the corresponding IP group according to the corresponding balancing strategy, and return the IP to the client.
[0045] In some implementations, the setting module is configured to: map each client IP address to only one balancing strategy, and set different balancing strategies for different IP addresses of the same client address.
[0046] In some implementations, the setting module is configured to: set a unique domain name, and configure different balancing strategies under the domain name.
[0047] In some implementations, the setting module is configured to set different policies corresponding to different IP groups, and the same IP group can belong to multiple balancing policies.
[0048] In some embodiments, the setting module is configured to: use a configuration file formed by a standard XML format configuration.
[0049] In some implementations, the setting module is configured to: add functions of adding, deleting, modifying, and searching for mapping relationships between client IPs and balancing policies, and set the modification function to only modify the balancing policy of the client IP.
[0050] In some embodiments, the system further includes a loading module configured to: in response to starting the load balancing service, load the configuration file content, and store the configuration file content in a structured parsed form in a global variable structure.
[0051] The embodiment of the present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and also simplify the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0052] Based on the above-mentioned purpose, the third aspect of the embodiment of the present invention proposes a computer device, comprising: at least one processor; and a memory, the memory storing computer instructions that can be run on the processor, the instructions being executed by the processor to implement the following steps: S1, configuring different balancing strategies under the domain name, and mapping the client IP and the balancing strategy to form a configuration file; S2, in response to receiving a domain name request from the client, searching for a corresponding configuration file according to the domain name and client IP in the domain name request; S3, obtaining the balancing strategy corresponding to the domain name and client IP from the corresponding configuration file, and determining the corresponding IP group according to the corresponding balancing strategy; and S4, obtaining an IP from the corresponding IP group according to the corresponding balancing strategy, and returning the IP to the client.
[0053] In some implementations, mapping the client IP address and the balancing strategy to form a configuration file includes mapping each client IP address to only one balancing strategy, and setting different balancing strategies for different IP addresses of the same client address.
[0054] In some implementations, mapping and configuring the client IP address and the balancing policy to form a configuration file includes: setting a unique domain name, and configuring different balancing policies under the domain name.
[0055] In some implementations, mapping and configuring the client IP and the balancing policy to form a configuration file includes: setting different policies to correspond to different IP groups, and the same IP group can belong to multiple balancing policies.
[0056] In some implementations, mapping and configuring the client IP address and the balancing policy to form a configuration file includes: configuring the configuration file using standard XML formatting.
[0057] In some implementations, mapping the client IP and the balancing policy to form a configuration file includes: adding functions for adding, deleting, modifying, and searching the mapping relationship between the client IP and the balancing policy, and setting the modification function to only modify the balancing policy of the client IP.
[0058] In some implementations, the steps further include: in response to starting the load balancing service, loading the configuration file content, and structurally parsing the configuration file content and saving it in a structure of global variables.
[0059] The embodiment of the present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and also simplify the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0060] like Figure 3 FIG. 1 is a schematic diagram of the hardware structure of an embodiment of the multi-strategy compatible computer device provided by the present invention.
[0061] As Figure 3 Taking the device shown as an example, the device includes a processor 301 and a memory 302.
[0062] The processor 301 and the memory 302 may be connected via a bus or other means. Figure 3 The bus connection is taken as an example.
[0063] Memory 302, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the program instructions / modules corresponding to the multi-policy compatible method in the embodiments of the present application. Processor 301 executes the non-volatile software programs, instructions, and modules stored in memory 302 to execute various functional applications and data processing of the server, thereby implementing the multi-policy compatible method.
[0064] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of a method compatible with multiple policies, etc. In addition, the memory 302 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely located relative to the processor 301, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0065] Computer instructions 303 corresponding to one or more multi-strategy compatible methods are stored in the memory 302 , and when executed by the processor 301 , the multi-strategy compatible method in any of the above method embodiments is executed.
[0066] A method for being compatible with multiple policies includes the following steps: configuring different balancing policies under a domain name, and mapping a client IP address and the balancing policy to form a configuration file; in response to receiving a domain name request from a client, searching for a corresponding configuration file according to the domain name and the client IP address in the domain name request; obtaining the balancing policy corresponding to the domain name and the client IP address from the corresponding configuration file, and determining a corresponding IP group according to the corresponding balancing policy; and obtaining an IP address from the corresponding IP group according to the corresponding balancing policy, and returning the IP address to the client.
[0067] In some implementations, mapping the client IP address and the balancing strategy to form a configuration file includes mapping each client IP address to only one balancing strategy, and setting different balancing strategies for different IP addresses of the same client address.
[0068] In some implementations, mapping the client IP and the balancing policy to form a configuration file includes: adding functions for adding, deleting, modifying, and searching the mapping relationship between the client IP and the balancing policy, and setting the modification function to only modify the balancing policy of the client IP.
[0069] In some implementations, the method further includes: in response to starting the load balancing service, loading the configuration file content, and performing a structured analysis of the configuration file content and saving it in a structure of a global variable.
[0070] The embodiment of the present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and also simplify the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0071] Any embodiment of a computer device that executes the above-mentioned method for being compatible with multiple policies can achieve the same or similar effects as any corresponding embodiment of the above-mentioned method.
[0072] The present invention also provides a computer-readable storage medium storing a computer program for executing the method for being compatible with multiple strategies when the computer-readable storage medium is executed by a processor.
[0073] like Figure 4 As shown in FIG, a schematic diagram of an embodiment of the computer storage medium compatible with multiple strategies provided by the present invention. Figure 4 Taking the computer storage medium shown as an example, the computer readable storage medium 401 stores a computer program 402 that performs the above method when executed by a processor.
[0074] A method for being compatible with multiple policies includes the following steps: configuring different balancing policies under a domain name, and mapping a client IP address and the balancing policy to form a configuration file; in response to receiving a domain name request from a client, searching for a corresponding configuration file according to the domain name and client IP address in the domain name request; obtaining the balancing policy corresponding to the domain name and client IP address from the corresponding configuration file, and determining a corresponding IP group according to the corresponding balancing policy; and obtaining an IP address from the corresponding IP group according to the corresponding balancing policy, and returning the IP address to the client.
[0075] In some implementations, mapping the client IP address and the balancing strategy to form a configuration file includes mapping each client IP address to only one balancing strategy, and setting different balancing strategies for different IP addresses of the same client address.
[0076] In some implementations, mapping the client IP and the balancing policy to form a configuration file includes: adding functions for adding, deleting, modifying, and searching the mapping relationship between the client IP and the balancing policy, and setting the modification function to only modify the balancing policy of the client IP.
[0077] In some implementations, the method further includes: in response to starting the load balancing service, loading the configuration file content, and performing a structured analysis of the configuration file content and saving it in a structure of a global variable.
[0078] The embodiment of the present invention can set different balancing strategies for different clients through a domain name, expand the multi-strategy application scenarios of load balancing, make the application of load balancing strategies more flexible and changeable for more responsible application business scenarios, and also simplify the application of multiple strategies, making the entire storage external entrance unique, making it easier for customers to use.
[0079] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program for the multi-strategy compatible method can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium of the program can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM). The above-mentioned computer program embodiment can achieve the same or similar effects as any of the corresponding aforementioned method embodiments.
[0080] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope of the embodiments disclosed in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless expressly limited to the singular.
[0081] It should be understood that, as used herein, the singular forms "a" and "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" is intended to include any and all possible combinations of one or more of the associated listed items.
[0082] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0083] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program instructing the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk, or an optical disk, etc.
[0084] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples. Within the spirit of the embodiments of the present invention, the technical features of the above embodiments or different embodiments may be combined, and there are many other variations of different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the scope of protection of the embodiments of the present invention.
Claims
1. A method compatible with multiple strategies, characterized in that: The steps include: Configure different balancing policies under the domain name and map the client IP address and balancing policy to form a configuration file. In response to receiving a domain name request from a client, searching for a corresponding configuration file based on the domain name in the domain name request and the client IP address; Obtaining a balancing policy corresponding to the domain name and the client IP from the corresponding configuration file, and determining a corresponding IP group according to the corresponding balancing policy; as well as Obtain an IP from the corresponding IP group according to the corresponding balancing strategy, and return the IP to the client; The mapping and configuring of the client IP and the balancing strategy to form a configuration file includes: mapping each client IP to only one balancing strategy, and setting different balancing strategies for different network segment IPs of the same client; setting a unique domain name, and configuring different balancing strategies under the domain name; setting different balancing strategies to correspond to different IP groups, and the same IP group can belong to multiple balancing strategies; In response to starting the load balancing service, the configuration file content is loaded, and the configuration file content is structured and parsed and saved in a structure of global variables.
2. The method according to claim 1, characterized in that Mapping the client IP address and the balancing policy to form a configuration file includes: The configuration file is formed using standard XML formatting.
3. The method according to claim 1, characterized in that Mapping the client IP address and the balancing policy to form a configuration file includes: Added functions for adding, deleting, modifying, and searching the mapping relationship between client IP and balancing policy, and set the modification function to only modify the balancing policy of the client IP.
4. A system compatible with multiple strategies, characterized in that: include: The setting module is used to configure different balancing strategies under the domain name and map the client IP and balancing strategy to form a configuration file; A search module configured to, in response to receiving a domain name request from a client, search for a corresponding configuration file according to the domain name in the domain name request and the client IP address; A matching module configured to obtain a balancing policy corresponding to the domain name and the client IP from the corresponding configuration file, and determine a corresponding IP group according to the corresponding balancing policy; as well as A feedback module configured to obtain an IP from the corresponding IP group according to the corresponding balancing strategy and return the IP to the client; The setting module is further configured to map each client IP to only one balancing strategy, and set different balancing strategies for different network segment IPs of the same client; set a unique domain name, and configure different balancing strategies under the domain name; set different balancing strategies to correspond to different IP groups, and the same IP group can belong to multiple balancing strategies; The feedback module is further configured to load the configuration file content in response to starting the load balancing service, and store the configuration file content in a structured parsed form in a global variable structure.
5. A computer device, characterized in that: include: at least one processor; as well as A memory storing computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 3.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Load balance processing system and method
CN106330610A