CN111475289A - Load balancing method and device - Google Patents

Load balancing method and device Download PDF

Info

Publication number
CN111475289A
CN111475289A CN202010223581.0A CN202010223581A CN111475289A CN 111475289 A CN111475289 A CN 111475289A CN 202010223581 A CN202010223581 A CN 202010223581A CN 111475289 A CN111475289 A CN 111475289A
Authority
CN
China
Prior art keywords
domain name
configuration
user
load balancing
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010223581.0A
Other languages
Chinese (zh)
Other versions
CN111475289B (en
Inventor
张风军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Century Jiatianxia Technology Development Co ltd
Original Assignee
Beijing Century Jiatianxia Technology Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Century Jiatianxia Technology Development Co ltd filed Critical Beijing Century Jiatianxia Technology Development Co ltd
Priority to CN202010223581.0A priority Critical patent/CN111475289B/en
Publication of CN111475289A publication Critical patent/CN111475289A/en
Application granted granted Critical
Publication of CN111475289B publication Critical patent/CN111475289B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Abstract

The invention provides a load balancing method and a device, wherein the method comprises the following steps: when a configuration instruction sent by a user is received, acquiring a domain name and a data center identifier in the configuration instruction, and judging whether the user has an operation authority corresponding to the configuration instruction; if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list of the data center identifier, and acquiring a corresponding virtual IP address in the domain name configuration list; generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time; and sending the configuration file to the proxy server, so that the proxy server acquires the cluster instance information in the registration server in real time and executes the load balancing operation corresponding to the cluster instance information. When the load balancing configuration information is updated every time, the proxy server does not need to be restarted, and the configuration efficiency is improved.

Description

Load balancing method and device
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a load balancing method and apparatus.
Background
With the continuous development of internet technology and the continuous improvement of business volume, the access volume and data flow volume of the network are continuously increased, and the network service cannot be borne by using a single server device. Accordingly, techniques for load balancing have emerged that spread network services across multiple servers, such as Web servers, FTP servers, enterprise critical application servers, and other mission critical servers. Before the network service is distributed to the servers, the servers need to be configured with a load balancing function.
At present, in the process of performing load balancing configuration, a professional is required to compile load balancing configuration information according to a complex balancing configuration parameter bottom layer, and the compiled load balancing configuration information is configured on a proxy server, and when the load balancing configuration information is updated each time, the proxy server needs to be restarted, so that the speed of load balancing configuration is slow, and the resource consumption of the proxy server is increased.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a load balancing method, and when the load balancing configuration information is updated each time, the proxy server does not need to be restarted, so that the configuration speed is improved, and the resource consumption of the proxy server is reduced.
The invention also provides a load balancing device which is used for ensuring the realization and the application of the method in practice.
A method of load balancing, comprising:
when a configuration instruction sent by a user through a preset page is received, acquiring a domain name and a data center identification contained in the configuration instruction, and judging whether the user has an operation authority corresponding to the configuration instruction;
if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list;
generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time;
and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
Optionally, the determining whether the user has the operation right corresponding to the configuration instruction includes:
determining an application service corresponding to the domain name;
acquiring a user list corresponding to the application service from a preset application service authority list;
judging whether the user list contains the user identification of the user;
and if the user list contains the user identification of the user, determining that the user has the operation authority corresponding to the configuration instruction.
Optionally, the obtaining the virtual IP address corresponding to the domain name according to the domain name configuration list includes:
determining domain name information of each alternative domain name in the domain name configuration list, wherein the domain name information comprises domain name types and domain name length information;
determining the arrangement sequence of each alternative domain name according to the domain name information;
matching the domain names with the alternative domain names in sequence based on the arrangement sequence, and judging whether the alternative domain names successfully matched with the domain names exist or not;
if an alternative domain name successfully matched with the domain name exists, determining the virtual IP address of the alternative domain name as the virtual IP address corresponding to the domain name;
if the alternative domain name which is successfully matched with the domain name does not exist, determining a default domain name in the domain name configuration list;
and determining the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
Optionally, in the method, the generating a load balancing configuration file based on the domain name, the virtual IP address, and preset parameters includes:
generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and calling a preset configuration management tool template to render the dynamic parameters, and generating the load balancing configuration file.
Optionally, the obtaining the domain name and the data center identifier included in the configuration instruction includes:
analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and acquiring the domain name and the data center identification contained in the instruction information.
A load balancing apparatus comprising:
the device comprises a receiving unit, a judging unit and a processing unit, wherein the receiving unit is used for acquiring a domain name and a data center identification contained in a configuration instruction when receiving the configuration instruction sent by a user through a preset page, and judging whether the user has an operation authority corresponding to the configuration instruction;
a determining unit, configured to determine a domain name configuration list corresponding to the data center identifier when the user has an operation right corresponding to the configuration instruction, and obtain a virtual IP address corresponding to the domain name according to the domain name configuration list;
the generating unit is used for generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time;
and the sending unit is used for sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires the cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executes the load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
The above apparatus, optionally, the receiving unit that determines whether the user has the operation right corresponding to the configuration instruction includes:
the first determining subunit is used for determining the application service corresponding to the domain name;
the first acquiring subunit is used for acquiring a user list corresponding to the application service from a preset application service authority list;
a judging subunit, configured to judge whether the user list includes the user identifier of the user;
and the second determining subunit is configured to determine that the user has the operation right corresponding to the configuration instruction when the user list includes the user identifier of the user.
The above apparatus, optionally, the determining unit includes:
a third determining subunit, configured to determine domain name information of each alternative domain name in the domain name configuration list, where the domain name information includes a domain name type and domain name length information;
a fourth determining subunit, configured to determine, according to the domain name information, an arrangement order of each of the candidate domain names;
the matching subunit is used for matching the domain names with the alternative domain names in sequence based on the arrangement sequence and judging whether the alternative domain names successfully matched with the domain names exist or not;
a fifth determining subunit, configured to determine, when there is an alternative domain name that is successfully matched with the domain name, a virtual IP address of the alternative domain name as a virtual IP address corresponding to the domain name;
a sixth determining subunit, configured to determine, when there is no alternative domain name that is successfully matched with the domain name, a default domain name in the domain name configuration list;
a seventh determining subunit, configured to determine the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
The above apparatus, optionally, the generating unit includes:
the first generation subunit is used for generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and the second generation subunit is used for calling a preset configuration management tool template to render the dynamic parameters and generate the load balancing configuration file.
Optionally, the above apparatus, where the receiving unit obtains the domain name and the data center identifier included in the configuration instruction, includes:
the analysis subunit is used for analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and the second acquiring subunit is used for acquiring the domain name and the data center identifier contained in the instruction information.
Compared with the prior art, the invention has the following advantages:
the invention provides a load balancing method and a load balancing device, wherein when a configuration instruction sent by a user through a preset page is received, a domain name and a data center identification contained in the configuration instruction are obtained, and whether the user has an operation authority corresponding to the configuration instruction is judged; if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list; generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time; and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy. By applying the load balancing method provided by the invention, the proxy server does not need to be restarted each time the load balancing configuration information is updated, the configuration speed is improved, and the resource consumption of the proxy server is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method of load balancing according to the present invention;
FIG. 2 is a flowchart of a process for determining whether a user has an operation right corresponding to a configuration instruction according to the present invention;
fig. 3 is a flowchart of a process of obtaining a virtual IP address corresponding to a domain name according to a domain name configuration list provided in the present invention;
FIG. 4 is an exemplary diagram of an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a load balancing apparatus according to the present invention;
fig. 6 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention is operational with numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multi-processor apparatus, distributed computing environments that include any of the above devices or equipment, and the like.
An embodiment of the present invention provides a load balancing method, which may be applied to multiple system platforms, where an execution subject of the method may be a processor of a back-end server, a computer terminal of the back-end server, or various mobile devices, and a flowchart of the method is shown in fig. 1, where the method specifically includes:
s101: when a configuration instruction sent by a user through a preset page is received, a domain name and a data center identification contained in the configuration instruction are obtained, and whether the user has an operation authority corresponding to the configuration instruction is judged.
In the method provided by the embodiment of the invention, one data center identifier corresponds to one data center, and one data center is provided with a plurality of server clusters.
The number of the domain name and the data center identifier included in the configuration instruction may be one or more.
Specifically, if the user is a valid user who passes the identity authentication, it may be directly determined whether the user has the authority to operate the application service corresponding to the domain name, if the user has not yet undergone the identity authentication, the user may be authenticated to determine whether the user is a valid user, and if the user is a valid user, it may be determined whether the user has the authority to operate the application service corresponding to the domain name, where each domain name may correspond to one or more application services.
S102: and if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list.
In the method provided by the embodiment of the present invention, the domain name configuration list includes each domain name identified by the data center and a currently configured virtual IP address of each domain name.
S103: and generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time.
In the method provided by the embodiment of the present invention, the registration server includes a consul database, and the registration server and the backend server may be the same server or different servers.
After registering in the registration server according to the domain name and the virtual IP address, the registration server may monitor cluster instance information corresponding to the virtual IP address.
S104: and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
In the method provided by the embodiment of the present invention, the proxy server includes an Nginx module, and the proxy server and the registration server may be the same server or different servers.
Wherein the load balancing policy can be set by a technician.
The invention provides a load balancing method, which comprises the following steps: when a configuration instruction sent by a user through a preset page is received, acquiring a domain name and a data center identification contained in the configuration instruction, and judging whether the user has an operation authority corresponding to the configuration instruction; if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list; generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time; and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy. By applying the load balancing method provided by the invention, the proxy server does not need to be restarted each time the load balancing configuration information is updated, the configuration speed is improved, and the resource consumption of the proxy server is reduced.
In the method provided in the embodiment of the present invention, based on the implementation process, specifically, the process of determining whether the user has the operation right corresponding to the configuration instruction includes, as shown in fig. 2:
s201: and determining the application service corresponding to the domain name.
In the method provided by the embodiment of the present invention, each domain name corresponds to one or more application services, for example, a webpage pointed by the domain name may include one or more application functions, where the application function may be a user login service, a webcast service, and the like, and one application function may be regarded as one application service.
S202: and acquiring a user list corresponding to the application service from a preset application service authority list.
In the method provided by the embodiment of the invention, the application service authority list records a user list of each application service, and the user name list contains each user identifier capable of operating the application service.
S203: and judging whether the user list contains the user identification of the user.
The method provided by the embodiment of the invention can judge whether the user list contains the user identification of the user or not by traversing the user list.
S204: and if the user list contains the user identification of the user, determining that the user has the operation authority corresponding to the configuration instruction.
In the method provided by the embodiment of the present invention, if the user list does not include the user identifier of the user, it may be determined that the user does not have the operation right corresponding to the configuration instruction.
In the method provided in the embodiment of the present invention, based on the implementation process, specifically, the process of obtaining the virtual IP address corresponding to the domain name according to the domain name configuration list includes, as shown in fig. 3:
s301: determining domain name information of each alternative domain name in the domain name configuration list, wherein the domain name information comprises domain name types and domain name length information.
In the method provided by the embodiment of the present invention, the domain name type of the alternative domain name may be: a second level domain name, a third level domain name, or a fourth level domain name, etc.
Each alternative domain name consists of a plurality of characters, and the length information of the domain name can be determined by determining the length of the character string forming the alternative domain name.
Specifically, the domain name configuration table can be referred to in table 1.
Figure BDA0002426911510000081
Figure BDA0002426911510000091
TABLE 1
S302: and determining the arrangement sequence of each alternative domain name according to the domain name information.
In the method provided by the embodiment of the present invention, one way of determining the ranking order of each alternative domain name according to each domain name information may be: firstly, all the alternative domain names are respectively sorted according to the levels of the domain name types from high to ground, and then the alternative domain names with the same level are sorted according to the respective character string lengths from short to long, so that the arrangement sequence of each alternative domain name can be obtained.
Wherein, the result of the arrangement order of the alternative domain names with IDs 2, 3, 4, 5 and 6 in table 1 may be: 4-5-2-3-6.
S303: and matching the domain names with the alternative domain names in sequence based on the arrangement sequence, and judging whether the alternative domain names successfully matched with the domain names exist, if so, executing S304, and if not, executing S305.
In the method provided by the embodiment of the invention, the domain name is regularly matched with each alternative domain name so as to judge whether the alternative domain name which is successfully matched with the domain name exists.
S304: and determining the virtual IP address of the alternative domain name successfully matched with the domain name as the virtual IP address corresponding to the domain name.
In the method provided in the embodiment of the present invention, assuming that the domain name is "test.
S305: determining a default domain name in the domain name configuration list.
In the method provided by the embodiment of the present invention, it may be determined whether a default domain name exists in the domain name configuration list, and if not, a prompt message indicating that the virtual IP address acquisition fails may be sent to the user.
S306: and determining the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
In the method provided by the embodiment of the present invention, the alternative domain name with the ID of 1 in table 1 is the default domain name, and the virtual IP address "192.168.0.1" of the default domain name is determined as the virtual IP address corresponding to the domain name.
In the method provided in the embodiment of the present invention, based on the foregoing implementation process, specifically, the generating a load balancing configuration file based on the domain name, the virtual IP address, and a preset parameter includes:
generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and calling a preset configuration management tool template to render the dynamic parameters, and generating the load balancing configuration file.
In the method provided by the embodiment of the present invention, the preset parameter may be a fixed parameter required for generating a dynamic parameter, and the dynamic parameter is input into the configuration management tool template to generate a load balancing configuration file corresponding to the domain name.
In the method provided in the embodiment of the present invention, based on the implementation process, specifically, the acquiring a domain name and a data center identifier included in the configuration instruction includes:
analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and acquiring the domain name and the data center identification contained in the instruction information.
In the method provided by the embodiment of the invention, the instruction information comprises the domain name currently configured by the user and the data center identification.
Referring to fig. 4, an exemplary view of an implementation scenario provided by the present invention includes a backend server 401, a registration server 402, and a proxy server 403.
In implementation, the proxy server 401, the registration server 402, and the proxy server 403 may be one server, a server cluster composed of a plurality of servers, or a cloud computing service center. The proxy server 401, the registration server 402, and the proxy server may be the same server or different servers.
The backend server 401 establishes a communication connection with the registration server 402 through a network, the backend server 401 establishes a communication connection with the proxy server 403 through a network, and the registration server 402 establishes a communication connection with the proxy server 403.
Embodiments of the present invention relate to networks that are media providing communication links and may include various types of connections, such as wired, wireless communication links, and so forth.
When receiving a configuration instruction sent by a user through a preset page, a processor of the back-end server 401 acquires a domain name and a data center identifier included in the configuration instruction, and determines whether the user has an operation right corresponding to the configuration instruction.
And if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list.
And generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server 402 according to the domain name and the virtual IP address, so as to send cluster instance information corresponding to the domain name to the registration server 402 in real time.
Sending the load balancing configuration file to a preset proxy server 403, so that the proxy server 403 obtains the cluster instance information corresponding to the domain name in real time in the registration server 402 according to the load balancing configuration file, and executes a load balancing operation corresponding to the currently obtained cluster instance information according to a preset load balancing policy.
After receiving the cluster instance information, the proxy server 403 generates a backup file corresponding to the cluster instance information.
Corresponding to the method described in fig. 1, an embodiment of the present invention further provides a load balancing apparatus, which is used for specifically implementing the method in fig. 1, where the load balancing apparatus provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and a schematic structural diagram of the load balancing apparatus is shown in fig. 5, and specifically includes:
a receiving unit 501, configured to, when receiving a configuration instruction sent by a user through a preset page, acquire a domain name and a data center identifier included in the configuration instruction, and determine whether the user has an operation right corresponding to the configuration instruction;
a determining unit 502, configured to determine a domain name configuration list corresponding to the data center identifier when the user has an operation right corresponding to the configuration instruction, and obtain a virtual IP address corresponding to the domain name according to the domain name configuration list;
a generating unit 503, configured to generate a load balancing configuration file based on the domain name, the virtual IP address, and preset parameters, and register in a preset registration server according to the domain name and the virtual IP address, so as to send cluster instance information corresponding to the domain name to the registration server in real time;
a sending unit 504, configured to send the load balancing configuration file to a preset proxy server, so that the proxy server obtains, in the registration server, the cluster instance information corresponding to the domain name in real time according to the load balancing configuration file, and executes, according to a preset load balancing policy, a load balancing operation corresponding to the currently obtained cluster instance information.
In an embodiment of the present invention, based on the above scheme, specifically, the receiving unit 501 for determining whether the user has an operation authority corresponding to the configuration instruction includes:
the first determining subunit is used for determining the application service corresponding to the domain name;
the first acquiring subunit is used for acquiring a user list corresponding to the application service from a preset application service authority list;
a judging subunit, configured to judge whether the user list includes the user identifier of the user;
and the second determining subunit is configured to determine that the user has the operation right corresponding to the configuration instruction when the user list includes the user identifier of the user.
In an embodiment provided by the present invention, based on the above scheme, specifically, the determining unit 502 includes:
a third determining subunit, configured to determine domain name information of each alternative domain name in the domain name configuration list, where the domain name information includes a domain name type and domain name length information;
a fourth determining subunit, configured to determine, according to the domain name information, an arrangement order of each of the candidate domain names;
the matching subunit is used for matching the domain names with the alternative domain names in sequence based on the arrangement sequence and judging whether the alternative domain names successfully matched with the domain names exist or not;
a fifth determining subunit, configured to determine, when there is an alternative domain name that is successfully matched with the domain name, a virtual IP address of the alternative domain name as a virtual IP address corresponding to the domain name;
a sixth determining subunit, configured to determine, when there is no alternative domain name that is successfully matched with the domain name, a default domain name in the domain name configuration list;
a seventh determining subunit, configured to determine the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
In an embodiment provided by the present invention, based on the above scheme, specifically, the generating unit 503 includes:
the first generation subunit is used for generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and the second generation subunit is used for calling a preset configuration management tool template to render the dynamic parameters and generate the load balancing configuration file.
In an embodiment provided by the present invention, based on the above scheme, specifically, the receiving unit 501 for obtaining a domain name and a data center identifier included in the configuration instruction includes:
the analysis subunit is used for analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and the second acquiring subunit is used for acquiring the domain name and the data center identifier contained in the instruction information.
The specific principle and the execution process of each unit and each module in the load balancing device disclosed in the embodiment of the present invention are the same as those of the load balancing method disclosed in the embodiment of the present invention, and reference may be made to corresponding parts in the load balancing method provided in the embodiment of the present invention, which are not described herein again.
The embodiment of the invention also provides a storage medium, which comprises a stored instruction, wherein when the instruction runs, the equipment where the storage medium is located is controlled to execute the load balancing method.
An electronic device is provided in an embodiment of the present invention, and the structural diagram of the electronic device is shown in fig. 6, which specifically includes a memory 601 and one or more instructions 602, where the one or more instructions 602 are stored in the memory 601 and configured to be executed by one or more processors 603 to perform the following operations on the one or more instructions 602:
when a configuration instruction sent by a user through a preset page is received, acquiring a domain name and a data center identification contained in the configuration instruction, and judging whether the user has an operation authority corresponding to the configuration instruction;
if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list;
generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time;
and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The load balancing method and apparatus provided by the present invention are introduced in detail, and a specific example is applied in the description to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method of load balancing, comprising:
when a configuration instruction sent by a user through a preset page is received, acquiring a domain name and a data center identification contained in the configuration instruction, and judging whether the user has an operation authority corresponding to the configuration instruction;
if the user has the operation authority corresponding to the configuration instruction, determining a domain name configuration list corresponding to the data center identification, and acquiring a virtual IP address corresponding to the domain name according to the domain name configuration list;
generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time;
and sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executing load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
2. The method according to claim 1, wherein the determining whether the user has the operation right corresponding to the configuration instruction comprises:
determining an application service corresponding to the domain name;
acquiring a user list corresponding to the application service from a preset application service authority list;
judging whether the user list contains the user identification of the user;
and if the user list contains the user identification of the user, determining that the user has the operation authority corresponding to the configuration instruction.
3. The method according to claim 1, wherein the obtaining the virtual IP address corresponding to the domain name according to the domain name configuration list includes:
determining domain name information of each alternative domain name in the domain name configuration list, wherein the domain name information comprises domain name types and domain name length information;
determining the arrangement sequence of each alternative domain name according to the domain name information;
matching the domain names with the alternative domain names in sequence based on the arrangement sequence, and judging whether the alternative domain names successfully matched with the domain names exist or not;
if an alternative domain name successfully matched with the domain name exists, determining the virtual IP address of the alternative domain name as the virtual IP address corresponding to the domain name;
if the alternative domain name which is successfully matched with the domain name does not exist, determining a default domain name in the domain name configuration list;
and determining the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
4. The method of claim 1, wherein generating a load balancing configuration file based on the domain name, the virtual IP address, and preset parameters comprises:
generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and calling a preset configuration management tool template to render the dynamic parameters, and generating the load balancing configuration file.
5. The method according to claim 1, wherein the obtaining the domain name and the data center identifier included in the configuration instruction comprises:
analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and acquiring the domain name and the data center identification contained in the instruction information.
6. A load balancing apparatus, comprising:
the device comprises a receiving unit, a judging unit and a processing unit, wherein the receiving unit is used for acquiring a domain name and a data center identification contained in a configuration instruction when receiving the configuration instruction sent by a user through a preset page, and judging whether the user has an operation authority corresponding to the configuration instruction;
a determining unit, configured to determine a domain name configuration list corresponding to the data center identifier when the user has an operation right corresponding to the configuration instruction, and obtain a virtual IP address corresponding to the domain name according to the domain name configuration list;
the generating unit is used for generating a load balancing configuration file based on the domain name, the virtual IP address and preset parameters, and registering in a preset registration server according to the domain name and the virtual IP address so as to send cluster instance information corresponding to the domain name to the registration server in real time;
and the sending unit is used for sending the load balancing configuration file to a preset proxy server, so that the proxy server acquires the cluster instance information corresponding to the domain name in the registration server in real time according to the load balancing configuration file, and executes the load balancing operation corresponding to the currently acquired cluster instance information according to a preset load balancing strategy.
7. The apparatus of claim 6, wherein the means for determining whether the user has the operation right corresponding to the configuration instruction comprises:
the first determining subunit is used for determining the application service corresponding to the domain name;
the first acquiring subunit is used for acquiring a user list corresponding to the application service from a preset application service authority list;
a judging subunit, configured to judge whether the user list includes the user identifier of the user;
and the second determining subunit is configured to determine that the user has the operation right corresponding to the configuration instruction when the user list includes the user identifier of the user.
8. The apparatus of claim 6, wherein the determining unit comprises:
a third determining subunit, configured to determine domain name information of each alternative domain name in the domain name configuration list, where the domain name information includes a domain name type and domain name length information;
a fourth determining subunit, configured to determine, according to the domain name information, an arrangement order of each of the candidate domain names;
the matching subunit is used for matching the domain names with the alternative domain names in sequence based on the arrangement sequence and judging whether the alternative domain names successfully matched with the domain names exist or not;
a fifth determining subunit, configured to determine, when there is an alternative domain name that is successfully matched with the domain name, a virtual IP address of the alternative domain name as a virtual IP address corresponding to the domain name;
a sixth determining subunit, configured to determine, when there is no alternative domain name that is successfully matched with the domain name, a default domain name in the domain name configuration list;
a seventh determining subunit, configured to determine the virtual IP address of the default domain name as the virtual IP address corresponding to the domain name.
9. The apparatus of claim 6, wherein the generating unit comprises:
the first generation subunit is used for generating dynamic parameters according to the domain name, the virtual IP address and the parameters;
and the second generation subunit is used for calling a preset configuration management tool template to render the dynamic parameters and generate the load balancing configuration file.
10. The apparatus according to claim 6, wherein the obtaining the receiving unit of the domain name and the data center identifier included in the configuration command includes:
the analysis subunit is used for analyzing the configuration instruction to obtain instruction information of the configuration instruction;
and the second acquiring subunit is used for acquiring the domain name and the data center identifier contained in the instruction information.
CN202010223581.0A 2020-03-26 2020-03-26 Load balancing method and device Active CN111475289B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010223581.0A CN111475289B (en) 2020-03-26 2020-03-26 Load balancing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010223581.0A CN111475289B (en) 2020-03-26 2020-03-26 Load balancing method and device

Publications (2)

Publication Number Publication Date
CN111475289A true CN111475289A (en) 2020-07-31
CN111475289B CN111475289B (en) 2024-04-12

Family

ID=71748419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010223581.0A Active CN111475289B (en) 2020-03-26 2020-03-26 Load balancing method and device

Country Status (1)

Country Link
CN (1) CN111475289B (en)

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060101113A1 (en) * 2004-11-05 2006-05-11 Microsoft Corporation Integrated messaging domain name setup
CN104836864A (en) * 2015-05-12 2015-08-12 广东睿江科技有限公司 Domain name access error correction method and device
CN105871588A (en) * 2015-12-11 2016-08-17 乐视云计算有限公司 Load balance configuration method, device and system
CN106095526A (en) * 2016-06-06 2016-11-09 腾讯科技(深圳)有限公司 Virtual Server Cluster and the dispositions method of server, device and system
CN106210147A (en) * 2016-09-13 2016-12-07 郑州云海信息技术有限公司 A kind of load-balancing method based on poll and device
CN107172176A (en) * 2017-06-02 2017-09-15 美味不用等(上海)信息科技股份有限公司 APP method for connecting network, equipment and configuration server based on configuration management
CN107317887A (en) * 2017-08-23 2017-11-03 北京知道创宇信息技术有限公司 A kind of load-balancing method, device and system
CN109347947A (en) * 2018-10-15 2019-02-15 郑州云海信息技术有限公司 A kind of method of load balancing, name server and cluster nas server
CN109361780A (en) * 2018-10-23 2019-02-19 杭州能链科技有限公司 Obtain method, system and the storage medium of Service Instance
CN109451084A (en) * 2018-09-14 2019-03-08 华为技术有限公司 A kind of service access method and device
CN110224860A (en) * 2019-05-17 2019-09-10 平安科技(深圳)有限公司 Load balancing application creation method, device, computer equipment and storage medium
CN110225094A (en) * 2019-05-17 2019-09-10 平安科技(深圳)有限公司 Load balancing application virtual IP address switching method, device, computer equipment and storage medium
CN110289983A (en) * 2019-05-17 2019-09-27 平安科技(深圳)有限公司 Load balancing application creation method, device, computer equipment and storage medium
CN110677417A (en) * 2019-09-29 2020-01-10 武汉极意网络科技有限公司 Anti-crawler system and method
CN110708309A (en) * 2019-09-29 2020-01-17 武汉极意网络科技有限公司 Anti-crawler system and method
CN110868465A (en) * 2019-11-13 2020-03-06 北京浪潮数据技术有限公司 Load balancing system and method for container cloud

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060168164A1 (en) * 2004-11-05 2006-07-27 Microsoft Corporation Dynamic IP address update
US20060101113A1 (en) * 2004-11-05 2006-05-11 Microsoft Corporation Integrated messaging domain name setup
CN104836864A (en) * 2015-05-12 2015-08-12 广东睿江科技有限公司 Domain name access error correction method and device
CN105871588A (en) * 2015-12-11 2016-08-17 乐视云计算有限公司 Load balance configuration method, device and system
CN106095526A (en) * 2016-06-06 2016-11-09 腾讯科技(深圳)有限公司 Virtual Server Cluster and the dispositions method of server, device and system
CN106210147A (en) * 2016-09-13 2016-12-07 郑州云海信息技术有限公司 A kind of load-balancing method based on poll and device
CN107172176A (en) * 2017-06-02 2017-09-15 美味不用等(上海)信息科技股份有限公司 APP method for connecting network, equipment and configuration server based on configuration management
CN107317887A (en) * 2017-08-23 2017-11-03 北京知道创宇信息技术有限公司 A kind of load-balancing method, device and system
CN109451084A (en) * 2018-09-14 2019-03-08 华为技术有限公司 A kind of service access method and device
CN109347947A (en) * 2018-10-15 2019-02-15 郑州云海信息技术有限公司 A kind of method of load balancing, name server and cluster nas server
CN109361780A (en) * 2018-10-23 2019-02-19 杭州能链科技有限公司 Obtain method, system and the storage medium of Service Instance
CN110224860A (en) * 2019-05-17 2019-09-10 平安科技(深圳)有限公司 Load balancing application creation method, device, computer equipment and storage medium
CN110225094A (en) * 2019-05-17 2019-09-10 平安科技(深圳)有限公司 Load balancing application virtual IP address switching method, device, computer equipment and storage medium
CN110289983A (en) * 2019-05-17 2019-09-27 平安科技(深圳)有限公司 Load balancing application creation method, device, computer equipment and storage medium
CN110677417A (en) * 2019-09-29 2020-01-10 武汉极意网络科技有限公司 Anti-crawler system and method
CN110708309A (en) * 2019-09-29 2020-01-17 武汉极意网络科技有限公司 Anti-crawler system and method
CN110868465A (en) * 2019-11-13 2020-03-06 北京浪潮数据技术有限公司 Load balancing system and method for container cloud

Also Published As

Publication number Publication date
CN111475289B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
US10268841B1 (en) Data anonymity and separation for user computation
US9934310B2 (en) Determining repeat website users via browser uniqueness tracking
CN107920138B (en) User unified identification generation method, device and system
CN107239701B (en) Method and device for identifying malicious website
CN111143207B (en) Method for checking model training notice and training log at mobile terminal
CN110955409B (en) Method and device for creating resources on cloud platform
CN109819023B (en) Distributed transaction processing method and related product
CN105577651A (en) Service providing method and apparatus
CN112380072A (en) Multi-data center access method and system
CN114139135B (en) Equipment login management method, device and storage medium
CN113965543A (en) Access method and device of application server and storage medium
CN106817296A (en) The method of testing of information recommendation, device and electronic equipment
CN111475289B (en) Load balancing method and device
CN107357562B (en) Information filling method, device and client
CN114124883B (en) Data access method and device based on cloud storage address, computer equipment and medium
CN113746918A (en) Hypertext transfer protocol proxy method and system
CN114595457A (en) Task processing method and device, computer equipment and storage medium
CN112000313A (en) Request response method, device, equipment and storage medium
CN112217852A (en) Platform-as-a-service system and method based on workflow engine
CN110704498A (en) Data extraction method, device, equipment and computer readable storage medium
TWI702540B (en) Load control method
CN113765868B (en) Service processing method and device
CN114765599B (en) Subdomain name acquisition method and device
CN110992166B (en) Method and device for testing online loan application
CN110134377B (en) Data request processing method, device and equipment of power industry management information system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant