Dynamic detection, merging and loading method for cluster configuration
Technical Field
The invention relates to the field of data processing cluster management, in particular to a dynamic detection, merging and loading method for cluster configuration.
Background
With the rapid development and popularization of computers and information technologies, the scale of industrial application systems is rapidly expanded, and data generated by industrial application is explosively increased. The concept of big data has been proposed. With the release of MapReduce and GoogleFile System (GFS), Google, big data is no longer used to describe a large amount of data, but also covers the speed of processing data. Big data processing is a computing model that provides dynamically scalable virtualized resources in a service-like manner over the Internet. Cluster management is an essential part of this computing model.
The existing distributed cluster has the following defects in management:
1. in the cluster management process, for modification of a certain configuration, the same modification needs to be made to each node of the cluster. It is easy to modify only part of the nodes due to errors or unfairness to the system, resulting in inconsistent system configuration state.
2. In the configuration modification process, the cluster needs to be restarted to enable the configuration to be effective, so that part of tasks are repeatedly calculated due to the restarting of the nodes, the calculation resources are wasted, and the efficiency is reduced.
3. Most of the cases are directly modifying the configuration file in a text editing mode, and the possibility of human errors is further increased.
4. Some errors due to incorrect configuration are difficult to trace back.
Disclosure of Invention
The present invention is to solve the above technical problem, and aims to provide a method for dynamically detecting, merging and loading cluster configuration.
The invention is realized by the following technical scheme:
a cluster configuration dynamic detection merging loading method comprises the following steps:
step 1, managing cluster configuration through a configuration management client;
step 2, the configuration management server receives the configuration modification request of the configuration management client and writes the configuration into the configuration management center according to the specified format;
step 3, the configuration detection module monitors cluster configuration nodes of the configuration management center in real time; when the configuration detection module detects that the content of the node changes, the cluster synchronizes the new configuration to the local and updates the state of the corresponding node;
step 4, the master node cluster configuration state maintenance module acquires the configuration state of each working node from each working node of the cluster; the configuration state of the working node comprises a configuration version number, a configuration applied state and a configuration synchronous unapplied state of the node; when each working node is started or updated, each working node registers the state of the working node to the main node;
step 5, the heavy-load module is positioned on each node; when the heavy-load module is positioned on the main node of the cluster, executing the step 6; when the heavy-load module is positioned on the working node of the cluster, executing the step 7;
step 6, when the reloading module is positioned at the main node, the reloading module checks the state of the corresponding working node before distributing the task to the working node, and if the configuration of the corresponding working node is updated and the configuration is applied, the reloading module distributes the task to the corresponding working node;
step 7, when the heavy-load module is positioned at the working node,
the reloading module checks whether the configuration version number of the corresponding working node is latest, and if the configuration version number of the corresponding working node is not latest, the step 3 is executed;
if the configuration version number of the corresponding working node is latest, the reloading module checks whether the corresponding working node is in a configuration synchronization non-application state, and if the corresponding working node is in the configuration synchronization non-application state, the reloading module informs the main node that the corresponding working node refuses to accept a new task;
if the corresponding worker node is in the configuration applied state, the reload module assigns a task to the corresponding worker node.
The invention provides version management and logs for all configurations, and any version configuration can be applied in the maintenance process; when the cluster configuration file is dynamically detected and loaded, the currently executed task is ensured not to be interrupted; providing a uniform configuration modification entrance, and adding validity check to the modified configuration; and the configuration management flow control and the configuration are combined for application, so that the cluster is not frequently restarted due to configuration modification.
Further, the step 1 of managing the cluster configuration by the configuration management client includes modifying the cluster configuration, adding validity check and authority control to each configuration item input, viewing all historical versions and related information of the configuration application, and merging the configuration application of any version into any cluster state.
Further, the configuration management server in step 2 has a flow control function.
Further, the flow control function includes discarding unreasonable configuration management client requests.
Further, the nodes in step 3 include a master node and a worker node, wherein the configuration detection module is located on each node of the cluster.
Further, the configuration detection module in step 3 monitors the cluster configuration nodes of the configuration management center in real time by using the API interface.
Further, the master node cluster configuration state maintenance module in step 4 is located in a master node of the cluster.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the invention uses the configuration management client to submit the relevant configuration parameters to the configuration management center. The client has the functions of validity detection and authority control, and the configuration is ensured to be correctly modified;
2. the invention utilizes the monitoring mechanism of the configuration management middle body, and each node of the cluster detects the change of the configuration in real time and synchronizes to the local. Each node determines the time for updating the configuration according to the condition of each load, combines all the configuration items with update or conflict during updating, and submits the completion state of the configuration update to the main node. The main node performs task scheduling and resource allocation according to the configuration update state table;
3. the configuration management client side of the invention provides a configuration history backtracking function, and can check all history configuration applications and related information thereof of any node of the cluster, including configuration application date, configuration effective time, configuration application cluster state and the like. The configuration of any cluster state of any version can be merged and applied to the current cluster state through the management client.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a flow chart of dynamic probing and loading for configuration of a working node according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Examples
As shown in fig. 1, a method for dynamic probing, merging and loading of cluster configuration includes:
step 1, managing cluster configuration through a configuration management client; the configuration management client side in the step 1 manages the cluster configuration, and comprises the steps of modifying the cluster configuration, adding validity check and authority control to each configuration item input, checking all historical versions and related information of the configuration application, and merging the configuration application of any version into any cluster state.
The cluster configuration is managed through the configuration management client, the cluster configuration can only be modified through the configuration management client, meanwhile, the validity check and the authority control are added for the input of each configuration item, and the validity of the configuration is greatly guaranteed; meanwhile, all historical versions and related information of the configuration application can be checked, and the configuration application of any version can be merged into any cluster state.
Step 2, the configuration management server receives the configuration modification request of the configuration management client and writes the configuration into the configuration management center according to the specified format; the configuration management server side in the step 2 has a flow control function.
The flow control function includes discarding unreasonable configuration management client requests.
The configuration management server receives the client configuration modification request and writes the configuration into the configuration management center according to the specified format; meanwhile, the flow control function is added, unreasonable client requests are abandoned, and the situation that the cluster is frequently restarted or even paralyzed due to flow attack and other abnormalities is avoided.
Step 3, the configuration detection module monitors cluster configuration nodes of the configuration management center in real time; when the configuration detection module detects that the content of the node changes, the cluster synchronizes the new configuration to the local and updates the state of the corresponding node; the nodes in step 3 include a master node and a working node, wherein the configuration detection module is located on each node of the cluster. And 3, the configuration detection module monitors the cluster configuration nodes of the configuration management center in real time by using the API interface.
Step 4, the master node cluster configuration state maintenance module acquires the configuration state of each working node from each working node of the cluster; the configuration state of the working node comprises a configuration version number of the node, a configuration applied state and a configuration synchronous unapplied state, and as shown in table 1, the NodeId is used as a unique identifier of each node; version is used as the configuration Version number of each node, the Version number must be up-to-date, and the configuration of the node is valid; the State is used as the configuration application State of each node, and is further divided into an Applied State and a synchronized State, wherein the Applied State: the configuration is applied, and the node can accept a new task; synced: the node is synchronously configured to the local, but is not applied yet; when each working node is started or updated, each working node registers the state of the working node to the main node; and 4, the master node cluster configuration state maintenance module in the step 4 is positioned in the master nodes of the cluster.
TABLE 1
Step 5, the heavy-load module is positioned on each node; when the heavy-load module is positioned on the main node of the cluster, executing the step 6; when the heavy-load module is positioned on the working node of the cluster, executing the step 7;
step 6, when the reloading module is positioned at the main node, the reloading module checks the state of the corresponding working node before distributing the task to the working node, and if the configuration of the corresponding working node is updated and the configuration is applied, the reloading module distributes the task to the corresponding working node;
step 7, when the heavy-load module is positioned at the working node,
the reloading module checks whether the configuration Version number of the corresponding working node is latest, namely whether Version is latest, and if the configuration Version number of the corresponding working node is not latest, the step 3 is executed;
if the configuration version number of the corresponding working node is latest, the reloading module checks whether the corresponding working node is in a configuration synchronization non-application state, namely Synced, and if the corresponding working node is in the configuration synchronization non-application state, the reloading module informs the main node that the corresponding working node refuses to accept a new task; and after all tasks of the corresponding node are completed, applying the new configuration, modifying the state to be Applied after the application is completed, and informing the main node.
If the corresponding working node is in the configuration applied state, namely Synced, the reload module allocates a task to the corresponding working node.
The invention avoids the situation that the cluster configuration is inconsistent because maintenance personnel are not familiar with the cluster or because of human error, and the client checks the validity of the parameters of the configuration items to ensure that all the configurations are correct and effective; the cluster configuration is managed by using a configuration management center, so that the consistency and the real-time performance of the configuration are ensured; the reloading module based on the node load state ensures that the new configuration can be correctly applied to all new tasks and the normal execution of the existing tasks is not influenced. The accuracy is ensured, and meanwhile, the resource utilization rate of the cluster is improved.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.