Cluster parameter configuration method, device, electronic device and readable storage medium
By monitoring and configuring cluster parameter sets, flexible management of cluster nodes is achieved, which solves the problem of high complexity of traditional cluster management and operation and maintenance, improves automation and flexibility, and improves operation and maintenance efficiency.
Patent Information
- Application Number
- CN202111248144.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-10-26
AI Technical Summary
Traditional cluster management requires manual operations on physical machines or virtual machines, with high operation and maintenance complexity and low automation. In particular, there is insufficient flexibility in middleware capacity changes and data maintenance.
Provides a cluster parameter configuration method that monitors pre-built cluster parameter sets, configures nodes according to changes, including restarting, creating or deleting nodes, and uses management task sets and status management sets to update instance status to achieve individual Flexible configuration of instances reduces interference to other nodes.
It improves the flexibility and automation of node configuration, reduces the risk of operation and maintenance errors, enables flexible expansion and contraction of middleware clusters and data migration, and improves operation and maintenance efficiency.
Smart Images

Figure CN114124700B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cluster management, and in particular to a cluster parameter configuration method, device, electronic device and readable storage medium. Background Art
[0002] Traditional cluster management involves deploying, changing, and maintaining middleware nodes on physical or virtual machines, which requires manual operations by operation and maintenance personnel on the corresponding hosts. This method is primitive, with high operation and maintenance complexity and a high risk of error. At the same time, the traditional physical machine middleware operation and maintenance method requires resource preparation, solution preparation, and execution change processes for operations such as capacity changes (scaling) and data maintenance of the middleware, and has a low degree of automation.
[0003] In related technologies, containerized deployment enables users to enjoy the convenience of containerized orchestration platforms (such as Kubernetes) for dynamic management of containers and flexible expansion and contraction, thus improving deployment and operation efficiency. At the same time, containerization facilitates standardized management of middleware capacity and standardized operation and maintenance capabilities, which is the future development direction of middleware operation and maintenance deployment. Summary of the invention
[0004] In order to solve the above problems, the present application provides a parameter configuration method, device, electronic device and readable storage medium, which can change a single instance, thereby realizing individual configuration of nodes in the cluster, improving the flexibility of node configuration, and reducing interference to other nodes.
[0005] To solve the above technical problems, a technical solution adopted in the present application is: to provide a cluster parameter configuration method, the method comprising: monitoring a pre-built cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and the configuration parameters corresponding to each instance; according to the changes in the cluster parameter set, the nodes of the cluster are configured accordingly; wherein the nodes are used to run the instances.
[0006] Among them, according to the changes of the cluster parameter set, the nodes of the cluster are configured accordingly, including: according to the changes of the configuration parameters of the target instance in the cluster parameter set, the corresponding target task is called from the pre-built management task set, so as to use the target task to configure the target node corresponding to the target instance in the cluster accordingly.
[0007] The method further includes: updating the corresponding target instance state in the pre-built state management set according to the configuration of the target node; wherein the state management set is used to represent the instance state of the cluster; and starting and stopping the target task according to the update of the target instance state.
[0008] Among them, monitoring the pre-built cluster parameter set includes: using the service interface to monitor the cluster parameter set to obtain changes in the parameters in the cluster parameter set; the method also includes: using the service interface to monitor the management task set to obtain the execution status of the tasks in the management task set.
[0009] Among them, according to the changes in the cluster parameter set, the nodes of the cluster are configured accordingly, including: in response to the change of the configuration parameters of the target instance in the cluster parameter set, the target node corresponding to the target instance in the cluster is restarted; and the restarted target node is configured using the configuration parameters of the changed target instance.
[0010] Among them, according to the changes in the cluster parameter set, the nodes of the cluster are configured accordingly, including: in response to the configuration parameters of the newly added target instance in the cluster parameter set, a target node corresponding to the target instance is created in the cluster; and the data portion of the previous node of the target node is migrated to the target node.
[0011] According to the change of the cluster parameter set, the nodes of the cluster are configured accordingly, including: in response to deleting the configuration parameters of the target instance in the cluster parameter set, deleting the target node corresponding to the target instance in the cluster.
[0012] The method further includes: updating the state of the target instance according to the configuration of the target node; and in response to the state of the target instance being a configuration failure, configuring the target node again in the next change processing iteration.
[0013] To solve the above technical problems, another technical solution adopted in the present application is: to provide a cluster parameter configuration device, which includes: a cluster parameter module, used to construct a cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and the configuration parameters corresponding to each instance; a monitoring module, used to monitor the cluster parameter set; a processing module, used to configure the nodes of the cluster accordingly according to the changes of the cluster parameter set; wherein the nodes are used to run the instances.
[0014] Among them, the cluster management device also includes: a management task module, used to construct a management task set; a processing module is used to call the corresponding target task from the management task set according to the change of the configuration parameters of the target instance in the cluster parameter set, so as to use the target task to perform corresponding configuration on the target node corresponding to the target instance in the cluster.
[0015] Among them, the cluster management device also includes: a state management module, used to construct a state management set; wherein the state management set is used to represent the instance state of the cluster; the processing module is also used to update the corresponding target instance state in the state management set according to the configuration of the target node; and according to the update of the target instance state, start and stop operations on the target task.
[0016] Among them, the monitoring module is a service interface; the service interface is used to monitor the cluster parameter set to obtain changes in the parameters in the cluster parameter set; the service interface is also used to monitor the management task set to obtain the execution status of the tasks in the management task set.
[0017] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, which includes a processor and a memory coupled to the processor, the memory stores a computer program, and the processor is used to execute the computer program to implement the above method.
[0018] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it implements the above method.
[0019] The beneficial effect of the embodiment of the present application is: different from the prior art, the parameter configuration method of the cluster provided by the present application includes: monitoring a pre-built cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and the configuration parameters corresponding to each instance; according to the change of the cluster parameter set, the nodes of the cluster are configured accordingly; wherein the nodes are used to run the instances. In the above manner, by using the instances and configuration parameters in the customized cluster parameter set, a single instance can be changed, thereby realizing the individual configuration of the nodes in the cluster, improving the flexibility of the node configuration, and reducing the interference to other nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0021] Figure 1 It is a flow chart of an embodiment of a cluster parameter configuration method provided by the present application;
[0022] Figure 2 It is a flowchart of an embodiment of step 13 provided by the present application;
[0023] Figure 3 is a flowchart of another embodiment of step 13 provided by the present application;
[0024] Figure 4 It is a flowchart of another embodiment of the cluster parameter configuration method provided by the present application;
[0025] Figure 5 It is a flowchart of another embodiment of the cluster parameter configuration method provided by the present application;
[0026] Figure 6 It is a flowchart of another embodiment of the cluster parameter configuration method provided by the present application;
[0027] Figure 7 It is a flowchart of another embodiment of the cluster parameter configuration method provided by the present application;
[0028] Figure 8 It is a structural diagram of an embodiment of a cluster parameter configuration device provided by the present application;
[0029] Fig. 9 It is a structural diagram of another embodiment of the cluster parameter configuration device provided by the present application;
[0030] Fig.10 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;
[0031] Fig.11 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0032] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0033] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0034] There are several types of cluster management in related technologies:
[0035] 1. Deployment using native kubernetes yaml description file.
[0036] Kubernetes abstracts various resource description objects. Each object corresponds to a different Kubernetes workload (such as Deployment, Job, Statefulset and other Kubernetes built-in workloads) or other resource abstractions (such as configmap, secret). By submitting yaml description files, the deployment of related workloads and the creation of resources are submitted, and finally the deployment and update of the upper-level middleware are completed.
[0037] 2. Packaging and deployment method based on helm for kubernetes.
[0038] The native kubernetes yaml description file submission deployment method requires the deployer to assemble various yaml resource descriptions and submit them to kubernetes. The Helm deployment method provides a deployment template set (called a chart) by packaging various resource description file templates, and submits the deployment by specifying template parameters. Each deployment only requires specifying the chart and parameters to complete the deployment.
[0039] 3. Customized workloads based on Kubernetes operator support the deployment of specific middleware.
[0040] Although Kubernetes has built-in workloads such as Deployment and Statefulset to meet the deployment of general stateless applications and simple stateful applications, the containerized deployment of middleware has more complex state management requirements than general applications, and the built-in Statefulset is difficult to meet the requirements of containerized deployment of middleware. Kubernetes provides an operator method to support personalized workload requirements by defining new workloads and resource types (CRDs).
[0041] The disadvantage is that middleware cluster deployment has the following characteristics:
[0042] 1. Stateful. Each cluster node of the middleware often has different roles, such as the master node and data node of elasticsearch. Secondly, the middleware cluster nodes will save the corresponding node data, so they are also stateful.
[0043] 2. Middleware cluster changes require more complex operation and maintenance management.
[0044] The built-in stateful workload Statefulset provides independent storage support for each node, but its support for independent node-level changes is weak. It is not possible to perform configuration changes and updates on a single instance, and it is impossible to control the pause in the rolling release of multiple nodes. It also limits the order of node rolling. It also does not support performing cluster-wide operations at various times when changing nodes.
[0045] Based on this, the present application solves at least one of the above-mentioned problems by constructing a cluster parameter set to define at least one instance of the cluster and the configuration parameters corresponding to each instance; and then according to the change of the cluster parameter set, the nodes of the cluster are configured accordingly. Please refer to any of the following embodiments for details.
[0046] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a cluster parameter configuration method provided by the present application. The method includes:
[0047] Step 11: Monitor a pre-built cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each instance.
[0048] The cluster can be a MySQL cluster, a Kafka cluster, a server cluster, etc.
[0049] In this embodiment, each instance in the cluster parameter set can be configured individually, such as adding an instance in the cluster parameter set, deleting an instance in the cluster parameter set, and modifying an instance in the cluster parameter set.
[0050] For example, after a cluster parameter set is constructed, the cluster parameter set includes instance A, instance B, and instance C. The user can delete or modify any instance among instance A, instance B, and instance C. In an application scenario, the user can add instance D to the cluster parameter set.
[0051] In this embodiment, the service interface may be used to monitor changes in instances in the cluster parameter set.
[0052] In other embodiments, a monitoring program may be set in the cluster parameter set to actively generate change status information when the cluster parameter set changes, so as to facilitate subsequent configuration based on the change information. When the cluster parameter set does not change, the monitoring program may generate corresponding status information at time intervals.
[0053] Step 12: According to the changes in the cluster parameter set, configure the nodes of the cluster accordingly; the nodes are used to run the instances.
[0054] In this embodiment, the change of the cluster parameter set may be the deletion of any instance in the cluster parameter set, the modification of configuration parameters, or the addition of an instance in the cluster parameter set.
[0055] In some embodiments, see Figure 2 , step 12 can be the following process:
[0056] Step 21: In response to a change in a configuration parameter of a target instance in a cluster parameter set, restarting a target node in the cluster corresponding to the target instance.
[0057] Step 22: Use the changed configuration parameters of the target instance to configure the restarted target node.
[0058] In an application scenario, the cluster parameter set includes instance A, instance B, and instance C. Instance A corresponds to node 1, instance B corresponds to node 2, and instance C corresponds to node 3. After the user modifies the configuration parameters of instance A in the cluster parameter set, if it is detected that the configuration parameters of instance A have changed, node 1 is restarted, and node 1 is configured using the changed configuration parameters. For example, if the configuration parameter is to change the IP address (Internet Protocol Address) of node 1, the IP address of node 1 is modified to the changed IP address. For another example, if the configuration parameter is to change the connection port of node 1, the connection port of node 1 is modified to the changed connection port.
[0059] In some embodiments, see Figure 3 , step 12 can be the following process:
[0060] Step 31: In response to the configuration parameters of the newly added target instance in the cluster parameter set, a target node corresponding to the target instance is created in the cluster.
[0061] Step 32: Migrate the data portion of the previous node of the target node to the target node.
[0062] In an application scenario, the cluster parameter set includes instance A, instance B, and instance C. Instance A corresponds to node 1, instance B corresponds to node 2, and instance C corresponds to node 3. The user adds instance D and the configuration parameters corresponding to instance D to the cluster parameter set. When the cluster parameter set detects the addition of instance D, a node 4 corresponding to instance D is created in the cluster, and node 4 is configured using the configuration parameters. In addition, part of the data of node 3 is migrated to node 4, so that node 4 participates in the work tasks in the cluster, that is, the data migrated in node 3 is data that enables node 4 to participate in the work tasks in the cluster.
[0063] In some embodiments, step 31 may be to delete a target node corresponding to the target instance in the cluster in response to deleting the configuration parameters of the target instance in the cluster parameter set.
[0064] In an application scenario, the cluster parameter set includes instance A, instance B, instance C, and instance D. Instance A corresponds to node 1, instance B corresponds to node 2, instance C corresponds to node 3, and instance D corresponds to node 4. The user deletes instance D and the configuration parameters corresponding to instance D in the cluster parameter set. If the cluster parameter set detects that instance D has been deleted, node 4 is deleted in the cluster.
[0065] During this process, if there is data in node 4, the data in node 4 is moved to node 3.
[0066] In this embodiment, a pre-built cluster parameter set is monitored; wherein the cluster parameter set is used to define at least one instance of the cluster and the configuration parameters corresponding to each instance; the nodes of the cluster are configured accordingly according to changes in the cluster parameter set; wherein the nodes are used to run instances, and the instances and configuration parameters in the customized cluster parameter set are used to change a single instance, thereby realizing individual configuration of the nodes in the cluster, improving the flexibility of node configuration, and reducing interference with other nodes.
[0067] Through the above method, any node can be changed and updated individually. Each node of the cluster can be configured individually, and the addition and reduction of nodes involves middleware data migration and data redistribution. It is also necessary to perform related actions before and after stopping the node to perform cluster-level data processing.
[0068] See also Figure 4 , Figure 4 1 is a flow chart of another embodiment of the cluster parameter configuration method provided by the present application. The method includes:
[0069] Step 41: Monitor a pre-built cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each instance.
[0070] Step 42: According to the change of the configuration parameters of the target instance in the cluster parameter set, the corresponding target task is called from the pre-built management task set, so as to use the target task to configure the target node corresponding to the target instance in the cluster accordingly.
[0071] Among them, the node is used to run the instance, and the management task set is used to define the external task type and track the execution status of the external task.
[0072] In this embodiment, the management task set is provided with the name of the corresponding task and the URL (uniform resource locator) corresponding to the task.
[0073] In an application scenario, the cluster parameter set includes instance A, instance B, and instance C. Instance A corresponds to node 1, instance B corresponds to node 2, and instance C corresponds to node 3. The user adds instance D and the configuration parameters corresponding to instance D to the cluster parameter set. When the cluster parameter set detects the addition of instance D, the name of the capacity expansion task corresponding to the added instance is determined in the cluster parameter set, and then the corresponding URL is determined in the management task set according to the capacity expansion task name, and then the capacity expansion task is started using the URL to add instance D.
[0074] In an application scenario, the cluster parameter set includes instance A, instance B, instance C, and instance D. Instance A corresponds to node 1, instance B corresponds to node 2, instance C corresponds to node 3, and instance D corresponds to node 4. The user deletes instance D and the configuration parameters corresponding to instance D in the cluster parameter set. When the cluster parameter set detects that instance D is deleted, the name of the scaling-down task corresponding to the deleted instance is determined in the cluster parameter set, and then the corresponding URL is determined in the management task set according to the scaling-down task name, and then the scaling-down task is started using the URL to delete instance D.
[0075] In this embodiment, through the coordination of the management task set and the cluster parameter set, when a change occurs to an instance in the monitoring cluster parameter set, the management task set calls the corresponding target task to use the target task to perform corresponding configuration on the target node corresponding to the target instance in the cluster, and can make changes to a single instance, thereby realizing separate configuration of the nodes in the cluster, improving the flexibility of node configuration, and reducing interference to other nodes.
[0076] In other embodiments, when implementing any of the above embodiments, the following operations may also be performed. Figure 5 , Figure 5 1 is a flow chart of another embodiment of the cluster parameter configuration method provided by the present application. The method also includes:
[0077] Step 51: According to the configuration of the target node, the corresponding target instance state in the pre-built state management set is updated; wherein the state management set is used to represent the instance state of the cluster.
[0078] The instance status can be any of the following: normal operation, changing, failed, waiting for expansion, expanding, expansion failure, expansion success, waiting for reduction, shrinking, shrinking failure, and shrinking success. The specific status changes according to the actual status of the instance.
[0079] The instance state in the state management set is associated with the instance in the cluster parameter set and the instance configuration parameters. When the configuration parameters of the instance in the cluster parameter set change, the state of the corresponding instance in the state management set changes, for example, from normal operation to changing. After the change is successful, the state changes to normal operation. When the change fails, the state changes to failure.
[0080] For example, from the newly added instance in the cluster parameter set, when a new node is pulled up in the cluster, the instance state is established for the new node in the state management set. At this time, the instance state of the new node is waiting for expansion. If the new node expansion starts, the instance state of the new node is expanding. If the expansion is successful, the instance state is expansion success. If the expansion fails, the instance state is expansion failure. After the expansion fails, you can wait for the next expansion, and then change the instance state to waiting for expansion.
[0081] Step 52: Start and stop the target task according to the update status of the target instance.
[0082] It is understandable that when the state is updated, different tasks will be executed, and then the tasks will be started and stopped. For example, when the state of the target instance is updated, the target task E needs to be executed, and the target task E is started to perform the corresponding operation on the target instance. After the state update is completed, the target task E is stopped.
[0083] In other embodiments, when implementing any of the above embodiments, the following operations may also be performed. Figure 6 , Figure 6 1 is a flow chart of another embodiment of the cluster parameter configuration method provided by the present application. The method also includes:
[0084] Step 61: Use the service interface to monitor the cluster parameter set to obtain changes in the parameters in the cluster parameter set.
[0085] Step 62: Use the service interface to monitor the management task set to obtain the execution status of the tasks in the management task set.
[0086] Step 61 and step 62 may be performed simultaneously, that is, the service interface may monitor changes of instances in the cluster data set and monitor execution status of tasks in the management task set simultaneously.
[0087] Step 63: Based on the changes in the cluster parameter set, the nodes of the cluster are configured accordingly, and based on the changes in the configuration parameters of the target instance in the cluster parameter set, the corresponding target task is called from the management task set to use the target task to configure the target node corresponding to the target instance in the cluster accordingly.
[0088] In other embodiments, when implementing any of the above embodiments, the following operations may also be performed. Figure 7 , Figure 7 1 is a flow chart of another embodiment of the cluster parameter configuration method provided by the present application. The method also includes:
[0089] Step 71: Update the state of the target instance according to the configuration of the target node.
[0090] In this embodiment, an external cluster management component may be used to configure the target node according to the configuration parameters of the corresponding instance in the cluster parameter set, and then the state of the target instance in the state management set may be updated.
[0091] Step 72: In response to the state of the target instance being configuration failure, the target node is configured again in the next change processing iteration.
[0092] If the current update fails, the configuration will be performed again in the next change, and the cycle will be repeated until the configuration is successful.
[0093] See also Figure 8 , Figure 8 1 is a schematic diagram of a cluster parameter configuration device according to an embodiment of the present application. The parameter configuration device 100 comprises: a cluster parameter module 10 , a monitoring module 20 and a processing module 30 .
[0094] The cluster parameter module 10 is used to construct a cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each instance.
[0095] The monitoring module 20 is used to monitor the cluster parameter set.
[0096] The processing module 30 is used to configure the nodes of the cluster accordingly according to the changes of the cluster parameter set; wherein the nodes are used to run the instances.
[0097] In other embodiments, see Fig. 9 The parameter configuration device 100 includes a cluster parameter module 10 , a processing module 30 , a management task module 40 , a state management module 50 and a service interface 60 .
[0098] The management task module 40 is used to construct a management task set.
[0099] The processing module 30 is used to call the corresponding target task from the management task set according to the change of the configuration parameters of the target instance in the cluster parameter set, so as to use the target task to perform corresponding configuration on the target node corresponding to the target instance in the cluster.
[0100] The state management module 50 is used to construct a state management set; wherein the state management set is used to represent the instance state of the cluster.
[0101] The processing module 30 is also used to update the corresponding target instance state in the state management set according to the configuration of the target node.
[0102] The processing module 30 is also used to start and stop the target task according to the update status of the target instance state.
[0103] The service interface 60 is used to monitor the cluster parameter set to obtain the change of the parameters in the cluster parameter set. The service interface 60 can be used as the monitoring module 20.
[0104] The service interface 60 is also used to monitor the management task set to obtain the execution status of the tasks in the management task set.
[0105] The processing module 30 is further configured to restart the target node corresponding to the target instance in the cluster in response to a change in the configuration parameters of the target instance in the cluster parameter set; and configure the restarted target node using the changed configuration parameters of the target instance.
[0106] The processing module 30 is further configured to create a target node corresponding to the target instance in the cluster in response to the configuration parameters of the newly added target instance in the cluster parameter set; and migrate the data portion of the previous node of the target node to the target node.
[0107] The processing module 30 is further configured to delete a target node corresponding to the target instance in the cluster in response to deleting the configuration parameters of the target instance in the cluster parameter set.
[0108] The state management module 50 is also used to update the state of the target instance according to the configuration of the target node.
[0109] The processing module 30 is further configured to configure the target node again in the next change processing iteration in response to the state of the target instance being configuration failure.
[0110] In an application scenario, the parameter configuration device 100 includes a cluster parameter module 10 , a monitoring module 20 , a processing module 30 , a management task module 40 , a state management module 50 and a service interface 60 .
[0111] The cluster parameter module 10 is used to define the middleware cluster structure and deployment-related resources (such as images), configurations, etc.
[0112] The cluster parameter module 10 does not define instances in a Statefulset manner, but defines multiple instances. Multiple instances can be set separately to meet the needs of changing and operating separate instances of the middleware.
[0113] Since the instance definitions are separate, each instance can define its own independent configuration, which also realizes the need for individual node configuration changes during the middleware deployment and operation process.
[0114] Since each instance is defined separately, in addition to the overall state management of the cluster, each instance requires separate state management. At the same time, it is necessary to coordinate the instance state with the overall state of the cluster. Therefore, state management can be performed through the state management module 50.
[0115] In the daily operation and maintenance of middleware, each instance status has several intuitive states, including normal operation, changing, and normal operation / failure. The changing state of Statefulset in related technologies does not focus on the work that needs to be processed at the entire load business level, which is a strong demand in middleware changes. In response to middleware requirements, this application subdivides instance status, such as waiting for expansion, expanding, expansion failure, expansion success, waiting for reduction, shrinking, shrinking failure, shrinking success, etc.
[0116] During the entire life cycle of an instance, from the perspective of middleware operations, there are only two types of changes involving the node itself: expansion and reduction. During expansion, new instances are added, while during reduction, fewer instances are reduced. For these two processes, the middleware cluster level needs to handle the data processing related to expansion and reduction, and these processing tasks are different for each type of middleware, and often require calling external platform processing tasks to complete the corresponding work.
[0117] Therefore, it can be implemented by using the management task module 40. Therefore, the second resource type is abstracted.
[0118] The task management module 40 is used to define the external task type and track the external task execution status.
[0119] The processing module 30 coordinates the start and stop of external tasks and status checks according to the instance change state machine, triggers the instance state flow, and finally completes the instance change process.
[0120] For external tasks, you can use the middleware management modules or components of an external middleware management platform to complete data migration, preparation, structural adjustment and other tasks in the expansion and contraction process. The specific work depends on different middleware types or architectural requirements.
[0121] Taking Kafka expansion or reduction as an example, after Kafka expands the node, the topic-related shards will not automatically migrate to the new node. In the deployment method of related technologies, expansion will only pull up new nodes, and the new nodes will not carry shards. When reducing capacity, the node is directly stopped, but the data on the node is not migrated, which will directly lead to a reduction in topic copies and affect the availability of the middleware cluster.
[0122] In addition, if during the operation and maintenance process, it is necessary to adjust the parameters of a node in the cluster, such as adjusting the JVM parameters, this node may be any one in the cluster, but other nodes will not be adjusted temporarily. The relevant technology cannot meet such flexibility requirements.
[0123] The present application can solve the problem that any node cannot be changed and maintained independently during the daily operation and maintenance of containerized middleware through the above solution of cluster parameter module 10. It can also solve the problem that cluster-related data processing and execution during the online and offline process of any node in the operation and maintenance process cannot be conveniently integrated into the container life cycle.
[0124] For example, a Kafka cluster has three instances and has been deployed normally.
[0125] For example, taking the broker instance as an example, the cluster parameter set in the cluster parameter module 10 is configured as follows:
[0126] {spec:
[0127] brokers:
[0128] broker1:
[0129] config:content1
[0130] broker2:
[0131] config:content2
[0132] broker3:
[0133] config:content3
[0134] upscaleJobTrack:kafkaUpScale
[0135] downSacleJobTrack:kafkaDownScale}.
[0136] The management task set in the management task module 40 is configured as follows:
[0137] {spec:
[0138] name: kafkaUpScale
[0139] taskUrl: http: / / mwplatform / kafkaUpscal
[0140] spec:
[0141] name: kafkaDownScale
[0142] taskUrl: http: / / mwplatform / kafkaDownscal}.
[0143] When the cluster parameter module 10 performs any instance change, based on the definition of the cluster parameter module 10 and the management task module 40, the configuration parameters of broker2 are changed from config:content2 to config:content21, and the configuration parameters of other nodes remain unchanged. Submit to the service interface 60.
[0144] After the processing module 30 detects the configuration change of broker 2 according to the service interface 60, it restarts node 2 and applies the new configuration to complete the configuration change of node 2. Meanwhile, nodes 1 and 3 are not affected.
[0145] Take the expansion of nodes as an example: based on the definitions of cluster parameter module 10 and management task module 40, a new broker4 configuration is added.
[0146] The changes of the cluster parameter set in the cluster parameter module 10 are as follows:
[0147] {spec:
[0148] brokers:
[0149] broker1:
[0150] config:content1
[0151] broker2:
[0152] config:content2
[0153] broker3:
[0154] config:content3
[0155] broker4:
[0156] config:content4
[0157] upscaleJobTrack:kafkaUpScale
[0158] downSacleJobTrack:kafkaDownScale}.
[0159] After the processing module 30 detects the change of the cluster parameter set definition according to the service interface 60, it first pulls up the new node 4 according to the state flow relationship. The state of the node 4 in the state management module 50 is to be expanded.
[0160] In the next reconcile process, processing module 30 executes "call external expansion task logic" according to the state of node 4 to be expanded, and finally calls the external upScale task according to the upscaleJobTrack defined in the cluster parameter set and the associated kafkaUpScale object, performs kafka shard rebalancing, and migrates part of the shard data of node 3 to node 4, so as to achieve the purpose of expansion and uniform data distribution. At the same time, processing module 30 tracks the task execution status, such as success, failure, and processing, through management task module 40.
[0161] If the external upScale task is executed successfully, the state of node 4 is changed to expansion success, and the expansion is completed; if it fails, the state of node 4 is changed to expansion failure, and the execution is retried in the next change processing iteration of processing module 30.
[0162] The above parameter configuration device 100 can be built based on kubernetes.
[0163] See also Fig.10 , Fig.10 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The electronic device 200 includes a processor 201 and a memory 202 coupled to the processor 201. The memory 202 stores a computer program. The processor 201 is used to execute the computer program to implement the following method:
[0164] Constructing a cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each instance; monitoring the cluster parameter set; and configuring the nodes of the cluster accordingly according to changes in the cluster parameter set; wherein the nodes are used to run the instances.
[0165] It can be understood that the processor 201 is also used to execute a computer program to implement a method in any of the above embodiments. Please refer to any of the above technical solutions for details, which will not be elaborated here.
[0166] See also Fig.11 , Fig.11 300 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 300 stores a computer program 301. When the computer program 301 is executed by a processor, the following method is implemented:
[0167] Constructing a cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each instance; monitoring the cluster parameter set; and configuring the nodes of the cluster accordingly according to changes in the cluster parameter set; wherein the nodes are used to run the instances.
[0168] It can be understood that when the computer program 301 is executed by the processor, it is also used to implement the method of any of the above embodiments. Please refer to any of the above technical solutions for details, which will not be repeated here.
[0169] In summary, when this application is applied to the kubernetes operation and maintenance scenario, the external cluster data processing actions are integrated through the separate node control and node change process, while achieving the convenience of the traditional deployment mode, independent control nodes and related tasks for independent operation and maintenance. By abstracting the commonality of various middleware operation and maintenance requirements, a general kubernetes workload suitable for middleware deployment and operation and maintenance is realized, providing more general support for middleware container deployment and operation and maintenance support.
[0170] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and 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.
[0171] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0172] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0173] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made according to the description and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A cluster parameter configuration method, characterized in that: The method comprises: Monitoring a pre-built cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each of the instances, wherein each of the instances in the cluster parameter set can be configured separately; According to the change of the cluster parameter set, the nodes of the cluster are configured accordingly; wherein the nodes are used to run the instances; The configuring the nodes of the cluster accordingly according to the change of the cluster parameter set includes: in response to a change in a configuration parameter of a target instance in the cluster parameter set, restarting a target node in the cluster corresponding to the target instance; The restarted target node is configured using the changed configuration parameters of the target instance.
2. The method according to claim 1, characterized in that The configuring the nodes of the cluster accordingly according to the change of the cluster parameter set includes: According to the change of the configuration parameters of the target instance in the cluster parameter set, the corresponding target task is called from the pre-built management task set, so as to use the target task to perform corresponding configuration on the target node corresponding to the target instance in the cluster.
3. The method according to claim 2, characterized in that The method further comprises: According to the configuration of the target node, the corresponding target instance state in the pre-built state management set is updated; wherein the state management set is used to represent the instance state of the cluster; The target task is started and stopped according to the update status of the target instance.
4. The method according to claim 2, characterized in that: The monitoring pre-built cluster parameter set includes: Using a service interface to monitor the cluster parameter set to obtain changes in parameters in the cluster parameter set; The method further comprises: The management task set is monitored using the service interface to obtain the execution status of the tasks in the management task set.
5. The method according to claim 1, characterized in that The configuring the nodes of the cluster accordingly according to the change of the cluster parameter set includes: In response to the configuration parameters of the newly added target instance in the cluster parameter set, creating a target node corresponding to the target instance in the cluster; Migrate a portion of data of a node preceding the target node to the target node.
6. The method according to claim 1, characterized in that The configuring the nodes of the cluster accordingly according to the change of the cluster parameter set includes: In response to deleting the configuration parameters of the target instance in the cluster parameter set, deleting the target node corresponding to the target instance in the cluster.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: According to the configuration of the target node, the state of the target instance is updated; In response to the state of the target instance being configuration failure, the target node is configured again in the next change processing iteration.
8. A cluster parameter configuration device, characterized in that: The parameter configuration device comprises: A cluster parameter module, used to construct a cluster parameter set; wherein the cluster parameter set is used to define at least one instance of the cluster and configuration parameters corresponding to each of the instances, wherein each of the instances in the cluster parameter set can be configured separately; A monitoring module, used for monitoring the cluster parameter set; A processing module, configured to configure the nodes of the cluster accordingly according to the changes of the cluster parameter set; wherein the nodes are used to run the instances; The processing module is specifically configured to: in response to a change in a configuration parameter of a target instance in the cluster parameter set, restart a target node in the cluster corresponding to the target instance; The restarted target node is configured using the changed configuration parameters of the target instance.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory coupled to the processor, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for intelligently managing database of machine nodes
CN106547861A
Configuration updating method and apparatus
CN107360018A
High-availability cluster system
CN107948017A
Load balancing method and load balancing device of database cluster mirror
CN108400999A
Distributed data access method and system based on multi-task instances
CN111078396A
