A database cluster upgrading method and device, electronic equipment and storage medium

By obtaining the version update dataset from the database cluster and upgrading the slave and master nodes when conditions are met, the low accuracy problem caused by the difference in upgrade data in the existing technology is solved, and efficient and reliable database cluster upgrade is achieved.

CN115269544BActive Publication Date: 2026-05-29CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2022-07-13
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing database cluster upgrade methods suffer from low upgrade accuracy due to version upgrade data discrepancies, and sometimes even result in upgrade failures on some nodes.

Method used

The version update dataset of the database cluster to be upgraded is obtained, saved to the initial master node, and the slave nodes are upgraded when the preset node steady-state conditions are met. Target slave nodes that meet the conditions of feature similarity and dataset acquisition time are selected, and finally the initial master node is upgraded.

Benefits of technology

This ensures the accuracy of database cluster upgrades, avoids node discrepancies and failures caused by external interference or data differences, and improves the reliability of upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115269544B_ABST
    Figure CN115269544B_ABST
Patent Text Reader

Abstract

The application discloses a database cluster upgrading method and device, electronic equipment and storage medium, and relates to the technical field of database information. In the application, version update data set of a database cluster to be upgraded is obtained from a database cluster upgrading request and saved to an initial master node in the database cluster to be upgraded. Then, when it is determined that the initial master node and each slave node meet a preset initial node steady state condition, version upgrade is performed on each slave node based on the version update data set. Further, when it is determined that the slave node characteristics of each upgraded slave node and the initial characteristics of the initial master node meet a preset feature similarity condition, a target slave node meeting a preset update data set acquisition time length condition is selected from the upgraded slave nodes. Finally, version upgrade is performed on the initial master node based on the version update data set obtained by the target slave node, so as to ensure the upgrading accuracy of the database cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database information technology, and in particular to a database cluster upgrade method, apparatus, electronic device and storage medium. Background Technology

[0002] With the development of information technology, database clusters are widely used for data processing and storage. It should be noted that, for example... Figure 1 As shown, a database cluster typically includes one master node and at least one slave node, where both the master node and each slave node can perform data reading and sending operations.

[0003] Furthermore, in order to ensure the security, stability and functionality of the database cluster, it is necessary to upgrade the database cluster version regularly. Therefore, in the process of version upgrade, it is of great significance to realize the version upgrade of the master and slave nodes in the database cluster in real time and efficiently.

[0004] For example, in order to achieve real-time and efficient version upgrades of a database cluster, the upgrade process and database master-slave replication protocol are typically used to obtain the version upgrade data of each node to be upgraded in the original database cluster. Then, the version upgrade data is parsed through each upgrade process to obtain the version configuration information of each node to be upgraded. Finally, based on the obtained version configuration information, the version upgrade of each node to be upgraded is performed to obtain the corresponding target database cluster.

[0005] However, the database cluster upgrade method described above may be affected by external interference or problems in the process of obtaining version upgrade data, resulting in differences between the obtained version upgrade data. This can lead to differences between the upgraded cluster nodes and even some cluster nodes failing to upgrade. As a result, the accuracy of the database cluster upgrade cannot be guaranteed.

[0006] Therefore, the accuracy of database cluster upgrades is low when using the above method. Summary of the Invention

[0007] This application provides a database cluster upgrade method, apparatus, electronic device, and storage medium to ensure the accuracy of database cluster upgrades.

[0008] In a first aspect, embodiments of this application provide a database cluster upgrade method, the method comprising:

[0009] From the database cluster upgrade request sent by the target terminal, obtain the version update dataset of the database cluster to be upgraded, and save the version update dataset to the initial master node in the database cluster to be upgraded; wherein, the database cluster to be upgraded performs node version updates in master-slave mode;

[0010] Once it is determined that the initial master node and each slave node in the database cluster to be upgraded all meet the preset initial node steady-state conditions, the version of each slave node is upgraded based on the version update dataset to obtain the upgraded slave nodes.

[0011] When it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both meet the preset feature similarity conditions, target slave nodes that meet the preset update dataset acquisition time conditions are selected from the upgraded slave nodes.

[0012] Based on the version update dataset obtained from the target node, the initial master node is upgraded.

[0013] Secondly, embodiments of this application also provide a database cluster upgrade device, the device comprising:

[0014] The data acquisition module is used to obtain the version update dataset of the database cluster to be upgraded from the database cluster upgrade request sent by the target terminal, and save the version update dataset to the initial master node in the database cluster to be upgraded; wherein, the database cluster to be upgraded performs node version updates in master-slave mode;

[0015] The first upgrade module is used to upgrade each slave node based on the version update dataset when it is determined that the initial master node and each slave node in the database cluster to be upgraded meet the preset initial node steady-state conditions, so as to obtain the upgraded slave nodes.

[0016] The node filtering module is used to filter out target slave nodes that meet the preset update dataset acquisition time condition from the upgraded slave nodes when the slave node features of each upgraded slave node and the initial features of the initial master node both meet the preset feature similarity conditions.

[0017] The second upgrade module is used to upgrade the initial master node based on the version update dataset obtained from the target slave node.

[0018] In one possible embodiment, when it is determined that both the initial master node and each slave node in the database cluster to be upgraded satisfy the preset initial node steady-state condition, the first upgrade module is specifically used for:

[0019] For each of the slave nodes, perform the following operations respectively:

[0020] Obtain the initial slave node state information of a slave node and the initial master node state information of the initial master node; wherein, the initial master node state information represents the initial working state of a slave node, and the initial master node state information represents the initial working state of the initial master node.

[0021] Based on the initial slave node status information and the initial master node status information, when it is determined that both the slave node and the initial master node are in normal working state, the initial slave node dataset of the slave node and the initial master node dataset of the initial master node are obtained.

[0022] When the similarity between the initial slave node dataset and the initial master node dataset satisfies the preset initial dataset similarity condition, the initial master node and one slave node are determined, satisfying the initial node steady-state condition.

[0023] In one possible embodiment, when upgrading each slave node based on the version update dataset to obtain the upgraded slave nodes, the first upgrade module is specifically used for:

[0024] According to the preset data distribution time period, the version update dataset saved by the initial master node is distributed to each slave node in sequence;

[0025] Each slave node is upgraded based on its own version update dataset, resulting in upgraded slave nodes.

[0026] In one possible embodiment, when it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both satisfy a preset feature similarity condition, the node filtering module is specifically used for:

[0027] For each upgraded slave node, perform the following operations:

[0028] The node status information and dataset of an upgraded slave node are parsed to obtain the corresponding slave node features, and the node status information and version update dataset of the initial master node are parsed to obtain the corresponding initial features.

[0029] When the feature similarity between the slave node feature and the initial feature is greater than the preset feature similarity threshold, the slave node feature and the initial feature are determined to satisfy the feature similarity condition.

[0030] In one possible embodiment, when selecting target slave nodes that meet the preset update dataset acquisition duration condition from the upgraded slave nodes, the node filtering module is specifically used for:

[0031] Record the acquisition time of the version update dataset for each slave node after the upgrade;

[0032] Based on the obtained acquisition durations, the order of acquisition durations for each upgraded slave node is determined.

[0033] Based on the upgraded slave nodes and their respective acquisition duration order, target slave nodes that meet the acquisition duration conditions for updating the dataset are selected from the upgraded slave nodes.

[0034] In one possible embodiment, when upgrading the initial master node based on the version update dataset obtained from the target slave node, the second upgrade module is specifically used for:

[0035] The target slave node is used as the target master node, and the initial master node is upgraded based on the version update dataset obtained from the target master node.

[0036] In one possible embodiment, after upgrading the initial master node based on the version update dataset obtained from the target slave node, the second upgrade module is further configured to:

[0037] Obtain the current master node status information of the initial master node after the upgrade, as well as the current slave node status information of each slave node after the upgrade;

[0038] Based on the current master node status information and the status information of each current slave node, when it is determined that the upgraded initial master node and each upgraded slave node are in normal working condition, the current master node dataset of the upgraded initial master node and the current slave node dataset of each upgraded slave node are obtained.

[0039] If the current master node dataset and each current slave node dataset meet the preset similarity of the upgrade dataset, the data cluster to be upgraded is determined to have been successfully upgraded.

[0040] Thirdly, an electronic device is proposed, comprising a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of the database cluster upgrade method described in the first aspect.

[0041] Fourthly, a computer-readable storage medium is proposed, comprising program code that, when executed on an electronic device, causes the electronic device to perform the steps of the database cluster upgrade method described in the first aspect.

[0042] Fifthly, a computer program product is provided, which, when invoked by a computer, causes the computer to execute the database cluster upgrade method steps as described in the first aspect.

[0043] The beneficial effects of this application are as follows:

[0044] In the database cluster upgrade method provided in this application embodiment, the version update dataset of the database cluster to be upgraded is obtained from the database cluster upgrade request sent by the target terminal, and the version update dataset is saved to the initial master node in the database cluster to be upgraded. The database cluster to be upgraded performs node version updates in master-slave mode. Then, when it is determined that the initial master node and each slave node in the database cluster to be upgraded meet the preset initial node steady-state conditions, the version update dataset is used to upgrade each slave node to obtain the upgraded slave nodes. Further, when it is determined that the slave node features of each upgraded slave node and the initial features of the initial master node meet the preset feature similarity conditions, the target slave node that meets the preset update dataset acquisition time condition is selected from the upgraded slave nodes. Finally, the version update dataset obtained from the target slave node is used to upgrade the initial master node.

[0045] This approach avoids the technical drawbacks of existing technologies, which can lead to discrepancies between different versions of upgrade data due to external interference or problems in the acquisition process of version upgrade data. This discrepancy can result in differences between the upgraded cluster nodes and even the failure of some cluster nodes to be upgraded. This approach ensures the accuracy of database cluster upgrades.

[0046] Furthermore, other features and advantages of this application will be set forth in the following description and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0047] Figure 1 An exemplary schematic diagram of a database cluster structure provided in an embodiment of this application is shown;

[0048] Figure 2 An exemplary illustration shows a system architecture diagram for database cluster upgrades provided in an embodiment of this application;

[0049] Figure 3 An exemplary illustration shows a flowchart of a database cluster upgrade method provided in an embodiment of this application;

[0050] Figure 4 An exemplary illustration shows a flowchart of a method for determining whether a node satisfies the initial node steady-state conditions according to an embodiment of this application;

[0051] Figure 5An exemplary illustration shows a specific application scenario diagram of node upgrade provided by an embodiment of this application;

[0052] Figure 6 This illustration shows a specific application scenario diagram of determining node features and initial features to satisfy feature similarity conditions, provided by an embodiment of this application.

[0053] Figure 7 An exemplary illustration shows a logic diagram for determining the success of an upgrade of a data cluster provided in an embodiment of this application;

[0054] Figure 8 An exemplary schematic diagram of a database cluster upgrade device provided in an embodiment of this application is shown;

[0055] Figure 9 An exemplary schematic diagram of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0057] It should be noted that in the description of this application, "multiple" is understood as "at least two". "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. A connected to B can represent: A and B directly connected, or A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0058] Furthermore, the data collection, dissemination, and use in the technical solution of this application all comply with the requirements of relevant national laws and regulations.

[0059] The design concept of the embodiments of this application is briefly introduced below:

[0060] With the rapid development of the information age and the surge in enterprise data volume, the pressure and "responsibilities" borne by database systems are also increasing. In order to ensure the security, stability and functionality of online database clusters, it is necessary to upgrade the database clusters regularly. During the upgrade process, it is of great significance to ensure that application business is not affected and the consistency of data in the database cluster is maintained.

[0061] In existing technologies, to achieve real-time and efficient version upgrades of database clusters, the upgrade process and database master-slave replication protocol are typically used to obtain version upgrade data for each node in the original database cluster to be upgraded. Then, the version upgrade data is parsed through each upgrade process to obtain the version configuration information for each node. Finally, based on the obtained version configuration information, the version upgrades are performed on each node to obtain the target database cluster.

[0062] It is evident that existing database upgrade solutions do not perform data consistency verification between the nodes of the cluster to be upgraded to prevent data loss. Alternatively, external interference or problems in the process of obtaining version upgrade data may lead to differences between the obtained version upgrade data, resulting in differences between the nodes of the cluster to be upgraded after the upgrade, or even the failure of some nodes to be upgraded, thus affecting the accuracy of the database cluster version upgrade.

[0063] In view of this, in order to ensure the accuracy of database cluster upgrades, this application proposes a database cluster upgrade method, which specifically includes: obtaining the version update dataset of the database cluster to be upgraded from the database cluster upgrade request sent by the target terminal, and saving the version update dataset to the initial master node in the database cluster to be upgraded, wherein the database cluster to be upgraded performs node version updates in a master-slave mode; then, when it is determined that the initial master node and each slave node in the database cluster to be upgraded all meet the preset initial node steady-state conditions, the version update dataset is used to upgrade each slave node to obtain the upgraded slave nodes; further, when it is determined that the slave node features of each upgraded slave node and the initial features of the initial master node all meet the preset feature similarity conditions, the target slave node that meets the preset update dataset acquisition time condition is selected from the upgraded slave nodes; finally, the version update dataset obtained from the target slave node is used to upgrade the initial master node.

[0064] In particular, the preferred embodiments of this application will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments of this application and the features in the embodiments can be combined with each other without conflict.

[0065] See Figure 2 The diagram shown illustrates a system architecture for upgrading a database cluster according to an embodiment of this application. This system architecture includes: a consistency verification module 201, a status judgment module 202, an upgrade module 203, and a master-slave switching module 204. The consistency verification module 201 primarily determines the data consistency between the master and slave nodes of the database cluster, ensuring no data loss during the switching process. The status judgment module 202 primarily determines whether the status of each node in the database cluster is normal. The upgrade module 203 primarily upgrades the database cluster, ensuring successful upgrades to the specified version. The master-slave switching module 204 ensures automatic upgrades of the initial master node in the database cluster without interrupting operations through online master-slave switching.

[0066] It should be noted that during consistency verification, the consistency between the initial master node and each slave node can be determined by using their respective Global Transaction Identifiers (GTIDs).

[0067] The database cluster upgrade method provided by the exemplary embodiments of this application will be described below in conjunction with the above system architecture and with reference to the accompanying drawings. It should be noted that the above system architecture is only shown for the purpose of understanding the spirit and principles of this application, and the embodiments of this application are not limited in any way in this respect.

[0068] See Figure 3 The diagram shown is a flowchart of a database cluster upgrade method provided in this application. Taking the database cluster upgrade system as the executing entity as an example, the specific implementation process of this method is as follows:

[0069] S301: Obtain the version update dataset of the database cluster to be upgraded from the database cluster upgrade request sent by the target terminal, and save the version update dataset to the initial master node in the database cluster to be upgraded.

[0070] Specifically, during step S301, the database cluster upgrade system receives the database cluster upgrade request sent by the target terminal, parses the database cluster upgrade request, thereby obtaining the version update dataset of the data cluster to be upgraded, and then saves the version dataset to the initial master node in the database cluster to be upgraded; wherein, the database cluster to be upgraded performs node version updates in master-slave mode.

[0071] S302: When it is determined that the initial master node and each slave node in the database cluster to be upgraded all meet the preset initial node steady-state conditions, the version of each slave node is upgraded based on the version update dataset to obtain the upgraded slave nodes.

[0072] Specifically, during step S302, after the database cluster upgrade system saves the version update dataset to the initial master node in the database cluster to be upgraded, refer to... Figure 4 As shown, perform the following operations for each slave node:

[0073] S3021: Obtain the initial slave node status information of a slave node and the initial master node status information of the initial master node.

[0074] Specifically, during step S3021, the database cluster upgrade system obtains the initial slave node status information of the aforementioned slave node and the initial master node status information of the initial master node through the status judgment module; wherein, the initial master node status information represents the initial working state of the aforementioned slave node, and the initial master node status information represents the initial working state of the aforementioned initial master node.

[0075] S3022: When it is determined that both a slave node and an initial master node are in normal working condition based on the initial slave node status information and the initial master node status information, obtain the initial slave node dataset of a slave node and the initial master node dataset of the initial master node.

[0076] Specifically, when executing step S3022, the database cluster upgrade system, based on the obtained initial slave node status information and initial master node status information, and through the status judgment module, determines that both the aforementioned slave node and the initial master node are in normal working condition, and then through the consistency verification module, obtains the initial slave node dataset of the aforementioned slave node and the initial master node dataset of the initial master node.

[0077] Optionally, if the database cluster upgrade system determines through the status judgment module that one of the slave nodes and the initial master node are in an abnormal working state, it will prompt that the database cluster to be upgraded does not meet the master-slave switchover or master-slave update mode and exit the database cluster upgrade.

[0078] S3023: When the similarity between the initial slave node dataset and the initial master node dataset satisfies the preset initial dataset similarity condition, determine the initial master node and a slave node to satisfy the initial node steady-state condition.

[0079] Specifically, during step S3023, the database cluster upgrade system uses the status judgment module and a preset initial dataset similarity condition to determine whether the initial master node and the aforementioned slave node satisfy the initial node steady-state condition. If the set similarity between the initial slave node dataset and the initial master node dataset satisfies the preset initial dataset similarity condition, then it can be determined that the initial master node and the aforementioned slave node satisfy the initial node steady-state condition.

[0080] For example, suppose the preset initial dataset similarity condition is: similarity threshold α Y =98%. If the set similarity α1 = 98.3% between the initial slave node dataset and the initial master node dataset, then the set similarity α1 = 98.3% is greater than the similarity threshold α. Y =98%, thus the initial master node and the aforementioned slave node can be determined, satisfying the initial node steady-state condition.

[0081] Optionally, if the similarity between the initial slave node dataset and the initial master node dataset does not meet the preset initial dataset similarity condition, then it can be determined that the initial master node and one of the aforementioned slave nodes do not meet the initial node steady-state condition.

[0082] For example, assuming the preset initial dataset similarity condition is still: similarity threshold α Y =98%. If the set similarity α² between the initial slave node dataset and the initial master node dataset is 85.2%, then the set similarity α² = 85.2%, which is less than the similarity threshold α. Y =98%, thus it can be determined that the initial master node and the aforementioned slave node do not satisfy the initial node steady-state condition.

[0083] Further, see Figure 5 As shown, when the database cluster upgrade system determines that the initial master node (e.g., Mas.Node1) and each slave node in the database cluster to be upgraded (e.g., Ser.Node1, Ser.Node2, and Ser.Node3) all meet the preset initial node steady-state conditions, it can distribute the version update dataset stored by the initial master node to each slave node sequentially according to the preset data distribution time period (e.g., 100ms). Then, through the upgrade module, each slave node is upgraded based on the version update dataset obtained by each slave node, thereby obtaining the upgraded slave nodes, which can be denoted as Up.Node1, Up.Node2, and Up.Node3 in sequence.

[0084] S303: When it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both meet the preset feature similarity conditions, target slave nodes that meet the preset update dataset acquisition time conditions are selected from the upgraded slave nodes.

[0085] Specifically, when executing step S303, the database cluster upgrade system determines the initial master node and the aforementioned slave node. After the initial node's steady-state condition is met, it can determine whether the features of each slave node and the initial features of the initial master node, as well as the preset feature similarity conditions, satisfy the preset feature similarity conditions based on the slave node features of each upgraded slave node and the initial features of the initial master node.

[0086] In one possible implementation, see [link / reference] Figure 6 As shown, the database cluster upgrade system performs the following operations on each upgraded slave node: it parses the node status information and dataset of the upgraded slave node to obtain the corresponding slave node features, and it parses the node status information and version update dataset of the initial master node to obtain the corresponding initial features; furthermore, when the feature similarity between the slave node features and the initial features is greater than the preset feature similarity threshold, it determines that the slave node features and the initial features satisfy the feature similarity condition.

[0087] For example, assume a preset feature similarity threshold β Y =95%. If the feature similarity β1 between the node features and the initial features is 97.2%, then the feature similarity β1 = 97.2%, which is greater than the feature similarity threshold β. Y =95%, thus determining the node features and initial features to satisfy the corresponding feature similarity conditions.

[0088] Optionally, if the feature similarity between the node feature and the initial feature is not greater than a preset feature similarity threshold, it is determined that the node feature and the initial feature do not meet the feature similarity condition.

[0089] For example, assume a preset feature similarity threshold β Y =95%. If the feature similarity β1 between the node features and the initial features is 88.7%, then the feature similarity β1 = 88.7%, which is less than the feature similarity threshold β. Y =95%, thus it can be determined that the node features and initial features do not meet the corresponding feature similarity conditions.

[0090] Furthermore, if it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both satisfy the preset feature similarity conditions, then target slave nodes that meet the preset update dataset acquisition time conditions can be selected from the upgraded slave nodes.

[0091] Specifically, during the process of each slave node obtaining its corresponding version update dataset from the initial master node, the database cluster upgrade system records the acquisition time of each slave node's version update dataset. Then, after each slave node performs a version upgrade based on its respective version update dataset, the acquisition time order of each upgraded slave node can be determined based on the acquisition time of each version update dataset. Finally, based on the acquisition time order of each upgraded slave node, target slave nodes that meet the update dataset acquisition time condition are selected from the upgraded slave nodes.

[0092] It should be noted that the acquisition time of the version update dataset represents the ability of the corresponding slave node to synchronize the initial master node data information. That is, the shorter the acquisition time of the version update dataset, the stronger the ability of the corresponding slave node to synchronize the initial master node data row; conversely, the longer the acquisition time of the version update dataset, the weaker the ability of the corresponding slave node to synchronize the initial master node data row.

[0093] S304: Upgrade the initial master node based on the version update dataset obtained from the target slave node.

[0094] Specifically, when executing step S304, after the database cluster upgrade system selects the target slave node that meets the preset update dataset acquisition time condition, it can use the target slave node as the target master node, and upgrade the initial master node based on the version update dataset obtained by the target master node.

[0095] Furthermore, after upgrading the initial master node, the database cluster upgrade system needs to check whether the upgrade was accurate and whether the status of each node in the upgraded database cluster is normal and whether the data is consistent in order to determine whether the database cluster upgrade was accurate. (See [link to relevant documentation]). Figure 7 As shown, the process involves obtaining the current master node status information of the upgraded initial master node and the current slave node status information of each upgraded slave node. Next, based on the current master node status information and the current slave node status information, and after determining that both the upgraded initial master node and each upgraded slave node are in normal working order, the process obtains the current master node dataset of the upgraded initial master node and the current slave node dataset of each upgraded slave node. Finally, when both the aforementioned current master node dataset and each current slave node dataset meet the preset upgrade dataset similarity, the upgrade of the data cluster is determined to be successful.

[0096] For example, taking four current slave node datasets as an example, assuming a preset upgrade dataset similarity γ Y =93%, if the similarity of the current dataset between the current master node dataset and the datasets of the four former slave nodes is as follows: γ1 = 94.2%, γ Y =95.8%, γ Y =93.1% and γ Y If the similarity is 97.2%, then we know that the current master node dataset and each current slave node dataset meet the preset upgrade dataset similarity, and therefore we know that the upgrade of the data cluster is successful.

[0097] In summary, in the database cluster upgrade method provided in this application embodiment, the version update dataset of the database cluster to be upgraded is obtained from the database cluster upgrade request sent by the target terminal, and the version update dataset is saved to the initial master node in the database cluster to be upgraded. The database cluster to be upgraded performs node version updates in master-slave mode. Then, when it is determined that the initial master node and each slave node in the database cluster to be upgraded meet the preset initial node steady-state conditions, the version update dataset is used to upgrade each slave node to obtain the upgraded slave nodes. Further, when it is determined that the slave node features of each upgraded slave node and the initial features of the initial master node meet the preset feature similarity conditions, the target slave node that meets the preset update dataset acquisition time condition is selected from the upgraded slave nodes. Finally, the version update dataset obtained from the target slave node is used to upgrade the initial master node.

[0098] This approach avoids the technical drawbacks of existing technologies, which can lead to discrepancies between different versions of upgrade data due to external interference or problems in the acquisition process of version upgrade data. This discrepancy can result in differences between the upgraded cluster nodes and even the failure of some cluster nodes to be upgraded. This approach ensures the accuracy of database cluster upgrades.

[0099] Furthermore, based on the same technical concept, this application embodiment also provides a database cluster upgrade apparatus, which is used to implement the database cluster upgrade method flow described above in this application embodiment. See also... Figure 8 As shown, the database cluster upgrade device includes: a data acquisition module 801, a first upgrade module 802, a node filtering module 803, and a second upgrade module 804, wherein:

[0100] The data acquisition module 801 is used to obtain the version update dataset of the database cluster to be upgraded from the database cluster upgrade request sent by the target terminal, and save the version update dataset to the initial master node in the database cluster to be upgraded; wherein, the database cluster to be upgraded performs node version updates in master-slave mode;

[0101] The first upgrade module 802 is used to upgrade each slave node based on the version update dataset when it is determined that the initial master node and each slave node in the database cluster to be upgraded meet the preset initial node steady-state conditions, so as to obtain the upgraded slave nodes.

[0102] The node filtering module 803 is used to filter out target slave nodes that meet the preset update dataset acquisition time condition from the upgraded slave nodes when it is determined that the slave node features of each upgraded slave node and the initial features of the initial master node both meet the preset feature similarity conditions.

[0103] The second upgrade module 804 is used to upgrade the initial master node based on the version update dataset obtained from the target slave node.

[0104] In one possible embodiment, when it is determined that both the initial master node and each slave node in the database cluster to be upgraded satisfy the preset initial node steady-state condition, the first upgrade module 802 is specifically used for:

[0105] For each of the slave nodes, perform the following operations respectively:

[0106] Obtain the initial slave node state information of a slave node and the initial master node state information of the initial master node; wherein, the initial master node state information represents the initial working state of a slave node, and the initial master node state information represents the initial working state of the initial master node.

[0107] Based on the initial slave node status information and the initial master node status information, when it is determined that both the slave node and the initial master node are in normal working state, the initial slave node dataset of the slave node and the initial master node dataset of the initial master node are obtained.

[0108] When the similarity between the initial slave node dataset and the initial master node dataset satisfies the preset initial dataset similarity condition, the initial master node and one slave node are determined, satisfying the initial node steady-state condition.

[0109] In one possible embodiment, when upgrading each slave node based on the version update dataset to obtain the upgraded slave nodes, the first upgrade module 802 is specifically used for:

[0110] According to the preset data distribution time period, the version update dataset saved by the initial master node is distributed to each slave node in sequence;

[0111] Each slave node is upgraded based on its own version update dataset, resulting in upgraded slave nodes.

[0112] In one possible embodiment, when it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both satisfy a preset feature similarity condition, the node filtering module 803 is specifically used for:

[0113] For each upgraded slave node, perform the following operations:

[0114] The node status information and dataset of an upgraded slave node are parsed to obtain the corresponding slave node features, and the node status information and version update dataset of the initial master node are parsed to obtain the corresponding initial features.

[0115] When the feature similarity between the slave node feature and the initial feature is greater than the preset feature similarity threshold, the slave node feature and the initial feature are determined to satisfy the feature similarity condition.

[0116] In one possible embodiment, when selecting target slave nodes that meet the preset update dataset acquisition duration condition from the upgraded slave nodes, the node filtering module 803 is specifically used for:

[0117] Record the acquisition time of the version update dataset for each slave node after the upgrade;

[0118] Based on the obtained acquisition durations, the order of acquisition durations for each upgraded slave node is determined.

[0119] Based on the upgraded slave nodes and their respective acquisition duration order, target slave nodes that meet the acquisition duration conditions for updating the dataset are selected from the upgraded slave nodes.

[0120] In one possible embodiment, when upgrading the initial master node based on the version update dataset obtained from the target slave node, the second upgrade module 804 is specifically used for:

[0121] The target slave node is used as the target master node, and the initial master node is upgraded based on the version update dataset obtained from the target master node.

[0122] In one possible embodiment, after upgrading the initial master node based on the version update dataset obtained from the target slave node, the second upgrade module 804 is further configured to:

[0123] Obtain the current master node status information of the initial master node after the upgrade, as well as the current slave node status information of each slave node after the upgrade;

[0124] Based on the current master node status information and the status information of each current slave node, when it is determined that the upgraded initial master node and each upgraded slave node are in normal working condition, the current master node dataset of the upgraded initial master node and the current slave node dataset of each upgraded slave node are obtained.

[0125] If the current master node dataset and each current slave node dataset meet the preset similarity of the upgrade dataset, the data cluster to be upgraded is determined to have been successfully upgraded.

[0126] Based on the same technical concept, embodiments of this application also provide an electronic device that can implement the database cluster upgrade method provided in the above embodiments of this application. In one embodiment, the electronic device can be a server, a terminal device, or other electronic devices. Figure 9 As shown, the electronic device may include:

[0127] At least one processor 901 and a memory 902 connected to at least one processor 901. In this embodiment, the specific connection medium between the processor 901 and the memory 902 is not limited. Figure 9 The example shown is the connection between processor 901 and memory 902 via bus 900. Bus 900 is... Figure 9 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The Bus 900 can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 9 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 901 can also be called a controller; there is no restriction on the name.

[0128] In this embodiment, the memory 902 stores instructions executable by at least one processor 901. By executing the instructions stored in the memory 902, the at least one processor 901 can perform a database cluster upgrade method described above. The processor 901 can implement... Figure 8 The functions of each module in the device shown.

[0129] The processor 901 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 902 and calling data stored in memory 902, the processor can perform various functions and process data, thereby monitoring the device as a whole.

[0130] In one possible design, processor 901 may include one or more processing units. Processor 901 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 901. In some embodiments, processor 901 and memory 902 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.

[0131] The processor 901 can be a general-purpose processor, such as a CPU, digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the database cluster upgrade method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0132] Memory 902, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 902 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 902 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 902 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0133] By designing and programming the processor 901, the code corresponding to the database cluster upgrade method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute it during runtime. Figure 3The illustrated embodiment presents the steps of a database cluster upgrade method. How to design and program the processor 901 is a technique well-known to those skilled in the art and will not be described further here.

[0134] Based on the same inventive concept, embodiments of this application also provide a storage medium storing computer instructions that, when executed on a computer, cause the computer to perform a database cluster upgrade method described above.

[0135] In some possible implementations, various aspects of the database cluster upgrade method provided by this application can also be implemented in the form of a program product, which includes program code that, when the program product is run on a device, causes the control device to perform the steps of a database cluster upgrade method according to various exemplary embodiments of this application as described above.

[0136] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0137] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0138] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0139] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A database cluster upgrade method, characterized in that, include: From the database cluster upgrade request sent by the target terminal, obtain the version update dataset of the database cluster to be upgraded, and save the version update dataset to the initial master node in the database cluster to be upgraded; wherein, the database cluster to be upgraded performs node version updates in master-slave mode; When it is determined that the initial master node and each slave node in the database cluster to be upgraded all meet the preset initial node steady-state conditions, the version of each slave node is upgraded based on the version update dataset to obtain the upgraded slave nodes; wherein, the initial node steady-state conditions indicate that the set similarity between the initial master node dataset and the initial slave node dataset is greater than a preset similarity threshold. When it is determined that the characteristics of each upgraded slave node and the initial characteristics of the initial master node both satisfy the preset feature similarity condition, target slave nodes that satisfy the preset update dataset acquisition time condition are selected from the upgraded slave nodes. Based on the version update dataset obtained from the target node, the initial master node is upgraded.

2. The method as described in claim 1, characterized in that, The determination that the initial master node and each slave node in the database cluster to be upgraded all satisfy the preset initial node steady-state conditions includes... For each of the slave nodes, perform the following operations respectively: Obtain the initial slave node status information of a slave node and the initial master node status information of the initial master node; wherein, the initial master node status information represents the initial working state of the slave node, and the initial master node status information represents the initial working state of the initial master node. When it is determined, based on the initial slave node status information and the initial master node status information, that both the slave node and the initial master node are in normal working condition, the initial slave node dataset of the slave node and the initial master node dataset of the initial master node are obtained. When the set similarity between the initial slave node dataset and the initial master node dataset satisfies the preset initial dataset similarity condition, it is determined that the initial master node and the slave node satisfy the initial node steady-state condition.

3. The method as described in claim 1, characterized in that, The process of upgrading each slave node based on the version update dataset to obtain the upgraded slave nodes includes: According to the preset data distribution time period, the version update dataset stored in the initial master node is distributed to each slave node in sequence; Each slave node is upgraded based on its own version update dataset to obtain upgraded slave nodes.

4. The method as described in claim 1, characterized in that, The step of determining that the characteristics of each upgraded slave node and the initial characteristics of the initial master node all satisfy a preset feature similarity condition includes: For each upgraded slave node, perform the following operations: The node status information and dataset of an upgraded slave node are parsed to obtain the corresponding slave node features, and the node status information and version update dataset of the initial master node are parsed to obtain the corresponding initial features. When the feature similarity between the slave node feature and the initial feature is greater than a preset feature similarity threshold, it is determined that the slave node feature and the initial feature satisfy the feature similarity condition.

5. The method as described in claim 3, characterized in that, The step of selecting target slave nodes from the upgraded slave nodes that meet the preset update dataset acquisition time condition includes: Obtain the acquisition time of the version update dataset for each upgraded slave node; Based on the obtained acquisition durations, the acquisition duration order of each upgraded slave node is determined; Based on the order of acquisition duration of each upgraded slave node, target slave nodes that meet the acquisition duration conditions of the updated dataset are selected from the upgraded slave nodes.

6. The method as described in claim 1, characterized in that, The process of upgrading the initial master node based on the version update dataset obtained from the target slave node includes: The target slave node is used as the target master node, and the initial master node is upgraded based on the version update dataset obtained from the target master node.

7. The method according to any one of claims 1-6, characterized in that, After upgrading the initial master node based on the version update dataset obtained from the target slave node, the process further includes: Obtain the current master node status information of the upgraded initial master node, and the current slave node status information of each upgraded slave node; When it is determined, based on the current master node status information and the current slave node status information, that the upgraded initial master node and each upgraded slave node are in normal working condition, the current master node dataset of the upgraded initial master node and the current slave node dataset of each upgraded slave node are obtained. When the current master node dataset and each current slave node dataset meet the preset similarity of the upgrade dataset, the database cluster to be upgraded is determined to have been successfully upgraded.

8. A database cluster upgrade device, characterized in that, include: The data acquisition module is used to obtain the version update dataset of the database cluster to be upgraded from the database cluster upgrade request sent by the target terminal, and save the version update dataset to the initial master node in the database cluster to be upgraded; wherein the database cluster to be upgraded performs node version updates in master-slave mode; The first upgrade module is used to upgrade each slave node based on the version update dataset when it is determined that the initial master node and each slave node in the database cluster to be upgraded all meet the preset initial node steady-state conditions, thereby obtaining the upgraded slave nodes; wherein, the initial node steady-state conditions indicate that the set similarity between the initial master node dataset and the initial slave node dataset is greater than a preset similarity threshold. The node filtering module is used to filter out target slave nodes that meet the preset update dataset acquisition time condition from the upgraded slave nodes when it is determined that the slave node features of each upgraded slave node and the initial features of the initial master node both meet the preset feature similarity conditions. The second upgrade module is used to upgrade the initial master node based on the version update dataset obtained from the target slave node.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-7.