Master node determination method and device, server and storage medium

The master node determination method constructed through the random forest model and decision tree obtains cluster node characteristics and task processing effects, solves the problem of insufficient reliability of master node determination in the existing technology, and improves the stability of the cluster and the reliability of the business system. .

CN118747137APending Publication Date: 2024-10-08BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410895791.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

The reliability of the master node determination in the existing technology is insufficient, causing the stability of the cluster's business system to be affected when the master node goes offline.

Method used

The random forest model is used to build a master node determination model through decision trees, and the characteristic information of the cluster nodes is obtained. The new master node is determined based on the real-time status of the node and the task processing effect, thereby improving the rationality and reliability of the master node determination.

Benefits of technology

The most suitable node in the cluster is determined as the new master node through the pre-trained random forest model, which improves the stability of the cluster and the reliability of the business system, and reduces the error rate of master node determination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747137A_ABST
    Figure CN118747137A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a main node determination method and device, a server and a storage medium, and relates to the technical field of computers, and the method comprises the steps: obtaining node features of each node in a cluster; the node features of all the nodes are input into a pre-trained main node determination model, so that the main node determination model determines a main node according to the node features of all the nodes, the main node determination model is obtained through random forest model training, and the main node determination model determines the main node according to the node features of all the nodes. The random forest model is composed of a plurality of decision trees corresponding to each node, and each decision tree is constructed by node features of the corresponding node. According to the technical scheme, after the original main node in the cluster is offline, the main node is re-determined based on the node features of the nodes, the determined main node is more reasonable and reliable, and the stability of the cluster is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a method, device, server and storage medium for determining a master node. Background Art

[0002] In order to improve the high availability of the business system, the business system can be deployed in a cluster. The cluster consists of multiple nodes, including a master node and at least one slave node. When the master node goes offline, a new master node needs to be determined to ensure the operation of the business system.

[0003] In the prior art, the node in the cluster that first discovers that the master node is offline is usually determined as the new master node.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following technical problems in the prior art:

[0005] The reliability of the determined master node is insufficient. Summary of the invention

[0006] The present invention provides a master node determination method, device, server and storage medium to improve the rationality and reliability of master node determination.

[0007] In a first aspect, an embodiment of the present invention provides a method for determining a master node, including:

[0008] Get the node characteristics of each node in the cluster;

[0009] The node features of each of the nodes are input into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each of the nodes, wherein the master node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding node.

[0010] In a second aspect, an embodiment of the present invention further provides a master node determination device, including:

[0011] The acquisition module is used to obtain the node characteristics of each node in the cluster;

[0012] An execution module is used to input the node features of each of the nodes into a pre-trained main node determination model, so that the main node determination model determines the node efficiency of each of the nodes according to the node features of each of the nodes, and determines the main node according to the node efficiency of each of the nodes, wherein the main node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding nodes.

[0013] In a third aspect, an embodiment of the present invention further provides a server, the server comprising:

[0014] one or more processors;

[0015] a storage device for storing one or more programs,

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the master node determination method as described in any one of the first aspects.

[0017] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a master node determination method as described in any one of the first aspects.

[0018] The embodiments of the above invention have the following advantages or beneficial effects:

[0019] The embodiment of the present invention provides a method for determining a master node, comprising: obtaining node features of each node in a cluster; inputting the node features of each node into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each node, wherein the master node determination model is obtained by training a random forest model, the random forest model is composed of a plurality of decision trees corresponding to each node, and each decision tree is constructed by the node features of the corresponding node. In the above technical scheme, when it is determined that the original master node in the cluster is offline, the node features of each node in the cluster are obtained, the node features of the node indicate the real-time status information of the node, the node features of each node in the cluster are obtained by the acquisition rate, and the status monitoring of each node in the cluster is realized, and then, the features of each node can be input into the pre-trained master node determination model, the master node determination model can determine the target task processing effect corresponding to each node based on each decision tree, and determine the master node based on the random forest algorithm and the target task processing effect corresponding to each node, after the original master node in the cluster is offline, the master node is re-determined based on the node features of each node, and the determined master node is more reasonable and reliable, which improves the stability of the cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flowchart of a method for determining a master node provided by an embodiment of the present invention;

[0021] Figure 2 A flowchart of another master node determination method provided by an embodiment of the present invention;

[0022] Figure 3A decision tree corresponding to any node provided in an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of the structure of a master node determination device provided by an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0026] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.

[0027] Figure 1 The present invention provides a flowchart of a master node determination method. The present invention can be applied to situations where it is necessary to determine the master node in a cluster. The method can be executed by a master node determination device, which can be implemented by software and / or hardware. Figure 1 The method specifically comprises the following steps:

[0028] Step 110: Obtain node characteristics of each node in the cluster.

[0029] Among them, the node characteristics can be understood as the real-time status information of the node, which may include at least one of the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where the node is located.

[0030] Specifically, each node in the cluster can be understood as each node in the cluster that is in normal operation. When it is determined that the original master node in the cluster is offline, it is necessary to re-determine a new master node in each node. At this time, the node characteristics of each node in the cluster can be obtained. That is, at least one of the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where each node is located can be obtained.

[0031] In practical applications, uncoupled client technology, raw socket technology and listener technology can be used to obtain the node characteristics of each node in the cluster. For example, a very lightweight scripting technology shell can be used to obtain the node characteristics of each node in the cluster.

[0032] The hardware configuration includes at least one of the processor configuration, memory configuration, bandwidth configuration and disk configuration. The bandwidth information of the server configuration of each node can be queried from the resource management device, that is, the bandwidth configuration of the server of each node. The bandwidth usage of each node can also be determined according to the ratio of the total traffic sent and received by the network card of the server where each node is located and the bandwidth configuration. For example, when the total traffic sent and received by the network card of the server where the node is located is 265KB and the bandwidth configuration is 2M, it can be determined that the bandwidth usage rate = 265 / 2*1024 = 265 / 2048.

[0033] In an embodiment of the present invention, when it is determined that the original master node in the cluster is offline, the node characteristics of each node in the cluster are obtained. The node characteristics of the node indicate the real-time status information of the node. Therefore, the node characteristics of each node in the cluster are obtained by acquiring the acquisition rate to realize the status monitoring of each node in the cluster.

[0034] Step 120: input the node features of each of the nodes into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each of the nodes.

[0035] Among them, the main node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding node.

[0036] The master node determination model can determine the target task processing effect corresponding to each node based on the decision tree corresponding to each node. It can also select from each decision tree based on the random forest algorithm to determine the master node.

[0037] Specifically, the node features of each node are input into the pre-trained master node determination model. The master node determination model can determine the task processing effect corresponding to each node feature of each node based on each decision tree. In order to determine a more accurate task processing effect of each node, the task processing effect corresponding to each node feature of each node can be averaged to obtain the target task processing effect of each node. Furthermore, the master node determination model can determine the master node based on the random forest algorithm and the target task processing effect of each node.

[0038] In practical applications, it is usually necessary to determine the node with the best task processing effect in the cluster as the master node. Therefore, the master node determination model can determine the node corresponding to the optimal target task processing effect as the master node based on the random forest algorithm and the target task processing effect of each node.

[0039] The task processing effect can be reflected by the task processing efficiency or task processing time. The higher the task processing efficiency or the shorter the task processing time, the better the node performance. Therefore, after the master node determination model determines the target task processing effect of each node, the node corresponding to the highest task processing efficiency or the node corresponding to the shortest task processing time can be determined as the master node based on the random forest algorithm.

[0040] In an embodiment of the present invention, after obtaining the node characteristics of each node in the cluster, the characteristics of each node are input into a pre-trained master node determination model. The master node determination model can determine the target task processing effect corresponding to each node based on each decision tree, and determine the master node based on the random forest algorithm and the target task processing effect corresponding to each node. After the original master node in the cluster goes offline, the master node can be re-determined.

[0041] The master node determination method provided by the embodiment of the present invention includes: obtaining the node characteristics of each node in the cluster; inputting the node characteristics of each node into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node characteristics of each node, wherein the master node determination model is obtained by training a random forest model, and the random forest model is composed of a plurality of decision trees corresponding to each node, and each decision tree is constructed by the node characteristics of the corresponding node. In the above technical scheme, when it is determined that the original master node in the cluster is offline, the node characteristics of each node in the cluster are obtained, and the node characteristics of the node indicate the real-time status information of the node. By obtaining the node characteristics of each node in the cluster, the status monitoring of each node in the cluster is realized, and then, each node characteristic can be input into the pre-trained master node determination model, and the master node determination model can determine the target task processing effect corresponding to each node based on each decision tree, and determine the master node based on the random forest algorithm and the target task processing effect corresponding to each node. After the original master node in the cluster is offline, the master node is re-determined based on the node characteristics of each node, and the determined master node is more reasonable and reliable, which improves the stability of the cluster.

[0042] Figure 2 This is a flowchart of another master node determination method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to the situation where the master node in the cluster needs to be determined. Based on the above embodiment, the embodiment of the present invention adds a training process for the master node determination model, and the explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 , the master node determination method provided by the embodiment of the present invention includes:

[0043] Step 210: Obtain a training data set.

[0044] The training data set includes training node features of each of the nodes in the cluster and an actual master node in the cluster.

[0045] The training node characteristics include the task processing effect of the node and at least one of the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where the node is located.

[0046] The task processing effect can be reflected by the task processing efficiency or the task processing time. For example, it can be reflected by the task processing efficiency.

[0047] Specifically, the training node features of each node in the cluster can be obtained at multiple historical moments in the historical time period, and the training node features of each node in the cluster obtained at each historical moment and the actual master node in the cluster at each historical moment are determined as the training data set.

[0048] In practical applications, a very lightweight scripting technology shell can also be used to obtain the training node characteristics of each node in the cluster. In addition, the task processing rate can be determined based on the ratio of the number of requests processed by the node to the number of requests received.

[0049] Of course, after obtaining the training data set, you can establish a data center and data warehouse to uniformly manage the obtained training data set and provide supporting data for model training.

[0050] After obtaining the training data set, the training data set can be sorted to process the training data set into the data set required for model training. The training node features include the task processing efficiency of the node and the hardware configuration, load rate, processor usage rate, memory usage rate, bandwidth usage rate, and disk usage rate of the server where the node is located. By sorting the training node features, the probability of the corresponding task processing rate range can be obtained when the server where the node is located is configured with various hardware configurations as shown in Table 1, and the probability of the corresponding task processing rate range can be obtained when the load rate of the node shown in Table 2 is in each load rate range. The probability of the corresponding task processing rate range can also be obtained when the processor usage rate of the node shown in Table 3 is in each processor usage range, and the probability of the corresponding task processing rate range can also be obtained when the memory usage rate of the node shown in Table 4 is in each memory usage range, and the probability of the corresponding task processing rate range can also be obtained when the bandwidth usage rate of the node shown in Table 5 is in each bandwidth usage range, and the probability of the corresponding task processing rate range can also be obtained when the disk usage rate of the node shown in Table 6 is in each disk usage range.

[0051] Table 1

[0052]

[0053] Table 2

[0054]

[0055] Table 3

[0056]

[0057] Table 4

[0058]

[0059] Table 5

[0060]

[0061] Table 6

[0062]

[0063] In an embodiment of the present invention, the acquisition of a random forest model training data set is achieved.

[0064] Step 220: construct multiple decision trees according to the training node features in the training data set, and construct the random forest model according to the decision trees.

[0065] In one implementation, step 220 may specifically include:

[0066] For each of the training node features in the training data set, a target feature is determined in the training node features based on a preset decision tree algorithm, and the decision tree is constructed according to the target feature and the task processing effect corresponding to each of the target features; and the random forest model is constructed according to the decision tree.

[0067] Further, determining a target feature from the training node features based on a preset decision tree algorithm includes:

[0068] Based on the preset decision tree algorithm, each feature in the training node features is sorted; and according to the decision tree pruning rule, the target feature is determined in the sorted training node features.

[0069] Among them, the preset decision tree algorithm can be ID3, C4.5 or CART. The ID3 algorithm can determine the target feature according to the information gain of each training node feature, and build a decision tree according to the target feature. C4.5 can determine the target feature according to the information gain rate of each training node feature, and build a decision tree according to the target feature. CART can determine the target feature according to the Gini index of each training node feature, and build a decision tree according to the target feature.

[0070] When the preset decision tree algorithm is ID3, the information gain of each feature in the training node feature can be determined first, and then the features can be sorted according to the size of the information gain, and then the top N features can be determined as target features according to the decision tree pruning rules. When the preset decision tree algorithm is C4.5, the information gain rate of each feature in the training node feature can be determined first, and then the features can be sorted according to the size of the information gain rate, and then the top N features can be determined as target features according to the decision tree pruning rules. When the preset decision tree algorithm is CART, the Gini index of each feature in the training node feature can be determined first, and then the features can be sorted according to the size of the Gini index, and then the bottom N features can be determined as target features according to the decision tree pruning rules.

[0071] Where N is determined by the decision tree pruning rule.

[0072] Then, the task processing rate range corresponding to the target feature can be found in Tables 1 to 6, and the decision tree corresponding to the training node feature can be constructed based on the target feature and the task processing rate range corresponding to each target feature. For any node, according to the training node feature of the node, the following can be constructed: Figure 3 After constructing the decision tree corresponding to each node, the decision trees of all nodes can be combined into a random forest to build a random forest model.

[0073] In the embodiment of the present invention, the construction of a random forest model is achieved.

[0074] Step 230: input the training data set into a random forest model, perform model training on the random forest model, and calculate the model accuracy based on the actual master nodes in the cluster and the training master nodes in the cluster output by the model.

[0075] Step 240: Optimize the model according to the model accuracy until the model accuracy meets a preset condition, thereby obtaining the master node determination model.

[0076] Specifically, multiple sets of training node features of each node in the cluster can be used as data, and the actual master nodes corresponding to each set of training node features can be used as labels to input into the random forest model. The random forest model can output the training master nodes in the cluster, and determine the model accuracy based on the actual master nodes and the training master nodes corresponding to each set of training node features. When it is determined that the model accuracy meets the preset conditions, the model at this time is determined as the master node determination model. When it is determined that the model accuracy does not meet the preset conditions, the model can be optimized by adjusting the model parameters, and the model training is continued until the model accuracy meets the preset conditions to obtain the master node determination model.

[0077] Of course, you can also obtain a test data set while obtaining a training data set. In the process of training a random forest model based on the training data set, you can determine the model accuracy based on the test data set. When it is determined that the model accuracy meets the preset conditions, the model trained at this moment is determined as the main node determination model.

[0078] In the embodiment of the present invention, a random forest model is trained by training a training data set to obtain a master node determination model that can determine the master node in the cluster according to the node characteristics of each node in the cluster.

[0079] In actual applications, the master node determination model can be built into the plug-in, and the cluster's master election logic can be replaced based on the plug-in. When it is determined that the original master node in the cluster is offline, the master node can be re-determined based on the master node determination model built into the plug-in. The master node determination model can also be built into the middleware, and the middleware is deployed separately, using the interface protocol for data communication. When it is determined that the original master node in the cluster is offline, the master node can be re-determined based on the master node determination model built into the middleware.

[0080] Step 250: Obtain node characteristics of each node in the cluster.

[0081] As mentioned above, when it is determined that the original master node in the cluster is offline, a very lightweight scripting technology shell can be used to obtain the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where each node in the cluster is located.

[0082] In an embodiment of the present invention, when it is determined that the original master node in the cluster is offline, the node characteristics of each node in the cluster are obtained. The node characteristics of the node indicate the real-time status information of the node. Therefore, the node characteristics of each node in the cluster are obtained by acquiring the acquisition rate to realize the status monitoring of each node in the cluster.

[0083] Step 260: input the node features of each of the nodes into a pre-trained master node determination model, so that the master node determination model determines the task processing effect corresponding to each decision tree according to the node features of each of the nodes, determines the target task processing effect of each of the nodes according to the task processing effect corresponding to each of the decision trees, and determines the master node according to the target task processing effect of each of the nodes.

[0084] Specifically, the node features of each node are input into a pre-trained master node determination model, and the master node determination model can determine the task processing rate range corresponding to each node feature of each node based on each decision tree, and determine the target task processing rate of each node according to the mean of the task processing rate range corresponding to each node feature of each node. Furthermore, the master node determination model can determine the node with the highest target task processing rate as the master node based on the random forest algorithm.

[0085] It should be noted that after the cluster re-determines the master node, the training node features of each node in the cluster and the re-determined master node in the cluster can be added to the training data set to continue to optimize the master node determination model. In addition, in order to make the master node determination model more suitable for different operating systems, programming languages, and operating environments, it can be iteratively trained continuously or periodically during the model operation process, so that the master node determination model is more suitable for its current operating environment.

[0086] In an embodiment of the present invention, after obtaining the node characteristics of each node in the cluster, the characteristics of each node are input into a pre-trained master node determination model. The master node determination model can determine the target task processing rate corresponding to each node based on each decision tree, and determine the node with the highest target task processing rate as the master node based on the random forest algorithm. After the original master node in the cluster goes offline, the master node can be re-determined.

[0087] The master node determination method provided by the embodiment of the present invention includes: obtaining a training data set; constructing multiple decision trees according to the training node features in the training data set, and constructing the random forest model according to the decision trees; inputting the training data set into the random forest model, performing model training on the random forest model, and calculating the model accuracy according to the actual master nodes in the cluster and the training master nodes in the cluster output by the model; optimizing the model according to the model accuracy until the model accuracy meets the preset conditions to obtain the master node determination model; obtaining the node features of each node in the cluster; inputting the node features of each node into the pre-trained master node determination model, so that the master node determination model determines the task processing effect corresponding to each decision tree according to the node features of each node, determines the target task processing effect of each node according to the task processing effect corresponding to each decision tree, and determines the master node according to the target task processing effect of each node. The above technical scheme, when determining that the original master node in the cluster is offline, obtains the node characteristics of each node in the cluster, and the node characteristics of the node indicate the real-time status information of the node. By obtaining the node characteristics of each node in the cluster, the status of each node in the cluster can be monitored. Then, the characteristics of each node can be input into a pre-trained master node determination model. The master node determination model can determine the target task processing effect corresponding to each node based on each decision tree, and determine the master node based on the random forest algorithm and the target task processing effect corresponding to each node. After the original master node in the cluster goes offline, the master node is re-determined based on the node characteristics of each node, thereby reducing the error rate of master node determination, improving the robustness of the cluster, and ensuring the reliability and stability of the business system deployed in the cluster.

[0088] Figure 4 A schematic diagram of the structure of a master node determination device provided in an embodiment of the present invention. The device and the master node determination method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the master node determination device can refer to the embodiment of the above master node determination method.

[0089] The specific structure of the master node determination device is as follows: Figure 4 As shown, including:

[0090] An acquisition module 410 is used to acquire node characteristics of each node in the cluster;

[0091] The execution module 420 is used to input the node features of each of the nodes into a pre-trained main node determination model, so that the main node determination model determines the node efficiency of each of the nodes according to the node features of each of the nodes, and determines the main node according to the node efficiency of each of the nodes, wherein the main node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding nodes.

[0092] In one implementation, the node feature includes at least one of the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where the node is located.

[0093] Based on the above embodiment, the device further includes:

[0094] A training module is used to obtain a training data set, wherein the training data set includes training node features of each node in the cluster and actual master nodes in the cluster; construct multiple decision trees according to the training node features in the training data set, and construct the random forest model according to the decision trees; input the training data set into the random forest model, perform model training on the random forest model, and calculate the model accuracy according to the actual master nodes in the cluster and the training master nodes in the cluster output by the model; optimize the model according to the model accuracy until the model accuracy meets the preset conditions, and obtain the master node determination model.

[0095] In one implementation, multiple decision trees are constructed based on the training node features in the training data set, including:

[0096] For each of the training node features in the training data set, a target feature is determined in the training node features based on a preset decision tree algorithm, and the decision tree is constructed according to the target feature and the task processing effect corresponding to each of the target features.

[0097] Further, determining a target feature from the training node features based on a preset decision tree algorithm includes:

[0098] Based on the preset decision tree algorithm, each feature in the training node features is sorted; and according to the decision tree pruning rule, the target feature is determined in the sorted training node features.

[0099] Based on the above embodiment, the execution module 420 is specifically used for:

[0100] The node features of each of the nodes are input into a pre-trained main node determination model, so that the main node determination model determines the task processing effect corresponding to each decision tree according to the node features of each of the nodes, determines the target task processing effect of each of the nodes according to the task processing effect corresponding to each of the decision trees, determines the main node according to the target task processing effect of each of the nodes, and each of the decision trees is constructed by the node features of the corresponding nodes.

[0101] The master node determination device provided in the embodiment of the present invention can execute the master node determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the master node determination method.

[0102] It is worth noting that in the embodiment of the above-mentioned master node determination device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0103] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present invention. Figure 5 A block diagram of an exemplary server 5 suitable for implementing embodiments of the present invention is shown. Figure 5 The server 5 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0104] like Figure 5 As shown, the server 5 is in the form of a general purpose computing electronic device. The components of the server 5 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0105] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0106] The server 5 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 5, including volatile and non-volatile media, removable and non-removable media.

[0107] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 5 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0108] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0109] The server 5 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the server 5, and / or any device that enables the server 5 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the server 5 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. Figure 5 As shown, the network adapter 20 communicates with other modules of the server 5 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the server 5, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0110] The processing unit 16 executes various functional applications and page displays by running the program stored in the system memory 28, for example, implementing the master node determination method provided in the embodiment of the present invention, the method comprising:

[0111] Get the node characteristics of each node in the cluster;

[0112] The node features of each of the nodes are input into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each of the nodes, wherein the master node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding node.

[0113] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the master node determination method provided by any embodiment of the present invention.

[0114] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, for example, a master node determination method provided in an embodiment of the present invention is implemented. The method includes:

[0115] Get the node characteristics of each node in the cluster;

[0116] The node features of each of the nodes are input into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each of the nodes, wherein the master node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding node.

[0117] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0118] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0119] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0120] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0121] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0122] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for determining a master node, characterized in that: include: Get the node characteristics of each node in the cluster; The node features of each of the nodes are input into a pre-trained master node determination model, so that the master node determination model determines the master node according to the node features of each of the nodes, wherein the master node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding node.

2. The method for determining the master node according to claim 1, characterized in that: The node characteristics include at least one of the hardware configuration, load rate, processor usage, memory usage, bandwidth usage, and disk usage of the server where the node is located.

3. The master node determination method according to claim 1, characterized in that: The training process of the master node determining the model includes: Acquire a training data set, wherein the training data set includes training node features of each of the nodes in the cluster and an actual master node in the cluster; Inputting the training data set into a random forest model, performing model training on the random forest model, and calculating the model accuracy according to the actual master nodes in the cluster and the training master nodes in the cluster output by the model; The model is optimized according to the model accuracy until the model accuracy meets the preset conditions, thereby obtaining the master node determination model.

4. The method for determining the master node according to claim 3, characterized in that: Before inputting the training data set into the random forest model, it also includes: A plurality of decision trees are constructed according to the training node features in the training data set, and the random forest model is constructed according to the decision trees.

5. The method for determining the master node according to claim 4, characterized in that: Constructing multiple decision trees according to the training node features in the training data set, including: For each of the training node features in the training data set, a target feature is determined in the training node features based on a preset decision tree algorithm, and the decision tree is constructed according to the target feature and the task processing effect corresponding to each of the target features.

6. The method for determining the master node according to claim 5, characterized in that: Determining a target feature from the training node features based on a preset decision tree algorithm includes: Sorting each feature in the training node features based on the preset decision tree algorithm; According to a decision tree pruning rule, the target feature is determined from the sorted training node features.

7. The method for determining a master node according to claim 1, characterized in that: Inputting the node features of each of the nodes into a pre-trained master node determination model so that the master node determination model determines the master node according to the node features of each of the nodes, including: The node features of each of the nodes are input into a pre-trained master node determination model, so that the master node determination model determines the task processing effect corresponding to each decision tree according to the node features of each of the nodes, determines the target task processing effect of each of the nodes according to the task processing effect corresponding to each of the decision trees, and determines the master node according to the target task processing effect of each of the nodes.

8. A master node determination device, characterized in that: include: The acquisition module is used to obtain the node characteristics of each node in the cluster; An execution module is used to input the node features of each of the nodes into a pre-trained main node determination model, so that the main node determination model determines the node efficiency of each of the nodes according to the node features of each of the nodes, and determines the main node according to the node efficiency of each of the nodes, wherein the main node determination model is obtained by training a random forest model, and the random forest model is composed of multiple decision trees corresponding to each of the nodes, and each of the decision trees is constructed by the node features of the corresponding nodes.

9. A server, characterized in that: The server comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the master node determination method as described in any one of claims 1-7.

10. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions, when executed by a computer processor, are used to execute the master node determination method as described in any one of claims 1-7.

Citation Information

Cited By

  • Main node election method, device and equipment of sentry system and storage medium

    CN120956729A