CN115967718A - Load balancing method and device, storage medium and electronic device - Google Patents

Load balancing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN115967718A
CN115967718A CN202211697627.8A CN202211697627A CN115967718A CN 115967718 A CN115967718 A CN 115967718A CN 202211697627 A CN202211697627 A CN 202211697627A CN 115967718 A CN115967718 A CN 115967718A
Authority
CN
China
Prior art keywords
node
domain name
target
name system
slave
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.)
Pending
Application number
CN202211697627.8A
Other languages
Chinese (zh)
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.)
Shanghai Xinsaiyun Computing Technology Co ltd
Original Assignee
Shanghai Xinsaiyun Computing Technology 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 Shanghai Xinsaiyun Computing Technology Co ltd filed Critical Shanghai Xinsaiyun Computing Technology Co ltd
Priority to CN202211697627.8A priority Critical patent/CN115967718A/en
Publication of CN115967718A publication Critical patent/CN115967718A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides a load balancing method, a load balancing device, a storage medium and an electronic device, wherein the method comprises the following steps: monitoring target domain name system contents stored in a data storage system of a target cluster, wherein the target domain name system contents comprise sub-domain name system contents respectively corresponding to each slave node, and the sub-domain name system contents comprise a corresponding relation between a domain name and a network address of the slave node; acquiring node information of each slave node; determining a target slave node from the plurality of slave nodes based on the node information; and modifying the network address corresponding to the domain name included in the content of the target domain name system into the target address of the target slave node so as to balance the load of the target cluster. By the method and the device, the problem of low load balancing efficiency in the related technology is solved, and the effect of improving the load balancing efficiency is achieved.

Description

Load balancing method and device, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a load balancing method, a load balancing device, a storage medium and an electronic device.
Background
In the related art, load balancing of the domain name is usually realized by utilizing nginx + haloproxy + keepalived, so that manual configuration test is required, automatic configuration monitoring cannot be realized, related settings are updated, and a failover node is uncontrollable.
Therefore, the related art has the problem of low load balancing efficiency.
In view of the above problems in the related art, no effective solution has been proposed.
Disclosure of Invention
Embodiments of the present invention provide a load balancing method and apparatus, a storage medium, and an electronic apparatus, so as to at least solve a problem of low load balancing efficiency in the related art.
According to an embodiment of the present invention, there is provided a load balancing method, including: monitoring target domain name system contents stored in a data storage system of a target cluster, wherein the target domain name system contents comprise sub-domain name system contents respectively corresponding to each slave node, and the sub-domain name system contents comprise a corresponding relation between a domain name and a network address of the slave node; acquiring node information of each slave node; determining a target slave node from the plurality of slave nodes based on the node information; and modifying the network address corresponding to the domain name included in the target domain name system content into the target address of the target slave node so as to balance the load of the target cluster.
According to another embodiment of the present invention, there is provided a load balancing apparatus including: the system comprises a monitoring module, a data storage module and a processing module, wherein the monitoring module is used for monitoring target domain name system contents stored in a data storage system of a target cluster, the target domain name system contents comprise sub domain name system contents respectively corresponding to each slave node, and the sub domain name system contents comprise the corresponding relation between a domain name and a network address of the slave node; an obtaining module, configured to obtain node information of each slave node; a determining module for determining a target slave node from the plurality of slave nodes based on the node information; and the balancing module is used for modifying the network address corresponding to the domain name included in the target domain name system content into the target address of the target slave node so as to balance the load of the target cluster.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to, when executed, perform the steps of any of the method embodiments described above.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the method and the device, the target domain name system content stored in the data storage system of the target cluster is monitored, wherein the target domain name system content comprises sub domain name system content corresponding to each slave node, the sub domain name system content comprises the corresponding relation between a domain name and a network address of the slave node, the node information of each slave node is obtained, the target slave node is determined from a plurality of nodes according to the node information, and the network address corresponding to the domain name included in the target domain name system content is modified into the target address of the target slave node so as to balance the load of the target cluster. During load balancing, the corresponding relation between the domain name of each slave node and the network address of the slave node can be monitored in the data storage system of the target cluster, the target slave node is determined according to the node information of the slave node, and the network address corresponding to the domain name included in the content of the target domain name system is modified into the target address of the target slave node, so that the load of the target cluster is balanced, and manual configuration test is not needed, therefore, the problem of low load balancing efficiency in the related technology can be solved, and the effect of improving the load balancing efficiency is achieved.
Drawings
Fig. 1 is a block diagram of a hardware structure of a mobile terminal of a load balancing method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of load balancing according to an embodiment of the invention;
FIG. 3 is a flow diagram of a method of load balancing according to a specific embodiment of the present invention;
FIG. 4 is a schematic diagram of a high available resource movement structure according to an exemplary embodiment of the present invention;
fig. 5 is a block diagram of an apparatus for load balancing according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the operation on the mobile terminal as an example, fig. 1 is a hardware structure block diagram of the mobile terminal of a load balancing method according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the load balancing method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a method for load balancing is provided, and fig. 2 is a flowchart of the method for load balancing according to the embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, monitoring target domain name system contents stored in a data storage system of a target cluster, wherein the target domain name system contents comprise sub domain name system contents respectively corresponding to each slave node, and the sub domain name system contents comprise a corresponding relation between a domain name and a network address of the slave node;
step S204, acquiring node information of each slave node;
step S206, determining a target slave node from the plurality of slave nodes based on the node information;
step S208, modifying the network address corresponding to the domain name included in the target domain name system content into the target address of the target slave node, so as to balance the load of the target cluster.
In the above embodiment, the target cluster may be a k8s cluster, the target cluster may include a plurality of nodes, the master node master may be selected from the plurality of nodes, and the other nodes may be determined as slave nodes. After the master node master is elected, the master node master can monitor and acquire node information of each slave node, determine an optimal node included in the plurality of slave nodes according to the node information, and determine a target slave node from the optimal node.
In the above embodiment, the rgw-balance service may be deployed in each node included in the target cluster, after the rgw-balance is started, the balance configuration file is read first to register the rpc and the web service (for providing http interface setting), after the registration is successful, election is started, the election generates a master, and the logic of the election may be executed by the rgw-balance. Corresponding rgw-balance service is deployed according to an actual node, a main selection algorithm is mainly to start a session firstly, and when election is carried out, an ordered id is created under a specified directory for queuing, and whether the id of the main selection algorithm is the minimum value or not is judged. If the minimum value is the minimum value, the minimum value becomes Leader, namely master. If its id is not the minimum, the election queue blocks the queue state, which is Follower. The election will wait the id of the previous candidate in team, and when it disappears, it will become the minimum value itself, and choose Leader and exit the queue. After the master node is hung, one master node is selected from the rest nodes again, so that the stability of load balancing is enhanced. Wherein, the rgw-balance is responsible for domain name setting and load balancing service.
In the above embodiment, one domain name may correspond to IP addresses of a plurality of slave nodes, and node information of the plurality of slave nodes corresponding to the domain name may be determined, so as to determine the target slave node according to the node information. For example, the master node may periodically obtain balance information, obtain node information of all nodes, perform a load balancing algorithm according to the balance information and the node information, support polling, and select an optimal node according to the node information including a cpu load, the number of connections, and the like, to determine a target node. After the target node is determined, modifying the ip corresponding to the domain name in the key of/dns/domain in the data storage system, modifying the address into the target address of the target slave node, and dynamically updating the zone data, thereby realizing load balancing. The data storage system may be an etcd, and domain name system contents, that is, dns contents of each node are stored in the data storage system.
The main body for executing the above steps may be a master node, etc., but is not limited thereto.
According to the method and the device, the target domain name system content stored in the data storage system of the target cluster is monitored, wherein the target domain name system content comprises sub domain name system content corresponding to each slave node, the sub domain name system content comprises the corresponding relation between a domain name and a network address of the slave node, the node information of each slave node is obtained, the target slave node is determined from a plurality of nodes according to the node information, and the network address corresponding to the domain name included in the target domain name system content is modified into the target address of the target slave node so as to balance the load of the target cluster. During load balancing, the corresponding relation between the domain name of each slave node and the network address of the slave node can be monitored in the data storage system of the target cluster, the target slave node is determined according to the node information of the slave node, and the network address corresponding to the domain name included in the content of the target domain name system is modified into the target address of the target slave node, so that the load of the target cluster is balanced, and manual configuration test is not needed, therefore, the problem of low load balancing efficiency in the related technology can be solved, and the effect of improving the load balancing efficiency is achieved.
In one exemplary embodiment, the obtaining the node information of each slave node comprises: under the condition that the content of the target domain name system changes, acquiring the node information of each slave node; wherein the target domain name system content changing comprises: the method comprises the steps that when the slave node determines that a load balancing service is deployed in the slave node, the slave node monitors sub domain name system content corresponding to the slave node based on the load balancing service, inquires local domain name system content locally stored in the slave node, compares the local domain name system content with the sub domain name system content to obtain a comparison result, and changes the sub domain name system content into the local domain name system content when the comparison result indicates that the local domain name system content is different from the sub domain name system content. In this embodiment, a data storage system, such as a target domain name system stored in the etcd, may be detected, the content of a target sub-domain name system whose content is changed and included in the content of the target domain name system is determined, and the node information of the slave node is obtained in the presence of the content whose content is changed. For each slave node, after rgw-balance is started, dns content can be acquired from the etcd, and a query is sent to a local dns service, that is, a corresponding relation between a domain name and an ip is queried. And comparing whether the local domain name system content is consistent with the sub-domain name system content, if so, continuing initialization, and if not, dynamically updating the dns content. When the dns content is updated, that is, the sub domain name system content is updated, the zone information can be updated by using rndc and ddns, and the zone data step is performed. The rndc is a tool for remotely managing the bind, and the tool can be used for locally or remotely knowing the current operating condition of the server and can also be used for closing, reloading, refreshing the cache, adding and deleting the zone and the like of the server. ddns is dynamic domain name service, which maps dynamic IP address to a fixed domain name resolution service, and when a user connects to a network, a client program transmits the dynamic IP address of the host to a server program located on a service provider host through information transmission, and the server program is responsible for providing DNS service and realizing dynamic domain name resolution. It should be noted that rgw-balance is to dynamically calculate and change the corresponding value through the content stored by the etcd to realize load balancing, and if the etcd has no related record, the local domain name system content does not need to be acquired and compared.
In the above embodiment, because there is a notify monitoring mechanism of the etcd, the detected key is/dns/domain/content (stored in the etcd), and if the content in the etcd is found to be changed (which may be changed through an http interface, or may be changed directly through modifying the content in the etcd database, or may be automatically updated through the master after load balancing), the dns content is dynamically updated after the change.
In one exemplary embodiment, determining a target slave node from the plurality of slave nodes based on the node information comprises: determining the load capacity and the processor occupation capacity of the slave nodes included in the node information; determining a score for each of the slave nodes based on the amount of load and the amount of processor occupancy; determining the slave node with the highest score as the target slave node. In this embodiment, the master node may determine a score of each slave node according to a load amount of each slave node and an occupancy amount of the processor included in the node information, and determine a target slave node from the slave node with the highest score. When the score is determined, the load amount and the weight of the object occupied by the processor can be determined, and the load amount and the weight of the object occupied by the processor are weighted and summed to obtain a final score.
In the above embodiment, the master node master may periodically acquire the balance information, and acquire the node information of all the slave nodes. And a load balancing algorithm can be performed according to the balance information. Or determining the cpu load, i.e. the processor occupation amount, the number of connections, i.e. the load amount, etc., of each slave node according to the node information of each slave node, and balancing according to the cpu load and/or the number of connections, so that information of all nodes needs to be acquired to select the optimal node. And after the CPU of each node is compared and the number of connections is counted, directly modifying the ip corresponding to the domain name in the key of the dns/domain, and dynamically updating the zone data, thereby realizing load balance.
In the above embodiment, if the etcd changes (may be changed through an http interface, or may be changed by directly modifying the content in the etcd database, or is automatically updated by a master after load balancing), all DNS-balance passive (this is an etcd passive mechanism and may monitor changes of all keys), and then update the name of the node (BIND is an implementation of the DNS protocol, where name is a DNS service, and we modify zone are really for modifying the mapping relationship between domain name and ip, and zone data synchronization is for ensuring that DNS data of each node are consistent). The flowchart of the specific load balancing method can be seen in fig. 3.
In the embodiment, the dns content is updated and monitored in real time, so that load balance is realized, the setting of the domain name of the http interface is realized, convenience and rapidness are realized, the change setting is automatically monitored, and the access pressure of the rgw single node is reduced.
In one exemplary embodiment, the method further comprises: under the condition that high available resources are operated in a second node, the second node detects a target state of an object storage service which is deployed in the second node in advance; and under the condition that the target state is abnormal, the second node moves the high available resource to a tendency node for operation, wherein the tendency node is a node which is set for the second node in advance. In this embodiment, the placemaker resource manager may be used to manage rgw (object store) services and highly available ip, and add ocf: named: rgw resource types for monitoring the rgw service status on the node. The nodes creating the rgw service are added with node attributes (the node attributes are mainly used for restricting the placemaker to only run in the object storage node, and the node attributes stored in the object storage node are true) for restricting the activity range of the monitoring service. vip (high available ip) resource dependent nodes and rgw service state are healthy, and when the state of a node and/or rgw service is abnormal, the node drifts to a healthy node, namely an inclined node. Tendency nodes can be set for each vip to disperse vip resources (a healthy node indicates that the object storage of the node is normal, if the object storage service of the node is abnormal, the node involves that high available ip drifts to another healthy node, if the tendency score of a certain node is higher, the node preferentially drifts to the node, and the node is a tendency node, namely, when the rgw service is not healthy, the resource drift is involved). The method comprises the steps that a placemaker is used as a resource manager of high-availability HA of a linux system, is positioned in resource management of an HA cluster architecture and does not provide a bottom-layer heartbeat information transfer function, the placemaker management resource is executed in a script mode, the management of a certain service can be processed through script languages such as shell and python, and when the same service is started on a plurality of nodes, if a single-point fault occurs on a certain node of the certain service, the placemaker can discover that the service is unavailable on the node through a resource management script.
In the above embodiment, a high-availability resource may be added in the second node, the high-availability resource may be created by a command, the high-availability ip and the corresponding portal and mask information are set, and the monitoring time is set, for example, every 20 s. And setting a position operation score of the high available resources, and setting a tendency node for the high available ip, wherein the higher score is, the higher the available ip at the moment can be more easily drifted to the corresponding node. Creating a resource bundle, which can bundle the monitor resource rgw-monitor with the highly available resource radosgw _ ocf _ vip _ { ip }, where these two resources will always run in the same node. When the high available ip is not used, the high available resource can be directly deleted.
In the above embodiment, rgw high-available ip setting can be realized, external uninterrupted service provided by a business program of a user is protected, and the influence of a fault caused by software and human is reduced to the minimum degree.
In one exemplary embodiment, moving the highly available resource to run in the trending node comprises: determining a running score of each tendency node under the condition that the tendency nodes are multiple; and moving the high available resources to the tendency node with the highest operation score for operation. In this embodiment, when there are multiple tendency nodes, that is, there are multiple high-available ips, a running score may be set for each high-available ip, and when it is necessary to move a high-available resource, the high-available resource is moved to a tendency node with the highest running score to run. The schematic diagram of the moving structure of the high available resources can be seen in fig. 4.
In one exemplary embodiment, before the second node detects a target state of a pre-deployed object storage service in the second node, the method further comprises: the second node adds the node attribute of the second node in a pre-deployed resource manager under the condition that an adding instruction is received by the second node so as to add the object storage service in the second node; the second node determines whether an object storage monitoring resource is created in the cluster where the second node is located or not when receiving the detection instruction, creates the object storage monitoring resource in the cluster where the second node is located when the object storage monitoring resource is not created, and creates a high-availability address in the second node when the object storage monitoring resource is created. In this embodiment, a placemaker service, that is, a resource manager, may be deployed on each node on the server through the received add instruction, and it is ensured that the service state is normal. When an object storage service of a certain node needs to be added (creating rgw object storage service is used for providing services, based on a mechanism of a pacemaker, after a new service is created, the node needs to be added into monitoring resources to enable subsequent high-availability ip to drift to a correct node, and after the corresponding object storage service is removed, the node attribute is deleted to indicate that the high-availability ip does not need to drift to the node). See if the corresponding cluster created the object storage monitoring resource rgw-monitor (created to constrain the object storage service to run only on the object storage service node), if not, create the resource and add the constraint (create resource type can be clone resource, can clone resource, so that the resource is activated on multiple nodes, and the run location is still limited on the nodes of rgw = true). When the object storage service of a certain node needs to be deleted, the node attribute of the corresponding node is deleted, the node attribute is deleted by the target node, the high available ip cannot float to the node at the moment, and when the rgw cluster is cleaned, the monitoring resource can be deleted and the constraint can be deleted.
In one exemplary embodiment, the method further comprises: performing cross-domain processing on a target domain name in a target server in the following way: the target server runs a target script, wherein the target script comprises a specific domain name matched with the target domain name; determining a cross-domain name included in the specific domain name; and adding target header information in the cross-domain name. In this embodiment, the cross-domain control of a specific domain name and the function of separating the traffic of the internal network and the external network can be realized through nginx + lua. The specific domain name can be matched through the received pre-written lua script, and the specific header is added to the domain name needing cross-domain to realize cross-domain name matching. Among them, lua is a lightweight and small scripting language designed for embedding in applications to provide flexible extension and customization functions for the applications.
In the above embodiment, in the nginx server, when it is necessary to perform allowable cross-domain for a certain domain name, without being limited to a cross-domain rule of the rgw bucket, the cross-domain configuration of the rgw bucket is to provide a method for a client web application in one domain to interact with resources in different domains, so that when domain names in different domains want to access to the rgw resources, it is necessary to perform cross-domain setting on the bucket, and the principle of cross-domain is to detect whether there is a header, which is AllowedOrigin, in the returned header, so that it is possible to implement cross-domain for a specific domain name by adding the required cross-domain header when returning a request by using lua.
Com, when the access source is www.test.com, the relevant cross-domain setting is added in the returned header. When the separation of the internal and external network traffic of the service is needed, the scheme can still be used, at present, the internal and external network traffic is not distinguished by the rgw domain name, and at the moment, if the internal and external network traffic is to be distinguished, only a request inner _ hostpeader mark needs to be set in the lua script, and then different code requirements are realized in the rgw code.
In the above embodiment, the domain name specific control processing flow can realize the functions of domain name selective cross-domain, internal and external network traffic separation, and the like.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a load balancing apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a load balancing apparatus according to an embodiment of the present invention, as shown in fig. 5, the apparatus including:
a monitoring module 52, configured to monitor target domain name system contents stored in a data storage system of a target cluster, where the target domain name system contents include sub domain name system contents corresponding to each slave node, respectively, and the sub domain name system contents include a correspondence between a domain name and a network address of the slave node;
an obtaining module 54, configured to obtain node information of each slave node;
a determining module 56, configured to determine a target slave node from the plurality of slave nodes based on the node information;
a balancing module 58, configured to modify a network address corresponding to a domain name included in the content of the target domain name system into a target address of the target slave node, so as to balance the load of the target cluster.
In an exemplary embodiment, the obtaining module 54 may obtain the node information of each slave node by: under the condition that the content of the target domain name system changes, the node information of each slave node is obtained; wherein the target domain name system content changing comprises: the slave node monitors sub domain name system content corresponding to the slave node based on the load balancing service under the condition that the slave node is determined to be deployed with the load balancing service, inquires local domain name system content locally stored by the slave node, compares the local domain name system content with the sub domain name system content to obtain a comparison result, and changes the sub domain name system content into the local domain name system content under the condition that the comparison result indicates that the local domain name system content is different from the sub domain name system content.
In an exemplary embodiment, determining module 56 may determine the target slave node from the plurality of slave nodes based on the node information by: determining the load capacity and the processor occupation capacity of the slave nodes included in the node information; determining a score for each of the slave nodes based on the amount of load and the amount of processor occupancy; determining the slave node with the highest score as the target slave node.
In an exemplary embodiment, the apparatus may be further configured to, in a case where a high available resource is running in a second node, the second node detect a target state of a pre-deployed object storage service in the second node; and under the condition that the target state is abnormal, the second node moves the high available resource to a tendency node for operation, wherein the tendency node is a node which is set for the second node in advance.
In an exemplary embodiment, the second node may move the high available resource to the trending node to operate by: determining a running score of each tendency node under the condition that the tendency nodes are multiple; and moving the high available resources to the tendency node with the highest operation score for operation.
In an exemplary embodiment, before a second node detects a target state of a pre-deployed object storage service in the second node, upon receiving an add instruction, adds a node attribute of the second node in a pre-deployed resource manager to add the object storage service in the second node; the second node determines whether an object storage monitoring resource is created in the cluster where the second node is located or not when receiving the detection instruction, creates the object storage monitoring resource in the cluster where the second node is located when the object storage monitoring resource is not created, and creates a high-availability address in the second node when the object storage monitoring resource is created.
In one exemplary embodiment, cross-domain processing is performed on a target domain name in a target server by: the target server runs a target script, wherein the target script comprises a specific domain name matched with the target domain name; determining a cross-domain name included in the specific domain name; and adding target header information in the cross-domain name.
It should be noted that the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented in a general purpose computing device, they may be centralized in a single computing device or distributed across a network of multiple computing devices, and they may be implemented in program code that is executable by a computing device, such that they may be stored in a memory device and executed by a computing device, and in some cases, the steps shown or described may be executed in an order different from that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps therein may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims (10)

1. A method of load balancing, comprising:
monitoring target domain name system contents stored in a data storage system of a target cluster, wherein the target domain name system contents comprise sub-domain name system contents respectively corresponding to each slave node, and the sub-domain name system contents comprise a corresponding relation between a domain name and a network address of the slave node;
acquiring node information of each slave node;
determining a target slave node from the plurality of slave nodes based on the node information;
and modifying the network address corresponding to the domain name included in the target domain name system content into the target address of the target slave node so as to balance the load of the target cluster.
2. The method of claim 1, wherein obtaining node information for each of the slave nodes comprises:
under the condition that the content of the target domain name system changes, acquiring the node information of each slave node;
wherein the target domain name system content changing comprises: the method comprises the steps that when the slave node determines that a load balancing service is deployed in the slave node, the slave node monitors sub domain name system content corresponding to the slave node based on the load balancing service, inquires local domain name system content locally stored in the slave node, compares the local domain name system content with the sub domain name system content to obtain a comparison result, and changes the sub domain name system content into the local domain name system content when the comparison result indicates that the local domain name system content is different from the sub domain name system content.
3. The method of claim 1, wherein determining a target slave node from the plurality of slave nodes based on the node information comprises:
determining the load capacity and the processor occupancy of the slave nodes included in the node information;
determining a score for each of the slave nodes based on the amount of load and the amount of processor occupancy;
determining the slave node with the highest score as the target slave node.
4. The method of claim 1, further comprising:
under the condition that high available resources are operated in a second node, the second node detects a target state of an object storage service which is deployed in the second node in advance;
and under the condition that the target state is abnormal, the second node moves the high available resource to a tendency node for operation, wherein the tendency node is a node which is set for the second node in advance.
5. The method of claim 4, wherein moving the highly available resources to run in a trending node comprises:
determining a running score of each tendency node under the condition that the tendency nodes are multiple;
and moving the high available resources to the tendency node with the highest operation score for operation.
6. The method of claim 4, wherein before the second node detects the target state of the pre-deployed object storage service in the second node, the method further comprises:
the second node adds the node attribute of the second node in a pre-deployed resource manager under the condition that an adding instruction is received by the second node so as to add the object storage service in the second node;
the second node determines whether an object storage monitoring resource is created in the cluster where the second node is located or not when receiving the detection instruction, creates the object storage monitoring resource in the cluster where the second node is located when the object storage monitoring resource is not created, and creates a high-availability address in the second node when the object storage monitoring resource is created.
7. The method of claim 1, further comprising:
performing cross-domain processing on a target domain name in a target server in the following way:
the target server runs a target script, wherein the target script comprises a specific domain name matched with the target domain name;
determining a cross-domain name included in the specific domain name;
and adding target header information in the cross-domain name.
8. An apparatus for load balancing, comprising:
the system comprises a monitoring module, a data storage module and a data processing module, wherein the monitoring module is used for monitoring target domain name system contents stored in a data storage system of a target cluster, the target domain name system contents comprise sub domain name system contents respectively corresponding to each slave node, and the sub domain name system contents comprise the corresponding relation between a domain name and a network address of the slave node;
an obtaining module, configured to obtain node information of each slave node;
a determining module for determining a target slave node from the plurality of slave nodes based on the node information;
and the balancing module is used for modifying the network address corresponding to the domain name included in the target domain name system content into the target address of the target slave node so as to balance the load of the target cluster.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 7.
CN202211697627.8A 2022-12-28 2022-12-28 Load balancing method and device, storage medium and electronic device Pending CN115967718A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211697627.8A CN115967718A (en) 2022-12-28 2022-12-28 Load balancing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211697627.8A CN115967718A (en) 2022-12-28 2022-12-28 Load balancing method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115967718A true CN115967718A (en) 2023-04-14

Family

ID=87359710

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211697627.8A Pending CN115967718A (en) 2022-12-28 2022-12-28 Load balancing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115967718A (en)

Similar Documents

Publication Publication Date Title
CN109618005B (en) Method for calling server and proxy server
CN109032755B (en) Container service hosting system and method for providing container service
CN112532675B (en) Method, device and medium for establishing network edge computing system
CN107172214B (en) Service node discovery method and device with load balancing function
WO2015078498A1 (en) Method and system for balancing load in a sdn network
US9847903B2 (en) Method and apparatus for configuring a communication system
CN106790131B (en) Parameter modification method and device and distributed platform
US9390156B2 (en) Distributed directory environment using clustered LDAP servers
EP3574674B1 (en) A network monitoring entity, method, system and computer program for a communication network implementing network slices
CN109074288A (en) Conflict solving in network virtualization scene
US7966394B1 (en) Information model registry and brokering in virtualized environments
CN111345008A (en) Mobile edge host service notification method and device
US20040143654A1 (en) Node location management in a distributed computer system
CN109474700B (en) Access method of iSCSI client, storage medium, client and storage node
CN112685287B (en) Product data testing method and device, storage medium and electronic device
KR102260781B1 (en) Integration System of Named Data Networking-based Edge Cloud Computing for Internet of Things
US20040193702A1 (en) System and method of network content location for roaming clients
CN108737591A (en) A kind of method and device of service configuration
CN113079098B (en) Method, device, equipment and computer readable medium for updating route
CN115190103A (en) Service grid-based service domain name resolution method, device and equipment
JP2016144186A (en) Communication information controller, relay system, communication information control method, and communication information control program
CN116708266A (en) Cloud service topological graph real-time updating method, device, equipment and medium
CN109067564B (en) Distributed approach, device, computer equipment and storage medium
CN115967718A (en) Load balancing method and device, storage medium and electronic device
US20040199643A1 (en) Distributed service component systems

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