Data processing method, device and server for target cluster
The method efficiently updates cluster server configuration files using a storage module and extension interface, avoiding server restarts and enhancing processing efficiency and management.
Patent Information
- Application Number
- CN202011362513.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-27
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2040-11-27
AI Technical Summary
Existing methods for updating configuration files of cluster servers require manual maintenance or script files, necessitating server restarts or reloads, which affect throughput and efficiency.
A data processing method that uses a preset storage module to back up current configuration files, generates update files, and updates them via a data interface without restarting servers, utilizing a Redis-based storage module and ngx_http_dyups_module for efficient hot updates.
Enables efficient hot updates of configuration files without affecting data processing, simplifies the update process, and improves overall processing efficiency while allowing better dynamic management of upstream services.
Smart Images

Figure CN112463808B_ABST
Abstract
Description
Technical Field
[0001] This specification belongs to the field of Internet technology, and in particular, relates to a data processing method, device, and server for a target cluster. Background Art
[0002] When managing upstream services (eg, upstream) of a cluster server, the existing method is usually to perform manual maintenance or use script files to modify and update configuration files of the upstream services of the cluster server.
[0003] However, after modifying the configuration file of the upstream service based on the above method, it is often necessary to restart the server or reload the configuration. This will inevitably affect the throughput of the reverse proxy service of the cluster server, and further affect the normal data processing of the cluster. At the same time, the specific implementation process of the above method is relatively cumbersome, which affects the overall processing efficiency.
[0004] To address the above problems, no effective solution has been proposed yet. Summary of the invention
[0005] This specification provides a data processing method, device and server for a target cluster, so that the configuration files of the upstream services of each server in the target cluster can be efficiently hot-updated by using the data interface of a preset extension module without restarting or reloading the server, thereby avoiding affecting the data processing of the target cluster.
[0006] This specification provides a method for processing data of a target cluster, including:
[0007] Obtain a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service;
[0008] In response to the configuration update request of the upstream service, according to the preset storage rule, a preset storage module is used to back up the current configuration file of the upstream service;
[0009] Generate a configuration update file for the upstream service according to the configuration update information of the upstream service;
[0010] Obtaining a server list of the target cluster from the preset storage module;
[0011] According to the server list of the target cluster, the data interface of the preset extension module is called, and according to the preset update rule, the configuration files of the upstream services are used to update the configuration files of the upstream services of the multiple servers in the target cluster respectively.
[0012] In one embodiment, obtaining a configuration update request for an upstream service of a target cluster includes:
[0013] Display the setting interface of the upstream service of the target cluster to the user through the terminal device;
[0014] Receiving configuration update information of the upstream service of the target cluster input by the user through the setting interface;
[0015] A corresponding configuration update request is generated according to the configuration update information.
[0016] In one embodiment, the target cluster includes an Nginx cluster.
[0017] In one embodiment, the preset storage module includes a Redis-based storage module.
[0018] In one embodiment, backing up the current configuration file of the upstream service using a preset storage module according to a preset storage rule includes:
[0019] Calling a preset data interface of an extension module to store the full data of the current configuration file of the upstream service as a backup of the configuration file of the upstream service, and obtaining a corresponding storage path and timestamp;
[0020] In a preset storage module, a list data structure is used to store a storage path with a timestamp corresponding to a backup of the configuration file of the upstream service.
[0021] In one embodiment, obtaining a server list of a target cluster from the preset storage module includes:
[0022] The data of the set data structure in the preset storage module is queried to obtain the server list of the target cluster.
[0023] In one embodiment, the interface of the preset extension module includes: API of ngx_http_dyups_module.
[0024] In one embodiment, according to the server list of the target cluster, calling the data interface of the preset extension module, and according to the preset update rule, using the configuration update file of the upstream service, respectively updating the configuration files of the upstream services of the multiple servers in the target cluster, including:
[0025] Update the configuration file of the upstream service of the current server in the target cluster as follows:
[0026] According to the preset update rules, when the current server is running, the data interface of the preset extension module is called, and the configuration file of the upstream service in the memory of the current server is overwritten with the configuration update file.
[0027] In one embodiment, the method further includes: according to a preset storage rule, backing up the configuration update file of the upstream service using a preset storage module.
[0028] In one embodiment, the method further comprises:
[0029] Receive a configuration rollback request;
[0030] According to the configuration rollback request, a backup of the configuration file of the requested upstream service is obtained by using a preset storage module;
[0031] Returns a backup of the configuration file for the upstream service.
[0032] In one embodiment, the configuration rollback request carries a timestamp corresponding to the backup of the configuration file of the requested upstream service.
[0033] In one embodiment, according to the configuration rollback request, obtaining a backup of the configuration file of the requested upstream service using a preset storage module includes:
[0034] According to the timestamp carried by the configuration rollback request, query the data of the list data structure in the preset storage module to determine the path carrying the same timestamp as the target path;
[0035] According to the target path, a backup of the configuration file of the requested upstream service is obtained.
[0036] This specification also provides a data processing device for a target cluster, including:
[0037] A first acquisition module is used to acquire a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service;
[0038] A backup module, used to respond to the configuration update request of the upstream service and back up the current configuration file of the upstream service using a preset storage module according to a preset storage rule;
[0039] A generation module, used to generate a configuration update file for the upstream service according to the configuration update information of the upstream service;
[0040] A second acquisition module, used to acquire a server list of a target cluster from the preset storage module;
[0041] The update module is used to call the preset data interface of the extension module according to the server list of the target cluster, and update the configuration files of the upstream services of multiple servers in the target cluster respectively according to the preset update rules and the configuration update files of the upstream services.
[0042] The present specification also provides a server, comprising a processor and a memory for storing processor executable instructions, wherein the processor executes the instructions to obtain a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; in response to the configuration update request for the upstream service, according to a preset storage rule, backing up a current configuration file of the upstream service using a preset storage module; generating a configuration update file of the upstream service according to the configuration update information of the upstream service; obtaining a server list of the target cluster from the preset storage module; calling a data interface of a preset extension module according to the server list of the target cluster, and according to a preset update rule, using the configuration update file of the upstream service to respectively update the configuration files of the upstream services of multiple servers in the target cluster.
[0043] The present specification also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed, implement the acquisition of a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; in response to the configuration update request for the upstream service, backing up a current configuration file of the upstream service using a preset storage module according to preset storage rules; generating a configuration update file of the upstream service according to the configuration update information of the upstream service; acquiring a server list of the target cluster from the preset storage module; calling a data interface of a preset extension module according to the server list of the target cluster, and updating the configuration files of the upstream services of multiple servers in the target cluster respectively using the configuration update file of the upstream service according to preset update rules.
[0044] The present specification provides a data processing method, device and server for a target cluster. Based on this method, after obtaining a configuration update request for an upstream service of the target cluster, the full information of the current configuration file of the upstream service can be backed up using a preset storage module according to a preset storage rule; then, a configuration update file of the upstream service can be generated according to the configuration update information of the upstream service; further, a server list of the target cluster can be obtained from the preset storage module; and according to the server list of the target cluster, a data interface of a preset extension module is called, and according to the preset update rules, the configuration update file of the upstream service is used to update the configuration files of the upstream services of multiple servers in the target cluster respectively, so that the configuration files of the upstream services of each server in the target cluster can be efficiently hot-updated using the data interface of the preset extension module without the need to restart or reload the server, thereby avoiding affecting the normal data processing of the target cluster; at the same time, the above method also simplifies the update process of the configuration files of the upstream services of the cluster, improves the overall processing efficiency, and can better and more effectively dynamically manage the upstream services of the cluster. The present invention solves the technical problems that the existing method is inefficient in updating the configuration file of the upstream service of the cluster server, and requires operations such as restart or reload, which affects the data processing of the target cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 It is a schematic diagram of an embodiment of the structural composition of a system using the target cluster data processing method provided by the embodiments of this specification;
[0047] Figure 2 is a flowchart of a data processing method for a target cluster provided by an embodiment of this specification;
[0048] Figure 3 It is a schematic diagram of the structure of a server provided by an embodiment of this specification;
[0049] Figure 4 is a schematic diagram of the structure of a data processing device of a target cluster provided by an embodiment of this specification;
[0050] Figure 5 It is a schematic diagram of an embodiment of a target cluster data processing method provided by an embodiment of this specification, in a scenario example;
[0051] Figure 6 It is a schematic diagram of an embodiment of a target cluster data processing method provided by an embodiment of this specification, in a scenario example. DETAILED DESCRIPTION
[0052] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0053] Considering that the existing cluster-based data processing method usually manages the upstream services of the cluster server through manual maintenance or using script files to modify and update the configuration files of the upstream services of the cluster server. However, after using the above method to modify the configuration files of the upstream service, it is often necessary to re-install the server or reload the configuration and other operations. These operations will affect the throughput of the reverse proxy service of the cluster server and affect the data processing of the cluster as a whole. At the same time, the above method is relatively cumbersome in specific implementation, affecting the overall processing efficiency. As a result, the existing method has at least the following technical problems: low efficiency when updating the configuration files of the upstream services of the cluster server, and the need to restart or reload operations, affecting the data processing of the target cluster.
[0054] In view of the root cause of the above problems, this specification considers using different update methods to update the configuration files of the upstream services of the cluster servers. Specifically, after obtaining the configuration update request for the upstream service of the target cluster, the cluster server can first back up the current configuration file of the upstream service using the preset storage module according to the preset storage rules; then generate the configuration update file of the upstream service according to the configuration update information of the upstream service; obtain the server list of the target cluster from the preset storage module; then, according to the server list of the target cluster, call the data interface of the preset extension module, and update the configuration files of the upstream services of the multiple servers in the target cluster according to the preset update rules, so that the configuration files of the upstream services of each server in the target cluster can be efficiently updated by using the data interface of the preset extension module without restarting or reloading the server, thus avoiding the impact on the data processing of the target cluster. At the same time, based on the above method, the update process of the configuration files of the upstream services of the cluster is also simplified, the overall processing efficiency is improved, and the dynamic management of the upstream services of the cluster can be better performed.
[0055] The present specification provides a method for processing data of a target cluster. The method for processing data of a target cluster can be applied to a system including a target cluster and a terminal device. Figure 1 The target cluster may specifically include multiple servers. One server in the target cluster is connected to the terminal device, and different servers in the target cluster are connected to each other via wired or wireless means to exchange data.
[0056] In specific implementation, the terminal device can display the setting interface of the upstream service of the target cluster to the user; and receive the configuration update information of the upstream service of the target cluster input by the user through the setting interface. Furthermore, the terminal device can generate a configuration update request for the upstream service of the target cluster carrying the configuration update information of the upstream service, and send the configuration update request of the upstream service to a server in the target cluster (or a front-end server in the target cluster specifically responsible for corresponding to the terminal device).
[0057] Correspondingly, the server can obtain a configuration update request for the upstream service of the target cluster; and respond to the configuration update request of the upstream service, and according to the preset storage rules, use the preset storage module to back up the current configuration file of the upstream service, so that the above backup can be used subsequently to support the configuration rollback request initiated by the user.
[0058] Furthermore, the server may generate a configuration update file for the upstream service according to the configuration update information of the upstream service; and obtain a server list of the target cluster from the preset storage module.
[0059] Next, the server may call a preset data interface of the extension module according to the server list of the target cluster, and update the configuration files of the upstream services of the multiple servers in the target cluster respectively according to preset update rules and using the configuration update files of the upstream services.
[0060] In this embodiment, the server may specifically include a background server applied to one side of the business platform, which can realize functions such as data transmission and data processing. Specifically, the server may be, for example, an electronic device with data calculation, storage and network interaction functions. Alternatively, the server may also be a software program running in the electronic device to provide support for data processing, storage and network interaction. In this embodiment, the number of servers included in the server is not specifically limited. The server may specifically be one server, or several servers, or a server cluster formed by several servers.
[0061] In this embodiment, the terminal device may specifically include an electronic device applied to the user side and capable of realizing functions such as data collection and data transmission. Specifically, the terminal device may be, for example, a desktop computer, a tablet computer, a laptop computer, a smart phone, etc. Alternatively, the terminal device may also be a software application that can be run in the above electronic devices. For example, it may be an APP running on a smart phone.
[0062] Through the above system, without the need to restart or reload the server, the data interface of the preset extension module can be used to efficiently perform hot updates on the configuration files of the upstream services of each server in the target cluster, thereby avoiding the impact on the data processing of the target cluster; at the same time, it also simplifies the update process of the configuration files for the upstream services of the cluster, improves the overall processing efficiency, and enables better dynamic management of the upstream services of the cluster.
[0063] See also Figure 2 As shown, the embodiment of this specification provides a method for processing data of a target cluster. The method is specifically applied to the server side. When implemented specifically, the method may include the following contents.
[0064] S201: Obtain a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service.
[0065] In this embodiment, the target cluster may specifically include a plurality of different servers. The server to which the method is applied may be any server in the target cluster, or may be a front-end server in the target cluster that interfaces with the user.
[0066] In one embodiment, the target cluster may specifically include an Nginx cluster. Accordingly, the server included in the target cluster may specifically be an Nginx server.
[0067] Among them, the above-mentioned Nginx can be specifically understood as an open source Web server known for its high performance and high concurrency, supporting HTTP (HyperText Transfer Protocol) reverse proxy, TCP (Transmission Control Protocol) proxy, load balancing, HTTP caching and Web development, etc.
[0068] In this embodiment, the upstream service (upstream), that is, the ngx_http_upstream_module module, is specifically an official Nginx module, which is used to provide load balancing and failover service functions for the reverse proxy.
[0069] In this embodiment, the configuration update request for the upstream service of the target cluster may carry the configuration update information of the upstream service. Specifically, the configuration update request is used to request to modify and update the configuration file of the upstream service of the server in the target cluster accordingly using the configuration update information of the upstream service carried.
[0070] In one embodiment, the acquisition of the configuration update request for the upstream service of the target cluster may include the following contents when implemented: displaying a setting interface for the upstream service of the target cluster to the user through a terminal device; receiving configuration update information for the upstream service of the target cluster input by the user through the setting interface; and generating a corresponding configuration update request based on the configuration update information.
[0071] In this embodiment, the user can enter the configuration update information of the upstream service of the target cluster in the above setting interface displayed by the terminal device according to the prompt information displayed on the interface, according to the specific application scenario and processing requirements. Accordingly, the terminal device can collect the configuration update information through the above setting interface.
[0072] In this embodiment, after the terminal device collects the configuration update information, it can directly send the configuration update information to the server, and the server generates a corresponding configuration update request based on the configuration update information. Alternatively, the terminal device can generate a configuration update request carrying the configuration update information based on the collected configuration update information, and then send the configuration update request to the server; accordingly, the server receives the configuration update request sent by the terminal device.
[0073] S202: Responding to the configuration update request of the upstream service, and backing up the current configuration file of the upstream service by using a preset storage module according to a preset storage rule.
[0074] In one embodiment, the preset storage module may specifically include a Redis-based storage module.
[0075] In this embodiment, the above-mentioned Redis can be specifically understood as an open source key-value pair storage database developed based on C language, which can provide a variety of storage data structures, and can also run based on memory, support distributed expansion, and have functions such as data persistence.
[0076] In this embodiment, a lightweight Redis-based storage module is used as a preset storage module to efficiently store and query related data of different data structures involved in the processing process, which helps to improve the overall processing efficiency.
[0077] In this embodiment, before receiving a configuration update request and updating the configuration file of the upstream service, the preset storage module can be used to back up the full data of the current configuration file of the upstream service currently in use, so as to support the user to perform configuration rollback operations when necessary.
[0078] In one embodiment, the current configuration file of the upstream service is backed up using a preset storage module according to a preset storage rule. When implemented specifically, the following contents may be included.
[0079] S1: calling a preset data interface of an extension module to store the full data of the current configuration file of the upstream service as a backup of the configuration file of the upstream service, and obtaining a corresponding storage path and timestamp.
[0080] S2: In a preset storage module, a list data structure is used to store a storage path with a timestamp corresponding to the backup of the configuration file of the upstream service.
[0081] In one embodiment, the interface of the preset extension module may specifically include: API of ngx_http_dyups_module. Of course, it should be noted that the interfaces listed above are only schematic illustrations. During specific implementation, other suitable interfaces may also be used as the interface of the preset extension module according to the specific application scenario and the specific characteristics of the target cluster.
[0082] Among them, ngx_http_dyups_module (also called dyups) can be specifically understood as a software module that can provide corresponding APIs (interfaces) to support dynamic modification of upstream configurations. Furthermore, the module can also support dynamic modification of Nginx's ip_hash, keepalive and other upstream-related configurations. The above dynamic modification can be understood as hot modification or hot update, that is, completing the corresponding modification or update without stopping or restarting.
[0083] In one embodiment, during the specific implementation, when calling the data interface of the preset extension module to store the full data of the current configuration file of the upstream service as a backup of the configuration file of the upstream service, the path address of the backup will also be recorded and saved, for example, " / usr / local / nginx / backup / upstreams." as the storage path corresponding to the backup. At the same time, the corresponding timestamp can also be generated by splicing based on the time information of the backup (for example, September 11, 2020) in combination with the timestamp mark, for example, "20200911.1600006829".
[0084] Furthermore, in the preset storage module, a list data structure that matches the data structure of the storage path can be used to store the backup storage path. When storing, according to the preset storage rules, the storage path with a timestamp, for example, " / usr / local / nginx / backup / upstreams.20200911.1600006829", can be stored to facilitate subsequent retrieval, rollback and other operations.
[0085] When using the list data structure to store the above storage path with timestamp, considering that the Redis list is a string list sorted in the order of insertion, in order to further facilitate subsequent retrieval, rollback and other operations, the updated backup storage path can be inserted into the list head of the list data structure each time for storage.
[0086] Through the above method, before each update of the configuration file of the upstream service, the current configuration file of the upstream service in use can be backed up, and the storage path with a timestamp corresponding to the backup can be stored in a preset storage module in a list data structure, so as to meet the diverse needs of users in the future, perform configuration rollback, historical configuration query and other processing more efficiently, and improve the user experience.
[0087] In one embodiment, in addition to storing the storage path corresponding to the backup and carrying a timestamp, the above-mentioned preset storage module can also store other data used in managing the configuration of the upstream services of the servers of the target cluster. For example, the server list of the target cluster, the upstream service list of the target cluster, the back-end server configuration information within the designated upstream service of the target cluster, etc. Moreover, the above-mentioned data can be specifically stored in the preset storage module in a matching data structure. For example, the server list of the target cluster, the upstream service list of the target cluster, and the back-end server configuration information within the designated upstream service of the target cluster can be stored in the preset storage module in a set data structure for subsequent use.
[0088] S203: Generate a configuration update file for the upstream service according to the configuration update information of the upstream service.
[0089] In this embodiment, the server may extract the configuration update information carried in the configuration update request, and generate a configuration update file for the upstream service according to the configuration update information.
[0090] S204: Obtain a server list of the target cluster from the preset storage module.
[0091] In this embodiment, the server list of the target cluster may specifically include the identity of each server in the target cluster (eg, server number, server name, etc.), and data such as the IP address and port information of each server.
[0092] In this embodiment, before specific implementation, the server can obtain and generate a server list of the target cluster based on the relevant information of each server in the target cluster; in a preset storage module, a set data structure is used to store the server list of the above target cluster to facilitate subsequent efficient query, acquisition, and modification of the server list.
[0093] In one embodiment, obtaining the server list of the target cluster from the preset storage module may include: querying data of a set data structure in the preset storage module to obtain the server list of the target cluster.
[0094] In this embodiment, specifically, the server can access a preset storage module, and search and query the data of the set data structure stored in the preset storage module according to the cluster identifier of the target cluster to find a server list of the target cluster corresponding to the cluster identifier.
[0095] S205: According to the server list of the target cluster, call the preset data interface of the extension module, and update the configuration files of the upstream services of the multiple servers in the target cluster respectively according to the preset update rules and using the configuration update files of the upstream services.
[0096] In this embodiment, during specific implementation, the server can determine the multiple servers included in the target cluster according to the server list of the target cluster, and determine the IP address, port information, etc. of each server in the multiple servers; and then can call the preset data interface of the extension module according to the IP address, port information, etc. of the service, and update the configuration files of the upstream services of each server in the target cluster one by one according to the preset update rules. Thus, the configuration files of the upstream services of the target cluster can be updated efficiently.
[0097] In one embodiment, the above-mentioned method calls the preset data interface of the extension module according to the server list of the target cluster, and uses the configuration update file of the upstream service according to the preset update rule to respectively update the configuration files of the upstream services of multiple servers in the target cluster. When it is specifically implemented, the configuration file of the upstream service of the current server in the target cluster can be updated in the following manner: according to the preset update rule, when the current server is running, calls the preset data interface of the extension module, and uses the configuration update file to overwrite the configuration file of the upstream service in the memory of the current server. In this way, the configuration file of the upstream service of the current server can be updated efficiently without restarting or reloading, and the data processing of the current server will not be affected.
[0098] In this embodiment, while the configuration file of the upstream service in the memory of the current server is overwritten with the configuration update file, the static configuration data related to the configuration file of the upstream service in the local current server can also be synchronously modified and updated. In addition, the configuration file of the upstream service in the storage module corresponding to the current server can also be updated. In this way, even if the current server suddenly crashes or restarts, the newly updated configuration file of the upstream service will not be lost, so that the update process can be more stable and reliable.
[0099] In this embodiment, after the server completes the update of the configuration file of the upstream service of the current server each time, it can set an updated mark at the identity identifier corresponding to the current server in the server list of the target cluster; then retrieve the server in the server list of the target cluster that does not have an updated mark set, and update it as the next current server.
[0100] The above method is looped until no server with no updated mark set is found in the server list of the target cluster, thereby updating the configuration file of the upstream service of the target cluster efficiently and orderly.
[0101] In one embodiment, after completing the update of the configuration file of the upstream service of the current server, the method may further include: backing up the configuration update file of the upstream service using a preset storage module according to a preset storage rule. Specifically, the current configuration file of the upstream service may be backed up with reference to backing up the configuration update file of the upstream service using a preset storage module to avoid the loss of the configuration update file of the upstream service due to special abnormal circumstances, thereby protecting the stability and reliability of cluster data processing.
[0102] In this embodiment, after obtaining the configuration update request for the upstream service of the target cluster, the full information of the current configuration file of the upstream service can be backed up by using the preset storage module according to the preset storage rule; then, according to the configuration update information of the upstream service, the configuration update file of the upstream service can be generated; further, the server list of the target cluster can be obtained from the preset storage module; and according to the server list of the target cluster, the data interface of the preset extension module is called, and the configuration files of the upstream services of the multiple servers in the target cluster are updated respectively according to the preset update rules, so that the configuration files of the upstream services of each server in the target cluster can be efficiently hot updated by using the data interface of the preset extension module without restarting or reloading the server, thereby avoiding the impact on the data processing of the target cluster; at the same time, the update process of the configuration files of the upstream services of the cluster is simplified, the overall processing efficiency is improved, and the dynamic management of the upstream services of the cluster can be better performed. The technical problem that the existing method is low in efficiency when updating the configuration files of the upstream services of the cluster servers, and the restart or reload operation is required, which affects the data processing of the target cluster is solved.
[0103] In one embodiment, when the method is implemented, it may also include the following contents: receiving a configuration rollback request; obtaining a backup of the configuration file of the requested upstream service using a preset storage module according to the configuration rollback request; and feeding back the backup of the configuration file of the upstream service.
[0104] The configuration rollback request may be specifically understood as request data for requesting to roll back the configuration file of the upstream service before the update.
[0105] In this embodiment, according to specific application scenarios and processing requirements, for example, the current user requires the target cluster to be restored to the configuration state before the update for subsequent data processing. In this case, the user can generate a corresponding configuration rollback request through the terminal device and send it to the server.
[0106] Correspondingly, the server can receive and, based on the above configuration rollback request, search and obtain the backup of the configuration file of the upstream service requested by the configuration rollback request from the preset storage module, and feed back the backup of the configuration file of the upstream service to the terminal device to wait for further instructions from the user.
[0107] When the user initiates a configuration recovery instruction for the backup of the configuration file based on the upstream service through the terminal device, the server can respond to the configuration recovery instruction, use the backup of the configuration file of the upstream service as a configuration update file, and in a similar manner, call the data interface of the preset extension module according to the server list of the target cluster, and update the configuration files of the upstream services of multiple servers in the target cluster according to the preset update rules. In this way, the configuration files of the upstream services of each server in the target cluster can be efficiently restored to the previous configuration.
[0108] In one embodiment, the configuration rollback request may specifically carry a timestamp corresponding to the backup of the configuration file of the requested upstream service.
[0109] In one embodiment, the above-mentioned method of obtaining a backup of the configuration file of the requested upstream service using a preset storage module according to the configuration fallback request may include the following contents during specific implementation: according to the timestamp carried by the configuration fallback request, querying the data of the list data structure in the preset storage module to determine the path carrying the same timestamp as the target path; according to the target path, obtaining a backup of the configuration file of the requested upstream service.
[0110] In this embodiment, through the above method, the server can use the timestamp carried in the configuration rollback request to accurately and efficiently find the backup of the configuration file requested to be rolled back by the user in the preset storage module.
[0111] In one embodiment, considering that there may be relatively complex dependencies between different servers in the target cluster, in order to more accurately and efficiently update the configuration files of the upstream services of the servers in the target cluster, the configuration files of the upstream services of each server in the target cluster may be updated in a certain update order in combination with the dependencies between the servers in the target cluster.
[0112] In one embodiment, the above-mentioned calling of the preset data interface of the extension module according to the server list of the target cluster, and respectively updating the configuration files of the upstream services of multiple servers in the target cluster by using the configuration update file of the upstream service according to the preset update rules, may include the following contents during specific implementation: determining the dependency relationship between the servers in the target cluster according to the server list of the target cluster; determining the server level to which each server belongs and the priority between different server levels according to the dependency relationship; calling the preset data interface of the extension module, and sequentially updating the configuration files of the upstream services of the servers in each server level according to the priority.
[0113] Through the above embodiments, the configuration files of the upstream services of the servers in the target cluster can be obtained and updated respectively and accurately and orderly according to the dependency relationship between the servers in the target cluster.
[0114] In one embodiment, when it is necessary to perform a version update on some servers in the target cluster (referred to as target servers), the user can set the configuration update information of the corresponding upstream service through the terminal device to divert the data processing request originally diverted to the target server to other servers in the target cluster. The terminal device generates a configuration update request carrying the above configuration update information and sends the configuration update request to the server. After receiving the configuration update request, the server can first respond to the configuration update request of the upstream service, and use the preset storage module to back up the current configuration file of the upstream service (referred to as configuration file 1) according to the preset storage rules. Then, based on the configuration update information of the upstream service, generate a configuration update file for the upstream service (referred to as configuration file 2). Further, the server list of the target cluster can be obtained from the preset storage module; and based on the server list of the target cluster, the data interface of the preset extension module is called, and according to the preset update rules, the configuration update file of the upstream service is used to update the configuration files of the upstream services of multiple servers in the target cluster respectively.
[0115] In this way, the server of the target cluster can divert the data processing request according to the above configuration file 2, and will not divert the data processing request to the target server that is undergoing version update, thereby ensuring that the version update process will not affect the processing of the data processing request.
[0116] After the version update is completed and the target server can process data processing requests normally, the user can generate and send a configuration rollback request for configuration file 1 to the server through the terminal device. The server can respond to the configuration rollback request and use the preset storage module to obtain the previously used configuration file 1.
[0117] Furthermore, the server can call the data interface of the preset extension module according to the server list of the target cluster, and use the configuration file 1 to update the configuration files of the upstream services of multiple servers in the target cluster according to the preset update rules, so that the configuration files of the upstream services used by the servers of the target cluster can be restored to the configuration before the update.
[0118] After completing the above processing, when processing data processing requests, the servers of the target cluster can normally divert the data processing requests to the target servers for processing as before the update.
[0119] Through the above embodiments, the target cluster data processing method provided in this specification can be applied to realize the grayscale release of application services. In this way, during the release and update of the backend service application, the diversion can be dynamically closed through configuration, so that new data processing requests no longer flow to the server that is undergoing version update; after the update is completed, the diversion can be opened through configuration rollback, so that new data processing requests can flow back to the server that has completed the version update.
[0120] As can be seen from the above, the data processing method of the target cluster provided by the embodiment of this specification, based on this method, after obtaining the configuration update request for the upstream service of the target cluster, can first use the preset storage module to back up the full information of the current configuration file of the upstream service according to the preset storage rule; then generate the configuration update file of the upstream service according to the configuration update information of the upstream service; further, the server list of the target cluster can be obtained from the preset storage module; and according to the server list of the target cluster, the data interface of the preset extension module is called, and the configuration files of the upstream services of the multiple servers in the target cluster are updated respectively according to the preset update rules, so that the configuration files of the upstream services of each server in the target cluster can be efficiently hot updated by using the data interface of the preset extension module without restarting or reloading the server, thereby avoiding the impact on the data processing of the target cluster; at the same time, it also simplifies the update process of the configuration files of the upstream services of the cluster, improves the overall processing efficiency, and can better dynamically manage the upstream services of the cluster. The technical problem that the existing method is low in efficiency when updating the configuration files of the upstream services of the cluster servers, and needs to restart or reload operations, which affects the data processing of the target cluster is solved. Moreover, before the update, the existing current configuration file is fully backed up by utilizing the preset storage module, so that subsequent configuration rollback operations can be supported, meeting the diverse needs of users and improving the user experience.
[0121] The embodiment of the present specification also provides a server, including a processor and a memory for storing processor executable instructions, wherein the processor can perform the following steps according to the instructions when implemented: obtaining a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; responding to the configuration update request for the upstream service, backing up a current configuration file of the upstream service according to a preset storage rule using a preset storage module; generating a configuration update file of the upstream service according to the configuration update information of the upstream service; obtaining a server list of the target cluster from the preset storage module; calling a data interface of a preset extension module according to the server list of the target cluster, and respectively updating the configuration files of the upstream services of multiple servers in the target cluster according to preset update rules using the configuration update file of the upstream service.
[0122] In order to complete the above instructions more accurately, refer to Figure 3 As shown, the embodiment of this specification also provides another specific server, wherein the server includes a network communication port 301, a processor 302 and a memory 303, and the above structures are connected through internal cables so that each structure can perform specific data interaction.
[0123] The network communication port 301 may be specifically used to obtain a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service.
[0124] The processor 302 can be specifically used to respond to the configuration update request of the upstream service, and according to the preset storage rules, use the preset storage module to back up the current configuration file of the upstream service; generate a configuration update file of the upstream service according to the configuration update information of the upstream service; obtain the server list of the target cluster from the preset storage module; according to the server list of the target cluster, call the data interface of the preset extension module, and according to the preset update rules, use the configuration update file of the upstream service to update the configuration files of the upstream service of multiple servers in the target cluster respectively.
[0125] The memory 303 may be specifically used to store corresponding instruction programs.
[0126] In this embodiment, the network communication port 301 can be a virtual port that is bound to different communication protocols so that different data can be sent or received. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. In addition, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM, CDMA, etc.; it can also be a Wifi chip; it can also be a Bluetooth chip.
[0127] In this embodiment, the processor 302 may be implemented in any appropriate manner. For example, the processor may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc. This specification does not limit this.
[0128] In this embodiment, the memory 303 may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function but no physical form is also called a memory, such as RAM, FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.
[0129] The embodiments of the present specification also provide a computer storage medium based on the data processing method of the above-mentioned target cluster, wherein the computer storage medium stores computer program instructions, which, when executed, implement the following: obtaining a configuration update request for an upstream service of the target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; responding to the configuration update request for the upstream service, backing up the current configuration file of the upstream service according to a preset storage rule using a preset storage module; generating a configuration update file of the upstream service according to the configuration update information of the upstream service; obtaining a server list of the target cluster from the preset storage module; and calling a data interface of a preset extension module according to the server list of the target cluster, and updating the configuration files of the upstream services of multiple servers in the target cluster respectively according to the preset update rule using the configuration update file of the upstream service.
[0130] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0131] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other implementations and will not be described in detail here.
[0132] See also Figure 4 As shown, at the software level, the embodiment of this specification further provides a data processing device for a target cluster, which may specifically include the following structural modules.
[0133] The first acquisition module 401 may be specifically used to acquire a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service;
[0134] The backup module 402 may be specifically configured to respond to the configuration update request of the upstream service and back up the current configuration file of the upstream service using a preset storage module according to a preset storage rule;
[0135] The generating module 403 may be specifically used to generate a configuration update file of the upstream service according to the configuration update information of the upstream service;
[0136] The second acquisition module 404 may be specifically configured to acquire a server list of the target cluster from the preset storage module;
[0137] The update module 405 can be specifically used to call the preset data interface of the extension module according to the server list of the target cluster, and update the configuration files of the upstream services of multiple servers in the target cluster respectively according to the preset update rules and using the configuration update files of the upstream services.
[0138] It should be noted that the units, devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions divided into various modules. Of course, when implementing this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] As can be seen from the above, the data processing device of the target cluster provided in the embodiment of this specification can utilize the data interface of the preset extension module to efficiently hot update the configuration files of the upstream services of each server in the target cluster without restarting or reloading the server, thereby avoiding affecting the data processing of the target cluster.
[0140] In a specific scenario example, a system for dynamic management of upstream services of an Nginx cluster can be constructed based on the data processing method of the target cluster provided in this specification, and the system can be used to dynamically manage the upstream services of the Nginx cluster (ie, the target cluster). For the specific implementation process, please refer to the following content.
[0141] In this scenario example, a system for dynamic management of upstream services in an Nginx cluster is proposed. The system can include three modules: a dyups module (e.g., a preset extension module), a configuration storage module (e.g., a preset storage module), and a centralized management module. Figure 5 shown.
[0142] The dyups module can directly use the third-party open source software ngx_http_dyups_module, and achieve the function of dynamically modifying the upstream service configuration through the API (e.g., web interface) provided by it. Specifically, the ngx_http_dyups_module is an Nginx module developed in C language, which supports Nginx's ip_hash, keepalive and other configurations related to upstream services, and needs to be compiled and installed in Nginx.
[0143] For specific mutation installation, please refer to the following code.
[0144] #git clone git: / / github.com / yzprofile / ngx_http_dyups_module.git
[0145] #Compile as Nginx static module
[0146] #. / configure--add-module=. / ngx_http_dyups_module
[0147] After enabling, the interfaces that this module can support can be found in Table 1.
[0148] Table 1
[0149]
[0150] The above configuration storage module can be implemented using the open source middleware Redis, and different data structures provided by Redis are applied to facilitate the storage requirements of nginx upstream configuration parameters, and store various types of information as shown below.
[0151] 1. The server list in the Nginx cluster (for example, the server list of the target cluster) can use the Set data structure to store the IP and port information of the server (where Redis Set is an unordered set of String type, and the set members are unique, which can ensure that there is no duplicate data in the set). For example, refer to the following code, there are 3 servers in the Nginx cluster, and the Nginx service listens to port 8080.
[0152] #redis 127.0.0.1:6379>SADD clusters "127.0.0.10:8080"
[0153] #redis 127.0.0.1:6379>SADD clusters "127.0.0.11:8080"
[0154] #redis 127.0.0.1:6379>SADD clusters "127.0.0.12:8080"
[0155] 2. The upstream service list of the Nginx cluster can be stored using the data structure of Set. For example, referring to the following code, the upstream services of the Nginx cluster include 3, named: usersNginx, shopsNginx, ordersNginx, which correspond to the upstream services of the three backend applications of users, shops, and orders respectively.
[0156] #redis 127.0.0.1:6379>SADD clusterSet usersNginx
[0157] #redis 127.0.0.1:6379>SADD clusterSet shopsNginx
[0158] #redis 127.0.0.1:6379>SADD clusterSet ordersNginx
[0159] 3. The Nginx cluster specifies the backend server configuration information in the upstream service, which can be stored using the Set data structure. For example, refer to the following code, the upstream service named usersNginx contains two backend server configuration information.
[0160] #redis 127.0.0.1:6379>SADD usersNginx“server 127.0.0.1:8089weight=1
[0161] max_conns=0max_fails=1fail_timeout=10backup=0down=0”
[0162] #redis 127.0.0.1:6379>SADD usersNginx“server 127.0.0.1:8088weight=1
[0163] max_conns=0max_fails=1fail_timeout=10backup=0down=0”
[0164] 4. Upstream configuration file backup information can be stored using a list data structure (Redis list is a simple string list, sorted in the order of insertion). For example, refer to the following code to store the path information of the cluster upstream service configuration backup file. Each time a new backup file is inserted into the head of the list, the file name is named with the suffix "year.month.day.timestamp" for easy tracking.
[0165] #redis 127.0.0.1:6379>LPUSH clusterBack
[0166] " / usr / local / nginx / backup / upstreams.20200911.1600006829"
[0167] The centralized management module can provide users with a friendly front-end interface (for example, the setting interface of the upstream service of the target cluster) so that users can centrally manage and set the upstream service configuration of the Nginx cluster. It is worth noting that when the upstream service configuration is updated (added / deleted / modified), it will trigger the update of the upstream service configuration file of Nginx to ensure that the correct configuration can be obtained after the Nginx service is restarted.
[0168] Among them, the operation of querying the upstream service configuration is relatively simple. You can directly call the query interface corresponding to the dyups module to obtain it, which will not be repeated here. Figure 6 As shown, the process of updating the upstream service configuration is described below.
[0169] 1. When receiving an upstream configuration update request, first back up the existing upstream service configuration information in full;
[0170] 2. Parse the update request and update the upstream service configuration information in the storage configuration module;
[0171] 3. Generate a new upstream service configuration file based on the new configuration information;
[0172] 4. Get the list of Nginx cluster servers and update them one by one, including calling the dyups module to overwrite the specified upstream service content and updating the upstream configuration files in the server.
[0173] In this scenario example, the above step 4 can be specifically understood as a program loop processing logic, which runs in the server of the centralized management module. When an update request is received, the following specific processing will be performed:
[0174] S1: Back up the full configuration information of the upstream service (for one of the target servers, initiate a GET / list request to the dyups interface);
[0175] S2: Update the upstream service configuration information (update the upstream configuration information stored in Redis according to the update request);
[0176] S3: Generate a new upstream service configuration file (generate a file according to the configuration file format for the information obtained in the first step, and the storage location is specified by the centralized management module server);
[0177] S5: Get the Nginx cluster server list (query storage configuration module);
[0178] S6: Enter the loop body;
[0179] S7: Initiate a POST / DELETE request to the dyups interface to perform a hot update on the Nginx configuration parameters;
[0180] S8: Update the upstream configuration file (transfer the upstream configuration file generated in the third step to the Nginx server);
[0181] S9: Jump to step S5 to make a judgment. If there is no Nginx server that has not been updated, the processing ends.
[0182] Note that in this scenario, each update will trigger the backup of the full upstream service configuration information and update the upstream service configuration file of the Nginx cluster server. Therefore, it is convenient to parse the historical backup file and update the upstream service configuration; and avoid using outdated configuration information when the cluster server is restarted (the local configuration file is the latest upstream service configuration information).
[0183] In this scenario example, the software used when the system for dynamic management of the upstream service of the Nginx cluster is applied to dynamically manage the upstream service of the Nginx cluster can be specifically referred to as shown in Table 2.
[0184] Table 2
[0185] operating system CentOS 7.4 Nginx Nginx 1.12.2 Nginx third-party modules ngx_http_dyups_module V0.2.9 Key-value database Redis 6.0.8
[0186] Through the above scenario examples, the system for dynamic management of upstream services of Nginx clusters constructed based on the data processing method of the target cluster provided in this specification can, first of all, provide an enterprise-level dynamic management solution for upstream services of Nginx clusters by using open source tools based on dyups and Redis. Specifically, in the module composition and sub-module responsibilities of the system for dynamic management of upstream services of Nginx clusters mentioned above: The system for dynamic management of upstream services of Nginx clusters proposed in this solution can be divided into 3 system modules with clear responsibilities, high cohesion and low coupling, thereby providing an upstream service dynamic management solution for enterprise-level Nginx clusters to meet the use of enterprise-level services.
[0187] Secondly, the system based on the dynamic management of upstream services of the Nginx cluster can provide a solution for the integrity of Nginx configuration data. Compared with the common dynamic management solutions of upstream services, it can provide a solution to ensure the integrity of configuration data, provide the reverse proxy cluster with the ability to roll back configuration, and ensure the security of the production system.
[0188] In addition, the system based on the dynamic management of the upstream service of the Nginx cluster can also effectively reduce the manual maintenance cost, improve the processing efficiency, and realize the dynamic management of the upstream service of Nginx.
[0189] Although the present specification provides method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent a unique execution order. When the device or client product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. The first, second, etc. words are used to represent the name, and do not represent any particular order.
[0190] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0191] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media including storage devices.
[0192] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that the present specification can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present specification can essentially be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.
[0193] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. This specification can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0194] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.
Claims
1. A data processing method for a target cluster, characterized in that: include: Obtain a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; In response to the configuration update request of the upstream service, according to the preset storage rule, a preset storage module is used to back up the current configuration file of the upstream service; Generate a configuration update file for the upstream service according to the configuration update information of the upstream service; Obtaining a server list of the target cluster from the preset storage module; According to the server list of the target cluster, the data interface of the preset extension module is called, and according to the preset update rule, the configuration file of the upstream service is used to update the configuration files of the upstream services of the multiple servers in the target cluster respectively; wherein the interface of the preset extension module includes: the API of ngx_http_dyups_module; The method of backing up the current configuration file of the upstream service by using a preset storage module according to a preset storage rule includes: Calling a preset data interface of an extension module to store the full data of the current configuration file of the upstream service as a backup of the configuration file of the upstream service, and obtaining a corresponding storage path and timestamp; In the preset storage module, the list header of the list data structure is used to store the storage path with a timestamp corresponding to the backup of the configuration file of the upstream service to meet user needs and support configuration rollback and historical configuration query; Among them, in the preset storage module, a set data structure is also used to store data used when managing the configuration of the upstream service of the server of the target cluster; the data includes: a server list of the target cluster, a list of upstream services of the target cluster, and backend server configuration information in the designated upstream service of the target cluster; Among them, according to the server list of the target cluster, the data interface of the preset extension module is called, and according to the preset update rules, the configuration files of the upstream services are used to update the configuration files of the upstream services of multiple servers in the target cluster respectively, including: according to the server list of the target cluster, determining the dependency relationship between the servers in the target cluster; according to the dependency relationship, determining the server level to which each server belongs, and the priority between different server levels; calling the data interface of the preset extension module, and updating the configuration files of the upstream services of the servers in each server level in sequence according to the priority.
2. The method according to claim 1, characterized in that The step of obtaining a configuration update request for an upstream service of a target cluster includes: Display the setting interface of the upstream service of the target cluster to the user through the terminal device; Receiving configuration update information of the upstream service of the target cluster input by the user through the setting interface; A corresponding configuration update request is generated according to the configuration update information.
3. The method according to claim 1, characterized in that The target cluster includes an Nginx cluster.
4. The method according to claim 3, characterized in that The preset storage module includes a Redis-based storage module.
5. The method according to claim 4, characterized in that Obtaining a server list of the target cluster from the preset storage module includes: The data of the set data structure in the preset storage module is queried to obtain the server list of the target cluster.
6. The method according to claim 4, characterized in that According to the server list of the target cluster, calling the preset data interface of the extension module, according to the preset update rule, using the configuration update file of the upstream service, respectively updating the configuration files of the upstream services of the multiple servers in the target cluster, including: Update the configuration file of the upstream service of the current server in the target cluster as follows: According to the preset update rules, when the current server is running, the data interface of the preset extension module is called, and the configuration file of the upstream service in the memory of the current server is overwritten by the configuration update file.
7. The method according to claim 6, characterized in that The method further includes: backing up the configuration update file of the upstream service using a preset storage module according to a preset storage rule.
8. The method according to claim 4, characterized in that The method further comprises: Receive a configuration rollback request; According to the configuration rollback request, a backup of the configuration file of the requested upstream service is obtained by using a preset storage module; Returns a backup of the configuration file for the upstream service.
9. The method according to claim 8, characterized in that The configuration rollback request carries a timestamp corresponding to the backup of the configuration file of the requested upstream service.
10. The method according to claim 9, characterized in that According to the configuration rollback request, a backup of the configuration file of the requested upstream service is obtained by using a preset storage module, including: According to the timestamp carried by the configuration rollback request, query the data of the list data structure in the preset storage module to determine the path carrying the same timestamp as the target path; According to the target path, a backup of the configuration file of the requested upstream service is obtained.
11. A data processing device for a target cluster, characterized in that: include: A first acquisition module is used to acquire a configuration update request for an upstream service of a target cluster; wherein the configuration update request for the upstream service carries configuration update information of the upstream service; A backup module, used to respond to the configuration update request of the upstream service and back up the current configuration file of the upstream service using a preset storage module according to a preset storage rule; A generation module, used to generate a configuration update file for the upstream service according to the configuration update information of the upstream service; A second acquisition module, used to acquire a server list of a target cluster from the preset storage module; An update module is used to call a preset data interface of an extension module according to a server list of the target cluster, and update the configuration files of the upstream services of multiple servers in the target cluster respectively by using the configuration update file of the upstream service according to the preset update rules; wherein the preset extension module interface includes: an API of ngx_http_dyups_module; The backup module is specifically used to call the data interface of the preset extension module to store the full data of the current configuration file of the upstream service as the backup of the configuration file of the upstream service, and obtain the corresponding storage path and timestamp; in the preset storage module, the list header of the list data structure is used to store the storage path with a timestamp corresponding to the backup of the configuration file of the upstream service to meet user needs and support configuration rollback and historical configuration query; Among them, in the preset storage module, a set data structure is also used to store data used when managing the configuration of the upstream service of the server of the target cluster; the data includes: a server list of the target cluster, a list of upstream services of the target cluster, and backend server configuration information in the designated upstream service of the target cluster; Among them, the update module is specifically used to determine the dependency relationship between each server in the target cluster according to the server list of the target cluster; determine the server level to which each server belongs, and the priority between different server levels according to the dependency relationship; call the data interface of the preset extension module, and update the configuration files of the upstream services of the servers in each server level in sequence according to the priority.
12. A server, characterized in that: The invention comprises a processor and a memory for storing instructions executable by the processor, wherein the steps of the method according to any one of claims 1 to 10 are implemented when the processor executes the instructions.
13. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Nginx server-based configuration method and device, computer equipment and storage medium
CN108829459A
