CN117251285A - Dynamic loading method, device, equipment and storage medium of configuration information - Google Patents

Dynamic loading method, device, equipment and storage medium of configuration information Download PDF

Info

Publication number
CN117251285A
CN117251285A CN202311250542.XA CN202311250542A CN117251285A CN 117251285 A CN117251285 A CN 117251285A CN 202311250542 A CN202311250542 A CN 202311250542A CN 117251285 A CN117251285 A CN 117251285A
Authority
CN
China
Prior art keywords
configuration information
configuration
target component
updated
update
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
CN202311250542.XA
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.)
Zhongke Shuguang International Information Industry Co ltd
Original Assignee
Zhongke Shuguang International Information Industry 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 Zhongke Shuguang International Information Industry Co ltd filed Critical Zhongke Shuguang International Information Industry Co ltd
Priority to CN202311250542.XA priority Critical patent/CN117251285A/en
Publication of CN117251285A publication Critical patent/CN117251285A/en
Pending legal-status Critical Current

Links

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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of computers, and discloses a dynamic loading method, a device, equipment and a storage medium of configuration information. The method comprises the following steps: when the updating configuration information is received, a target component corresponding to the updating configuration information is obtained; if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database; when the configuration change message is successfully monitored in the target channel, the update configuration information is read from a preset database, and the update configuration information is reloaded through the target component, so that the configuration update of the target component is realized. According to the technical scheme, the configuration information is stored for a long time by adopting the preset database, and configuration receiving and configuration issuing are decoupled in operation, so that dynamic loading of the configuration information of the load equalizer can be realized, the loss of the configuration information caused by memory failure can be avoided, and concurrent operation of configuration updating can be supported.

Description

Dynamic loading method, device, equipment and storage medium of configuration information
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for dynamically loading configuration information.
Background
With the continuous expansion of the internet application scale, multiple servers need to be grouped together to provide business services. In a server cluster, in order to increase service response speed, a load balancing technology is generally adopted to distribute service traffic to each server. When there is a sudden increase or a sudden decrease in the traffic flow, it is generally necessary to temporarily perform an operation of expanding or shrinking the service instance number, and at this time, it is necessary to dynamically configure the load balancer while ensuring that the traffic is not interrupted.
At present, the existing dynamic configuration method of the load balancer generally adopts a new ngx _http_dyups_module module added in the load balancer, so that configuration information is dynamically added through a related application programming interface, and the configuration can be actively pushed to the load balancer to realize configuration updating. However, in the prior art, the configuration information is stored in an internal cache of the worker process in the load balancer, and all the configuration information is lost when the memory information fails; second, when there are multiple worker processes that are concurrently performing configuration update, a situation may occur in which a part of the processes fails to update.
Disclosure of Invention
The invention provides a dynamic loading method, a device, equipment and a storage medium of configuration information, which can realize dynamic loading of the configuration information of a load equalizer, realize long-term storage of the configuration information, avoid the loss of the configuration information caused by memory failure and support concurrent operation of configuration update.
According to an aspect of the present invention, there is provided a dynamic loading method of configuration information, applied to a load balancing server, including:
when receiving update configuration information, acquiring a target component corresponding to the update configuration information;
if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database;
and when the configuration change message is successfully monitored in the target channel, reading the updated configuration information from the preset database, and reloading the updated configuration information through the target component so as to realize the configuration update of the target component.
Optionally, the updating the configuration information successfully passes the conflict verification, including:
and reading the current configuration information corresponding to the target component from the preset database, and if the preset conflict detection condition is not met between the updated configuration information and the current configuration information, determining that the updated configuration information passes the conflict verification successfully.
By adopting the technical scheme, the configuration information can be checked in advance, and system errors caused by configuration information conflict setting are avoided.
Optionally, writing the updated configuration information into a preset database includes:
judging whether the updated configuration information is the same as the current configuration information;
if not, replacing and storing the current configuration information in the preset database by adopting the updated configuration information.
By adopting the technical scheme, repeated setting of the same configuration information can be avoided, and invalid updating of the configuration information can be avoided.
Optionally, reloading the updated configuration information through the target component to implement configuration update of the target component includes:
generating an update configuration file according to the update configuration information and a preset file generation rule, and reloading the update configuration file through the target component to realize configuration update of the target component.
By adopting the technical scheme, the configuration file corresponding to the updated configuration information can be automatically generated, and the dynamic loading efficiency of the configuration information can be improved.
Optionally, reloading the update configuration file through the target component to implement configuration update of the target component includes:
Acquiring a configuration file path corresponding to the target component;
replacing a current configuration file corresponding to the current configuration information with the updated configuration file under the configuration file path;
and reloading the updated configuration file under the configuration file path through the target component to realize configuration updating of the target component.
By adopting the technical scheme, the automatic replacement and loading of the configuration file can be realized, and the dynamic loading efficiency of the configuration information can be further improved.
Optionally, the target component includes a load balancer and/or a keep-alive module.
By adopting the technical scheme, the dynamic loading of the configuration information of different components in the load balancing server can be realized, and the application range of the dynamic loading of the configuration information can be enlarged.
Optionally, after reloading the updated configuration information by the keep-alive module to implement configuration update of the keep-alive module, the method further includes:
detecting the running state of a current load equalizer through a current keep-alive module;
if the running state of the current load balancer is detected to be abnormal, the current load balancer is closed, and a preset virtual internet protocol address is distributed to the standby load balancer of the standby load balancing server, so that high availability of load balancing is ensured.
By adopting the technical scheme, the high availability of the load balancing function of the load balancing server can be ensured, and the system stability can be improved.
According to another aspect of the present invention, there is provided a dynamic loading device of configuration information, applied to a load balancing server, including:
the configuration information receiving module is used for acquiring a target component corresponding to the updated configuration information when the updated configuration information is received;
the configuration information storage module is used for writing the updated configuration information into a preset database if the updated configuration information passes the conflict verification successfully, and issuing a configuration change message on a target channel of the preset database;
and the configuration information reloading module is used for reading the updated configuration information from the preset database when the configuration change message is successfully monitored in the target channel, and reloading the updated configuration information through the target component so as to realize the configuration updating of the target component.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method for dynamically loading configuration information according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement a method for dynamically loading configuration information according to any embodiment of the present invention when executed.
According to the technical scheme, when the updated configuration information is received, the target component corresponding to the updated configuration information is obtained; if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database; when the configuration change message is successfully monitored in the target channel, reading updated configuration information from a preset database, and reloading the updated configuration information through the target component to realize the configuration update of the target component; by adopting a preset database to store configuration information for a long time and decoupling configuration receiving and configuration issuing operations, dynamic loading of the configuration information of the load equalizer can be realized, the loss of the configuration information caused by memory failure can be avoided, and concurrent operation of configuration updating can be supported.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1A is a flow chart of a method for dynamically loading configuration information according to a first embodiment of the present invention;
fig. 1B is a schematic structural diagram of a load balancing system according to a first embodiment of the present invention;
FIG. 2A is a flow chart of a method for dynamically loading configuration information according to a second embodiment of the present invention;
FIG. 2B is a flowchart of another method for dynamically loading configuration information according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a dynamic loading device for configuration information according to a third embodiment of the present invention;
Fig. 4 is a schematic structural diagram of an electronic device implementing a method for dynamically loading configuration information according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," "target," and the like in the description and claims of the present invention and in the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1A is a flowchart of a dynamic loading method of configuration information according to an embodiment of the present invention, where the embodiment is applicable to a case of dynamically updating configuration information of each component in a load balancing server, and the method may be performed by a dynamic loading device of configuration information, where the dynamic loading device of configuration information may be implemented in a form of hardware and/or software, and the dynamic loading device of configuration information may be configured in an electronic device, and typically, the electronic device may be a load balancing server. As shown in fig. 1A, the method includes:
s110, when the updating configuration information is received, a target component corresponding to the updating configuration information is obtained.
In this embodiment, the update configuration information issued by the software defined network controller (Software Defined Network Controller, SDNC) may be received by a pre-deployed configuration information receiving module, such as an application program interface (Application Programming Interface, API).
When the SDNC issues the update configuration information to the load balancing server, the SDNC may issue corresponding update configuration information for different components respectively; further, corresponding update configuration information can be issued for different functional modules of the component. In the present embodiment, the data structure of updating the configuration information may not be particularly limited.
The target component may include a load balancer nminx and/or a keep-alive module keep-alive, among others. The load balancer can comprise a monitor, a health check module, a certificate module, a back-end server group module, a back-end server module, a forwarding rule module and other functional modules.
In a specific example, after the update configuration information is received through the API interface, content analysis may be performed on the update configuration information based on a preset communication protocol, and a component identifier corresponding to the current update configuration information may be obtained from a content analysis result, so as to determine the target component.
And S120, if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database.
Specifically, after the updated configuration information is successfully received, whether the new configuration corresponding to the updated configuration information conflicts with the original configuration or not may be determined based on a preset conflict detection rule, for example, whether there is repeated allocation of an interface, the configuration buffer exceeds the maximum buffer, and so on. If no conflict exists, the current update configuration information is determined to pass the conflict verification successfully, and the update configuration information can be stored in a preset database. If the conflict is detected, the updated configuration information can be directly discarded, and an abnormal alarm is carried out.
The preset database may be a key value type database, for example, a dis database. In this embodiment, when the updated configuration information is written into the preset database, the updated configuration information may be used to replace and store the current configuration information corresponding to the target component; alternatively, the updated configuration information and the current configuration information may be simultaneously maintained, and different version identifiers may be used to distinguish the updated configuration information from the current configuration information.
Specifically, when the updated configuration information is stored, a mapping relationship between the component identifier corresponding to the target component and the updated configuration information may be established, and the mapping relationship is stored in a preset database. Secondly, the preset database can also support searching of matching configuration information based on the component identification.
Further, after the storing of the updated configuration information is successfully completed, the preset database may send configuration change information to the target channel based on the subscription and publishing function, so as to notify the subscriber of the channel that the configuration information of the target component has been changed. The configuration change information may include a component identifier, an information change identifier, and the like. In this embodiment, the target channel of the Redis database may be subscribed in advance by the configuration information receiving module, and the channel message may be monitored in real time by a preset dedicated process.
S130, when the configuration change message is successfully monitored in the target channel, reading the updated configuration information from the preset database, and reloading the updated configuration information through the target component to realize configuration updating of the target component.
Specifically, when the configuration information receiving module monitors the configuration change message corresponding to the target component in the target channel, the updated configuration information can be read from the preset database based on the component identifier corresponding to the target component. Then, the updated configuration information can be automatically loaded through a preset configuration loading script program in the target component, and corresponding configuration change is carried out, so that the configuration update of the target component is realized; alternatively, the configuration update may be implemented by first generating an update configuration file from the update configuration information and automatically loading the update configuration file.
In this embodiment, by adopting the configuration information receiving module to receive, write and read the configuration information and adopting the subscription and publishing functions of the preset database, the operation decoupling of configuration receiving and configuration issuing is successfully realized, so that when a plurality of worker processes are present to update the configuration, each process can successfully acquire updated configuration information, and the consistency of each process can be ensured.
According to the technical scheme, when the updated configuration information is received, the target component corresponding to the updated configuration information is obtained; if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database; when the configuration change message is successfully monitored in the target channel, reading updated configuration information from a preset database, and reloading the updated configuration information through the target component to realize the configuration update of the target component; by adopting a preset database to store configuration information for a long time and decoupling configuration receiving and configuration issuing operations, dynamic loading of the configuration information of the load equalizer can be realized, the loss of the configuration information caused by memory failure can be avoided, and concurrent operation of configuration updating can be supported.
In an optional implementation manner of this embodiment, the updating the configuration information successfully passes the conflict verification may include:
and reading the current configuration information corresponding to the target component from the preset database, and if the preset conflict detection condition is not met between the updated configuration information and the current configuration information, determining that the updated configuration information passes the conflict verification successfully.
The current configuration information may be configuration information currently used by the target component. The preset conflict detection condition may be preset condition information for judging whether there is a configuration conflict between the two configuration information, for example, at least one preset conflict rule may be satisfied between the updated configuration information and the current configuration information.
In this embodiment, when performing conflict verification, the current configuration information corresponding to the target component may be read from a preset database according to the component identifier corresponding to the target component; then, whether the preset conflict detection condition is met between the updated configuration information and the current configuration information is judged. If the preset conflict detection condition is detected to be met, the existence of configuration conflict can be determined, and the updated configuration information can be directly discarded. If the detection result does not meet the preset conflict detection condition, the success of the conflict verification can be determined, and the updated configuration information can be further stored in a preset database.
In another optional implementation manner of this embodiment, writing the update configuration information into a preset database may include:
judging whether the updated configuration information is the same as the current configuration information;
If not, replacing and storing the current configuration information in the preset database by adopting the updated configuration information.
Specifically, when the updated configuration information is stored in the preset database, the updated configuration information and the current configuration information may be compared item by item, so as to determine whether the updated configuration information and the current configuration information are the same. When the content of the update configuration information and the content of the update configuration information are detected to be identical, the exception of the update configuration information currently issued by the SDNC can be determined, the update configuration information can be selected to be directly discarded, the original current configuration information is still reserved, and subsequent configuration information reloading operation is not needed. When the two contents are detected to be different, the current configuration information can be deleted from the preset database, and the updated configuration information is stored to the position of the current configuration information, so that the replacement storage of the current configuration information is realized.
In another optional implementation manner of this embodiment, after reloading the update configuration information by the keep-alive module to implement configuration update of the keep-alive module, the method may further include:
detecting the running state of a current load equalizer through a current keep-alive module;
if the running state of the current load balancer is detected to be abnormal, the current load balancer is closed, and a preset virtual internet protocol address is distributed to the standby load balancer of the standby load balancing server, so that high availability of load balancing is ensured.
In a specific example, the structure of the load balancing system to which the dynamic loading method of configuration information is applied may be as shown in fig. 1B. The load balancing system may be composed of a main load balancing server 01 (main node) and a standby load balancing server 02 (standby node), each load balancing server includes an information receiving module Agent, a Redis database, a load balancing nminx and a keep-alive module keepalive, and communication connection exists between the keep-alive modules in different load balancing servers.
The Agent is configured to provide a related Rest API interface, to receive configuration information issued by the SDNC, and store the configuration information to the Redis database after checking the configuration information is completed, and when a configuration change message is monitored from a subscribed Redis channel, read the configuration information from the Redis database, and send the configuration information to the nginnx or keepalive. The Redis database is used for supporting writing and reading of configuration information, and after successful storage, configuration change information is sent to a designated channel based on subscription and release functions.
The nmginx is used to reload configuration information to complete configuration updates and to provide load balancing among hosts based on the configuration information. Keepalive is used to provide high availability for nminix. Specifically, keepalive can detect the running state of the corresponding nmginx in real time by periodically sending a heartbeat command or the like. Each ng inx has the same configuration information and can synchronously perform configuration update.
In a load balancing system, each Nginx shares a preset virtual internet protocol address (Virtual Internet Protocol, VIP), and service requests can be allocated to the appropriate Nginx by allocating VIP. Under normal conditions, the virtual internet protocol address is used by the nmginx of the master node, and when the nmginx of the master node is abnormal, for example, is down, has no reply to a heartbeat instruction, and the like, the keep alive drifts the VIP to the standby node, at the moment, the nmginx of the standby node uses the VIP to continue to provide services for users, the users have no perception in the process, and the service is not interrupted, so that the high availability of the load balancing service is ensured.
Example two
Fig. 2A is a flowchart of a dynamic loading method of configuration information according to a second embodiment of the present invention, where the technical solution in this embodiment may be combined with one or more of the foregoing embodiments. As shown in fig. 2A, the method includes:
s210, when update configuration information is received, a target component corresponding to the update configuration information is obtained.
S220, reading current configuration information corresponding to the target component from a preset database, and if the preset conflict detection condition is not met between the updated configuration information and the current configuration information, determining that the updated configuration information passes the conflict verification successfully.
And S230, if the updated configuration information is determined to be different from the current configuration information, replacing and storing the current configuration information by adopting the updated configuration information in the preset database, and issuing a configuration change message on a target channel of the preset database.
S240, when the configuration change message is successfully monitored in the target channel, the updated configuration information is read from the preset database.
S250, generating an update configuration file according to the update configuration information and a preset file generation rule, and reloading the update configuration file through the target component to realize configuration update of the target component.
The preset file generation rule may be a grammar rule of a preset configuration file, for example, the configuration file is composed of instructions and instruction blocks, each instruction ends with a semicolon, and the space between the instructions and the parameters is divided by space symbols. Optionally, for different types of components, a general file generation rule may be preset, or a file generation rule corresponding to each may be preset, for example, a preset nminix file generation rule, a preset keepalive file generation rule, and the like.
In this embodiment, after the configuration information receiving module reads the update configuration information from the preset database, the configuration information receiving module may convert the current update configuration information into a corresponding update configuration file according to a preset file generation rule. Then, a preset configuration loading script program in the target component can be executed to directly perform configuration updating according to the updating configuration file; or, the update configuration file may be stored under the configuration file directory of the target component, and a preset script is executed to automatically read the update configuration file, and change the configuration information according to the update configuration file.
Optionally, generating the update configuration file according to the update configuration information and the preset file generation rule may include: and acquiring a target file generation rule corresponding to the target component, and generating an update configuration file corresponding to the target component according to the update configuration information and the target file generation rule.
In the embodiment, by performing persistent storage on the configuration information and decoupling configuration receiving and issuing operations, flexible configuration on the Nginx configuration information is realized, complicated operation and maintenance operations are avoided, and the Nginx configuration information can continue to work according to the original configuration parameters even if the Nginx is down and restarted; secondly, the user-unaware configuration issuing is realized, the dynamic loading of configuration information can be realized without restarting by Nginx, and the continuity of load balancing service is ensured.
According to the technical scheme, if the preset conflict detection condition is not met between the updated configuration information and the current configuration information, the updated configuration information is determined to pass the conflict verification successfully; if the updated configuration information is determined to be different from the current configuration information, replacing and storing the current configuration information by adopting the updated configuration information in a preset database; secondly, after the update configuration information is read from a preset database, generating an update configuration file according to the update configuration information and a preset file generation rule, and reloading the update configuration file through a target component to realize configuration update of the target component; by carrying out conflict check and same check on the updated configuration information in advance, system errors caused by configuration information conflict setting can be avoided, and invalid update of the configuration information can be avoided; in addition, by generating the update configuration file corresponding to the update configuration information, the update configuration information can be locally stored, when the target component is restarted due to failure, the updated configuration information can be directly loaded from the local, and the configuration loading efficiency of the component during restarting can be improved.
In an optional implementation manner of this embodiment, reloading the update configuration file through the target component to implement configuration update of the target component may include:
Acquiring a configuration file path corresponding to the target component;
replacing a current configuration file corresponding to the current configuration information with the updated configuration file under the configuration file path;
and reloading the updated configuration file under the configuration file path through the target component to realize configuration updating of the target component.
The configuration file path can be an access path matched with the configuration file corresponding to the target component; in this embodiment, according to the installation position of the target component in the load balancing server, the corresponding configuration file path of the target component may be automatically determined, for example, a file path corresponding to a file with a preset file name under the installation folder; or after the installation of the target component is completed, the corresponding configuration file path can be stored in a preset database, so that the configuration file path corresponding to the target component can be searched and obtained from the preset database according to the component identifier corresponding to the target component.
In a specific example, after determining the configuration file path corresponding to the target component, the original current configuration file in the configuration file path may be deleted, and the update configuration file may be stored in the configuration file path, so as to implement replacement and update of the configuration file. Finally, a preset configuration loading script program in the target component can be executed to automatically read the update configuration file under the path, thereby realizing configuration update of the target component.
In a specific implementation manner of this embodiment, a flow of a dynamic loading method of configuration information may be shown in fig. 2B. Firstly, receiving update configuration information issued by SDNC through Agent, and performing configuration conflict verification on the update configuration information; when the updated configuration information is detected to pass the configuration conflict verification, the updated configuration information is stored in a Redis database, and a configuration change message is issued to a preset channel by the Redis database.
Then, when the Agent successfully monitors the configuration change message in the channel, the Agent can read the updated configuration information from the Redis database and determine the component corresponding to the updated configuration information. When the component is Nginx, generating an Nginx configuration file according to the updated configuration information and a file generation rule corresponding to the Nginx; or when the component is determined to be keepalive, the keepalive configuration file can be generated according to the updated configuration information and the file generation rule corresponding to the keepalive.
Finally, a preset configuration file loading script can be executed to reload the nmginx configuration file or the keepalive configuration file generated by the reload, so as to realize the dynamic loading of the configuration information.
Example III
Fig. 3 is a schematic structural diagram of a dynamic loading device for configuration information according to a third embodiment of the present invention. As shown in fig. 3, the apparatus applied to the load balancing server may include: a configuration information receiving module 310, a configuration information storage module 320, and a configuration information reloading module 330; wherein,
a configuration information receiving module 310, configured to obtain a target component corresponding to updated configuration information when the updated configuration information is received;
the configuration information storage module 320 is configured to write the updated configuration information into a preset database and issue a configuration change message on a target channel of the preset database if the updated configuration information successfully passes the conflict verification;
and a configuration information reloading module 330, configured to, when the configuration change message is successfully monitored in the target channel, read the updated configuration information from the preset database, and reload the updated configuration information through the target component, so as to implement configuration update of the target component.
According to the technical scheme, when the updated configuration information is received, the target component corresponding to the updated configuration information is obtained; if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database; when the configuration change message is successfully monitored in the target channel, reading updated configuration information from a preset database, and reloading the updated configuration information through the target component to realize the configuration update of the target component; by adopting a preset database to store configuration information for a long time and decoupling configuration receiving and configuration issuing operations, dynamic loading of the configuration information of the load equalizer can be realized, the loss of the configuration information caused by memory failure can be avoided, and concurrent operation of configuration updating can be supported.
Optionally, the configuration information storage module 320 is specifically configured to read current configuration information corresponding to the target component from the preset database, and determine that the updated configuration information successfully passes the conflict check if a preset conflict detection condition is not satisfied between the updated configuration information and the current configuration information.
Optionally, the configuration information storage module 320 is specifically configured to determine whether the updated configuration information is the same as the current configuration information;
if not, replacing and storing the current configuration information in the preset database by adopting the updated configuration information.
Optionally, the configuration information reloading module 330 is specifically configured to generate an update configuration file according to the update configuration information and a preset file generating rule, and reload the update configuration file through the target component to implement configuration update of the target component.
Optionally, the configuration information reloading module 330 is specifically configured to obtain a configuration file path corresponding to the target component;
replacing a current configuration file corresponding to the current configuration information with the updated configuration file under the configuration file path;
And reloading the updated configuration file under the configuration file path through the target component to realize configuration updating of the target component.
Optionally, the target component includes a load balancer and/or a keep-alive module.
Optionally, the dynamic loading device of the configuration information further includes:
the running state detection module is used for detecting the running state of the current load equalizer through the current keep-alive module;
and the address allocation module is used for closing the current load balancer and allocating a preset virtual internet protocol address to the standby load balancer of the standby load balancing server if the abnormal running state of the current load balancer is detected, so as to ensure high availability of load balancing.
The dynamic loading device for the configuration information provided by the embodiment of the invention can execute the dynamic loading method for the configuration information provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 shows a schematic diagram of an electronic device 40 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM) 42, a Random Access Memory (RAM) 43, etc., in which the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 42 or the computer program loaded from the storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 may also be stored. The processor 41, the ROM 42 and the RAM 43 are connected to each other via a bus 44. An input/output (I/O) interface 45 is also connected to bus 44.
Various components in electronic device 40 are connected to I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, etc.; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 41 may be various general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as a dynamic loading method of configuration information.
In some embodiments, the dynamic loading method of configuration information may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the dynamic loading method of configuration information described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the dynamic loading method of the configuration information in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. The dynamic loading method of the configuration information is characterized by being applied to a load balancing server and comprising the following steps:
when receiving update configuration information, acquiring a target component corresponding to the update configuration information;
if the updated configuration information passes the conflict verification successfully, writing the updated configuration information into a preset database, and issuing a configuration change message on a target channel of the preset database;
And when the configuration change message is successfully monitored in the target channel, reading the updated configuration information from the preset database, and reloading the updated configuration information through the target component so as to realize the configuration update of the target component.
2. The method of claim 1, wherein the updating the configuration information successfully passes a collision check, comprising:
and reading the current configuration information corresponding to the target component from the preset database, and if the preset conflict detection condition is not met between the updated configuration information and the current configuration information, determining that the updated configuration information passes the conflict verification successfully.
3. The method of claim 2, wherein writing the updated configuration information to a preset database comprises:
judging whether the updated configuration information is the same as the current configuration information;
if not, replacing and storing the current configuration information in the preset database by adopting the updated configuration information.
4. The method of claim 1, wherein reloading the updated configuration information with the target component to effect a configuration update of the target component comprises:
Generating an update configuration file according to the update configuration information and a preset file generation rule, and reloading the update configuration file through the target component to realize configuration update of the target component.
5. The method of claim 4, wherein reloading the update configuration file with the target component to effect a configuration update of the target component comprises:
acquiring a configuration file path corresponding to the target component;
replacing a current configuration file corresponding to the current configuration information with the updated configuration file under the configuration file path;
and reloading the updated configuration file under the configuration file path through the target component to realize configuration updating of the target component.
6. The method of any of claims 1-5, wherein the target component comprises a load balancer and/or a keep-alive module.
7. The method of claim 6, further comprising, after reloading the updated configuration information by the keep-alive module to effect a configuration update of the keep-alive module:
detecting the running state of a current load equalizer through a current keep-alive module;
If the running state of the current load balancer is detected to be abnormal, the current load balancer is closed, and a preset virtual internet protocol address is distributed to the standby load balancer of the standby load balancing server, so that high availability of load balancing is ensured.
8. A dynamic loading device for configuration information, which is applied to a load balancing server, comprising:
the configuration information receiving module is used for acquiring a target component corresponding to the updated configuration information when the updated configuration information is received;
the configuration information storage module is used for writing the updated configuration information into a preset database if the updated configuration information passes the conflict verification successfully, and issuing a configuration change message on a target channel of the preset database;
and the configuration information reloading module is used for reading the updated configuration information from the preset database when the configuration change message is successfully monitored in the target channel, and reloading the updated configuration information through the target component so as to realize the configuration updating of the target component.
9. An electronic device, the electronic device comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of dynamically loading configuration information of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the method for dynamically loading configuration information of any one of claims 1-7 when executed.
CN202311250542.XA 2023-09-26 2023-09-26 Dynamic loading method, device, equipment and storage medium of configuration information Pending CN117251285A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311250542.XA CN117251285A (en) 2023-09-26 2023-09-26 Dynamic loading method, device, equipment and storage medium of configuration information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311250542.XA CN117251285A (en) 2023-09-26 2023-09-26 Dynamic loading method, device, equipment and storage medium of configuration information

Publications (1)

Publication Number Publication Date
CN117251285A true CN117251285A (en) 2023-12-19

Family

ID=89128988

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311250542.XA Pending CN117251285A (en) 2023-09-26 2023-09-26 Dynamic loading method, device, equipment and storage medium of configuration information

Country Status (1)

Country Link
CN (1) CN117251285A (en)

Similar Documents

Publication Publication Date Title
CN109842651B (en) Uninterrupted service load balancing method and system
CN108696581B (en) Distributed information caching method and device, computer equipment and storage medium
CN113656147B (en) Cluster deployment method, device, equipment and storage medium
CN113094430B (en) Data processing method, device, equipment and storage medium
CN115640110B (en) Distributed cloud computing system scheduling method and device
CN115580645A (en) Service switching method and device, electronic equipment and storage medium
CN117435569A (en) Dynamic capacity expansion method, device, equipment, medium and program product for cache system
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
CN116545905A (en) Service health detection method and device, electronic equipment and storage medium
CN113360689B (en) Image retrieval system, method, related device and computer program product
CN113986135B (en) Method, device, equipment and storage medium for processing request
CN117251285A (en) Dynamic loading method, device, equipment and storage medium of configuration information
CN113468140B (en) Data migration processing method, electronic device and computer-readable storage medium
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN114443057A (en) Deployment of conversation model, conversation method, device, electronic equipment and storage medium
CN113760469A (en) Distributed computing method and device
CN115665245A (en) Local cache refreshing method and device, electronic equipment and storage medium
CN115174447B (en) Network communication method, device, system, equipment and storage medium
CN113595870B (en) Push message processing method and device, electronic equipment and storage medium
CN113596172B (en) Method and device for updating nodes in distributed cluster
CN114615273B (en) Data transmission method, device and equipment based on load balancing system
CN112749042B (en) Application running method and device
CN115391046A (en) Quota management method, device, equipment and medium
CN115665240A (en) Proxy service adding method, device, electronic equipment and storage medium
CN115756855A (en) Cluster switching method, device, terminal and storage medium

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