Data migration method and device, computer equipment and storage medium
By updating the cluster configuration of the target node in the distributed service cluster and joining the source cluster with a specific role type for data synchronization, the cumbersome and security issues of traditional data migration methods are solved, and efficient and safe data migration is achieved.
Patent Information
- Application Number
- CN202410599482.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In distributed service clusters, traditional data migration methods are cumbersome, time-consuming, and have low real-time data and security issues, especially when file uploads and downloads in multi-node clusters are subject to security control restrictions.
By responding to the data migration request, determine the source cluster and target cluster information, update the cluster configuration of the target node, and add the target node to the source cluster with a specific role type for data synchronization, realizing dynamic configuration features, avoiding file uploads and downloads, and improving migration efficiency. and security.
It achieves efficient data migration in distributed service clusters, reduces manual operation time, improves migration efficiency and data synchronization security, and is suitable for different migration mode requirements.
Smart Images

Figure CN118656359A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data migration method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] As the scale of distributed application business continues to increase, the amount of data in the distributed service cluster is also growing. Therefore, it is often necessary to upgrade the version of the distributed service cluster or upgrade the server hardware. Usually, in order to ensure data consistency, data migration is required after the upgrade.
[0003] However, in a production environment, a distributed service cluster usually exists in a multi-node cluster mode, so each node in the cluster needs to migrate data. In the case of a large-scale distributed service cluster with a large number of nodes, the traditional data migration method has problems such as cumbersome operation, long time consumption, and low migration efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a data migration method, apparatus, computer device, computer-readable storage medium and computer program product that can improve migration efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a data migration method, the method comprising:
[0006] In response to a data migration request, determining source cluster information, target cluster information, and a target migration mode corresponding to the data migration request;
[0007] Determine a target node in a target cluster according to the target cluster information, and update a cluster configuration of the target node in the target cluster based on the source cluster information;
[0008] Determine a target role type based on the target migration mode, add the target node to the source cluster with the target role type, and obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster;
[0009] When the target node completes data synchronization, the candidate cluster is adjusted based on the target role type of the target node to obtain the target cluster after data migration.
[0010] In one of the embodiments, determining a target node in a target cluster according to the target cluster information, and updating a cluster configuration of the target node in the target cluster based on the source cluster information includes:
[0011] Establishing a remote connection with the target node according to the address information of each target node in the target cluster;
[0012] Based on the remote connection, the address information of each source node in the source cluster is added to the node address list of the target node to update the cluster configuration of the target node in the target cluster.
[0013] In one embodiment, the step of adjusting nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration includes:
[0014] If the target role type of the target node is a follower type, each source node in the source cluster is removed from the candidate cluster to obtain a target cluster after data migration.
[0015] In one embodiment, the step of adjusting nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration includes:
[0016] If the target role type of the target node is an observer type, the target node is removed from the candidate cluster to obtain a first target cluster, where the first target cluster includes each source node in the source cluster;
[0017] The cluster configuration of the target node is restored, and a second target cluster is obtained based on the target node after the configuration restoration, wherein the second target cluster includes each target node in the target cluster after the data migration.
[0018] In one embodiment, determining the target role type based on the target migration mode, and adding the target node to the source cluster with the target role type includes:
[0019] If the target migration mode is a mode in which the source cluster maintains a service state, determining that the corresponding target role type is an observer type, and adding the target node to the source cluster as the observer type;
[0020] If the target migration mode is a mode in which the source cluster is in a non-service state, the corresponding target role type is determined to be a follower type, and the target node is added to the source cluster as the follower type.
[0021] In one embodiment, the method further comprises:
[0022] receiving a data migration request, wherein the data migration request carries source cluster information, target cluster information, and a target migration mode;
[0023] Establishing connections with a source cluster and a target cluster respectively according to the source cluster information and the target cluster information;
[0024] Acquire first migration configuration information of the source cluster and second migration configuration information of the target cluster based on the connection;
[0025] If both the first migration configuration information and the second migration configuration information satisfy the preset migration configuration condition, a step of determining source cluster information, target cluster information, and target migration mode corresponding to the data migration request in response to the data migration request is performed.
[0026] In one of the embodiments, after acquiring the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the connection, the method further includes:
[0027] If the first migration configuration information or the second migration configuration information does not meet the preset migration configuration condition, prompt information is returned, where the prompt information includes the migration configuration information that does not meet the migration configuration condition.
[0028] In one of the embodiments, after acquiring the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the connection, the method further includes:
[0029] If the version information of the source cluster satisfies the cluster version condition, the target configuration information of the source cluster satisfies the target configuration condition, the connection information of the target port of the source cluster satisfies the connection condition of the target port, and the version information of the target cluster satisfies the cluster version condition, the target configuration information of the target cluster satisfies the target configuration condition, and the connection information of the target port of the target cluster satisfies the connection condition of the target port, it is determined that both the first migration configuration information and the second migration configuration information satisfy the preset migration configuration condition;
[0030] If the version information of the source cluster does not meet the cluster version condition, or the target configuration information of the source cluster does not meet the target configuration condition, or the connection information of the target port of the source cluster does not meet the connection condition of the target port, or the version information of the target cluster does not meet the cluster version condition, or the target configuration information of the target cluster does not meet the target configuration condition, or the connection information of the target port of the target cluster does not meet the connection condition of the target port, it is determined that the first migration configuration information and the second migration configuration information do not meet the preset migration configuration condition.
[0031] In a second aspect, the present application further provides a data migration device, the device comprising:
[0032] A determination module, configured to determine, in response to a data migration request, source cluster information, target cluster information, and a target migration mode corresponding to the data migration request;
[0033] A configuration update module, configured to determine a target node in a target cluster according to the target cluster information, and update a cluster configuration of the target node in the target cluster based on the source cluster information;
[0034] A cluster update module, configured to determine a target role type based on the target migration mode, add the target node to a source cluster with the target role type, and obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster;
[0035] The node adjustment module is used to adjust the nodes of the candidate cluster based on the target role type of the target node if the target node completes data synchronization, so as to obtain the target cluster after data migration.
[0036] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0038] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0039] The above-mentioned data migration method, device, computer equipment, storage medium and computer program product, by responding to a data migration request, determine the source cluster information, target cluster information and target migration mode corresponding to the data migration request, determine the target node in the target cluster according to the target cluster information, update the cluster configuration of the target node in the target cluster based on the source cluster information, and add the target node to the source cluster with the target role type corresponding to the target migration mode to obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster, and when the target node completes data synchronization, the candidate cluster is adjusted based on the target role type of the target node to obtain the target cluster after data migration. During the migration process, the cluster configuration of the target node in the target cluster is updated based on the source cluster information to perform data migration, thereby realizing data migration based on dynamic configuration characteristics, which can avoid the problem of long migration time caused by the need to manually execute various migration commands on each node of the cluster in the traditional data migration mode, and can improve the migration efficiency. In addition, during the migration process, by adding the target node to the source cluster with the target role type corresponding to the target migration mode, it can be applied to different migration mode requirements. In addition, during the migration process, data synchronization is performed based on the role type characteristics of the nodes in the cluster, so that file uploading and downloading are not involved, thereby improving the security of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A schematic diagram of data migration in a related technology in an embodiment;
[0042] Figure 2 A schematic diagram of a data migration method in one embodiment;
[0043] Figure 3 A schematic diagram of a process for updating a target node cluster configuration step in one embodiment;
[0044] Figure 4 A schematic diagram of a flow chart of a pre-migration check step in one embodiment;
[0045] Figure 5 is a flow chart of a data migration method in another embodiment;
[0046] Figure 6 A schematic diagram of a pre-migration check step in one embodiment;
[0047] Figure 7 A schematic diagram of steps for updating cluster configuration in one embodiment;
[0048] Figure 8 A schematic diagram of the steps of entering a source cluster in a target node in an embodiment;
[0049] Fig. 9 A schematic diagram of application migration steps in one embodiment;
[0050] Fig.10 A schematic diagram of a node adjustment step in an embodiment;
[0051] Fig.11 is a structural block diagram of a data migration device in one embodiment;
[0052] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0054] Distributed service clusters are usually implemented based on distributed storage technology and exist in a multi-node cluster mode to provide data storage based on a directory tree similar to a file system, and can effectively manage the nodes in the tree to maintain and monitor the state changes of the stored data. By monitoring the state changes of this data, data-based cluster management is achieved.
[0055] In a production environment, upgrading and migrating distributed service clusters is a common operation and maintenance scenario, such as upgrading the version of a distributed service cluster or upgrading the hardware of a distributed service cluster to migrate the data of the source cluster. The data stored in a distributed service cluster usually consists of two parts: one is a full-scale runtime data snapshot file that is written regularly, and the other is a transaction log file generated by each write operation. You only need to back up the files in these two directories in full and upload them to the new server. After starting the new server, you can restore the data from the file to achieve data migration.
[0056] In related technologies, the data migration process of a distributed service cluster is as follows: Figure 1 As shown in the figure, by backing up the snapshot directory and transaction log directory under the original cluster server and uploading them to the server under the new cluster, the data can be migrated from the source cluster to the new cluster.
[0057] However, since this solution requires downloading snapshot files and transaction log files from the source cluster, and the uploading and downloading of files in the production environment often involves security control, the uploading and downloading of files are prohibited in a strict network environment, which makes this solution relatively limited in this scenario. In addition, since the large-scale distributed service cluster has a large number of nodes, the downloaded data files need to be uploaded to multiple nodes, which makes the operation cumbersome and affects the efficiency. In addition, if the data migration time of the distributed service cluster takes too long, some data will be lost during the migration process, resulting in low data real-time performance.
[0058] Although there are open source tools (such as guono) that can export all znode (node) data through the API (Application Programming Interface) of the source distributed service cluster (i.e., source cluster), and then import the znode data into all nodes of the new distributed service cluster (i.e., new cluster or target cluster) through the API. However, the data backed up in this way is not very real-time. If the original cluster is also providing write operations during the migration process, the data in the new cluster will be missing the latest data written by the source cluster, which will have a great impact on the data consistency of the application. If this part of the data is strongly dependent on the application and cannot be lost, then this migration solution will be extremely risky.
[0059] Based on this, an embodiment of the present application provides a data migration method, which is applied to a data migration tool. The data migration tool can be implemented based on the reconfig command provided by the distributed service cluster, and the tool can be loaded on a computer device. Specifically, the data migration tool responds to the data migration request, determines the source cluster information, target cluster information and target migration mode corresponding to the data migration request, determines the target node in the target cluster according to the target cluster information, updates the cluster configuration of the target node in the target cluster based on the source cluster information, and adds the target node to the source cluster with the target role type corresponding to the target migration mode to obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster, and when the target node completes data synchronization, adjusts the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration. During the migration process, the cluster configuration of the target node in the target cluster is updated based on the source cluster information to perform data migration, thereby realizing data migration based on dynamic configuration characteristics, which can avoid the problem of long migration time caused by the need to manually execute various migration commands on each node of the distributed service cluster in the traditional data migration mode, and can improve the migration efficiency. During the migration process, the target node is added to the source cluster with the target role type corresponding to the target migration mode, so that it can be applied to different migration mode requirements. In addition, during the migration process, data synchronization is based on the role type characteristics of the nodes in the cluster, and no file upload and download is involved, thus improving the security of data synchronization.
[0060] In an exemplary embodiment, Figure 2 As shown, a data migration method is provided, which may specifically include the following steps:
[0061] Step 202: In response to the data migration request, determine source cluster information, target cluster information, and target migration mode corresponding to the data migration request.
[0062] Among them, the data migration request is an instruction or command for data migration. For example, when the version of the distributed service cluster needs to be upgraded or the hardware of the distributed service cluster needs to be upgraded, data migration is usually required after the relevant upgrade to ensure data consistency, so that the new distributed service cluster after the upgrade can provide services normally. Then the data migration request is a request for migrating the data of the distributed service cluster before the upgrade (i.e., the source cluster) to the distributed service cluster after the upgrade (i.e., the target cluster). The data migration request carries the corresponding source cluster information, target cluster information, and target migration mode.
[0063] Specifically, the source cluster information is the information about the distributed service cluster before the upgrade, that is, the source cluster. For example, the source cluster information may include the address information of each source node in the source cluster, such as the IP address (Internet Protocol Address). The target cluster information is the information about the distributed service cluster after the upgrade, that is, the target cluster. For example, the target cluster information may include the address information of each target node in the target cluster, such as the IP address.
[0064] The target migration mode refers to the migration mode requested by the current data migration request. Specifically, the migration mode is used to characterize whether the source cluster remains in service after data migration, including a mode in which the source cluster remains in service after data migration and a mode in which the source cluster is out of service after data migration. It can be understood that the target migration mode is either of these two modes, which is determined based on the specific business scenario.
[0065] In this embodiment, when data migration is needed, the user can initiate a corresponding data migration request based on the data migration tool, and the data migration tool responds to the data migration request to determine the source cluster information, target cluster information and target migration mode corresponding to the data migration request, and perform data migration based on subsequent steps.
[0066] Step 204 : determining a target node in the target cluster according to the target cluster information, and updating the cluster configuration of the target node in the target cluster based on the source cluster information.
[0067] The target node refers to the node that constitutes the target cluster. A node is a service (instance) that can store, index and search data. Each node has its own corresponding address information, such as an IP address. Since the target cluster information includes the address information of each target node in the target cluster, the data migration tool can determine the target node in the target cluster based on the target cluster information determined in the above steps, and then modify the cluster configuration of the target node.
[0068] The cluster configuration is the configuration information related to the management of each node in the cluster, including but not limited to the address information of each node in the cluster, server configuration, etc. In this embodiment, the data migration tool modifies the cluster configuration of the target node in the target cluster according to the source cluster information, so that the target node can synchronize the data in the source cluster. Specifically, the data migration tool adds the address information of each source node in the source cluster information to the cluster configuration of the target node, so as to dynamically update the cluster configuration of the target node.
[0069] Step 206: determine a target role type based on the target migration mode, add the target node to the source cluster with the target role type, and obtain a candidate cluster.
[0070] Since the migration mode represents whether the source cluster maintains the service status after data migration, based on different target migration modes, the data migration tool can add the target node to the source cluster with the target role type corresponding to the target migration mode, so that the source cluster can be in the corresponding state after data migration to achieve the corresponding migration mode.
[0071] Among them, the role type refers to the role type of the node in the cluster, which generally includes the Leader type, the Follower type and the Observer type. Among them, there is only one Leader node in the cluster, which is the center of the cluster, used to coordinate other nodes in the cluster, responsible for initiating and resolving votes, updating system status, etc. There can be multiple Followers in the cluster, which are responsible for receiving client requests and returning results to the client and participating in voting during the election process. There can also be multiple Observers in the cluster, which can also receive client connections and forward write requests to the Leader node, but do not participate in the voting process and only synchronize the Leader status. It should be noted that in this embodiment, the target role type refers to any one of the Follower type and the Observer type.
[0072] Specifically, based on the different target migration modes, the data migration tool adds the target node to the source cluster in different role types. For example, if the target migration mode is a mode in which the source cluster remains in service after data migration, the target node is added to the source cluster as an Observer role type. If the target migration mode is a mode in which the source cluster is out of service after data migration, the target node is added to the source cluster as a Follower role type.
[0073] In this embodiment, the data migration tool adds the target node to the source cluster with the target role type corresponding to the target migration mode, thereby obtaining a candidate cluster. It can be understood that the candidate cluster is a new cluster composed of the source cluster and the target cluster, which includes all source nodes of the source cluster and all target nodes of the target cluster. Since the target node and the source node are in the same cluster at this time, and the target node is an Observer role or a Follower role, by restarting the target node, it can initiate a connection to the Leader node in the cluster (i.e., the node in the source cluster), thereby synchronizing the data in the source cluster.
[0074] Since the target node is still in the same cluster as the source node, it is equivalent to the target node being a newly added node of the source cluster, and the target cluster does not exist, so it cannot provide services as an upgraded cluster of the source cluster. Based on this, the data migration tool needs to further adjust the nodes of the candidate cluster (i.e., the cluster including all source nodes and target nodes) based on the following steps to obtain the target cluster after data migration, so that the target cluster after data migration can provide services as an upgraded cluster of the source cluster.
[0075] Step 208 : When the target node completes data synchronization, node adjustment is performed on the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration.
[0076] Since the target role type of the target node when joining the source cluster is determined based on the target migration mode, and the target migration mode represents whether the source cluster maintains the service status after data migration, in order to implement the target migration mode, when the target node completes data synchronization, the data migration tool can also adjust the nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration.
[0077] Since the candidate cluster includes all source nodes of the source cluster and all target nodes of the target cluster, the nodes in the candidate cluster can be adjusted based on the target role type of the target node, that is, based on the target migration mode, to obtain the target cluster after data migration, so that the target cluster after data migration can provide services as an upgraded cluster of the source cluster.
[0078] In the above data migration method, by responding to the data migration request, determining the source cluster information, target cluster information and target migration mode corresponding to the data migration request, determining the target node in the target cluster according to the target cluster information, updating the cluster configuration of the target node in the target cluster based on the source cluster information, and adding the target node to the source cluster with the target role type corresponding to the target migration mode, obtaining a candidate cluster, so that the target node synchronizes data based on the candidate cluster, and when the target node completes data synchronization, adjusting the candidate cluster based on the target role type of the target node, and obtaining the target cluster after data migration. During the migration process, the cluster configuration of the target node in the target cluster is updated based on the source cluster information to perform data migration, thereby realizing data migration based on dynamic configuration characteristics, which can avoid the problem of long migration time caused by the need to manually execute various migration commands on each node of the cluster in the traditional data migration mode, and can improve the migration efficiency. In addition, during the migration process, by adding the target node to the source cluster with the target role type corresponding to the target migration mode, it can be applied to different migration mode requirements. In addition, during the migration process, data synchronization is performed based on the role type characteristics of the nodes in the cluster, and no file upload and download are involved, so the security of data synchronization is also improved.
[0079] In an exemplary embodiment, the source cluster information includes the address information of each source node in the source cluster, and the target cluster information includes the address information of each target node in the target cluster; Figure 3 As shown, in step 204, the target node in the target cluster is determined according to the target cluster information, and the cluster configuration of the target node in the target cluster is updated based on the source cluster information, which may specifically include:
[0080] Step 302: Establish a remote connection with the target node according to the address information of each target node in the target cluster.
[0081] Among them, the address information of the target node can be the IP address of each target node in the target cluster. Specifically, the data migration tool can establish a remote connection with the target node based on the IP address of each target node in the target cluster. The remote connection can be an SSH (Secure Shell Protocol) connection, which is an encrypted network transmission protocol used to implement local connection to a remote server via SSH in the network. In this embodiment, the data migration tool can be loaded in a local computer device, and establish a remote connection with a remote target node based on the IP address of each target node in the target cluster, thereby facilitating subsequent data migration.
[0082] Step 304: Based on the remote connection, add the address information of each source node in the source cluster to the node address list of the target node to update the cluster configuration of the target node.
[0083] The address information of the source node may be the IP address of each source node in the source cluster. The node address list refers to the relevant content in the cluster configuration of the node. Specifically, the data migration tool may add the IP address of each source node in the source cluster to the node address list of the target node based on the remote connection, thereby updating the cluster configuration of the target node. After the target node is restarted, a connection may be initiated to the corresponding source node based on the node address list in the cluster configuration to synchronize the data in the source node.
[0084] In the above embodiment, the data migration tool establishes a remote connection with the target node based on the address information of each target node in the target cluster, and based on the remote connection, adds the address information of each source node in the source cluster to the node address list of the target node, thereby realizing remote dynamic update of the cluster configuration of the target node, and then enables the target node to initiate a connection to the corresponding source node based on the node address list in the updated cluster configuration to synchronize the data in the source node and realize automated data migration.
[0085] In an exemplary embodiment, Figure 4 As shown, in step 202, in response to the data migration request, determining the source cluster information, the target cluster information and the target migration mode corresponding to the data migration request may specifically include:
[0086] Step 402: Receive a data migration request.
[0087] A data migration request is a request for data migration initiated by a user based on a computer device to a data migration tool when data migration is required, and the data migration tool can receive the corresponding data migration request. The data migration request carries source cluster information, target cluster information, and target migration mode. Specifically, the source cluster information includes but is not limited to the cluster identifier of the source cluster, the address information of each source node in the source cluster, etc. The target cluster information includes but is not limited to the cluster identifier of the target cluster, the address information of each target node in the target cluster, etc.
[0088] Step 404: Establish connections with the source cluster and the target cluster respectively according to the source cluster information and the target cluster information.
[0089] The connection may be a network connection, and in this embodiment, may be a specific port connection, including but not limited to a connection to a client connection port (such as port 2181), a connection to an SSH remote port (such as port 22), and the like.
[0090] Specifically, the data migration tool establishes connections with the source cluster and the target cluster respectively according to the data migration request received in the above steps, for example, establishes connections with port 2181 and port 22 of the source cluster, and establishes connections with port 2181 and port 22 of the target cluster, so that the data migration tool can connect to the source cluster and the target cluster respectively.
[0091] Step 406: Acquire first migration configuration information of the source cluster and second migration configuration information of the target cluster based on the connection.
[0092] Among them, the first migration configuration information is used to characterize the relevant configuration conditions of the source cluster, including the first version information of the source cluster, the first target configuration information, and the connection information of the first target port. Specifically, the first version information is used to characterize the version information of the source cluster, for example, it can specifically be the version identifier and version number of the source cluster. The first target configuration information is used to characterize the relevant specified configuration of the source cluster, such as including but not limited to whether the check configuration of the 4-word command is allowed, whether the reconfig configuration is allowed, etc. The connection information of the first target port is used to characterize the connection status information of the specified port in the source cluster, such as including but not limited to the connection status of the internal communication port of the source cluster (such as port 2888), the connection status of the election port (such as port 3888), etc.
[0093] The second migration configuration information is used to characterize the relevant configuration conditions of the target cluster, including the second version information of the target cluster, the second target configuration information, and the connection information of the second target port. Specifically, the second version information is used to characterize the version information of the target cluster, for example, it can specifically be the version identifier, version number, etc. of the target cluster. The second target configuration information is used to characterize the relevant specified configuration of the target cluster, such as including but not limited to whether the check configuration of the 4-word command is allowed, whether the reconfig configuration is allowed, etc. The connection information of the second target port is used to characterize the connection status information of the specified port in the target cluster, such as including but not limited to the connection status of the internal communication port (such as port 2888) of the target cluster, the connection status of the election port (such as port 3888), etc.
[0094] In this embodiment, the data migration tool connects to the source cluster and the target cluster respectively based on the above steps, thereby obtaining the first migration configuration information of the source cluster and the second migration configuration information of the target cluster, and then further determines whether the migration configuration conditions are met through subsequent steps.
[0095] Step 408: Determine whether the first migration configuration information and the second migration configuration information meet a preset migration configuration condition.
[0096] Among them, the preset migration configuration conditions may be pre-set conditions that need to be met when the data migration tool can be used for data migration. The migration configuration conditions include cluster version conditions, target configuration conditions, and connection conditions of the target port. Specifically, the version condition may be a restriction condition on the cluster version, for example, the cluster that can use the data migration tool for data migration must have a version of at least 3.5.0, which means that only clusters equal to or greater than the version can use the data migration tool for data migration. The target configuration condition refers to the specific configuration that the cluster that can use the data migration tool for data migration needs to achieve, such as the need to enable the check configuration that allows 4-word commands and the configuration that allows reconfig. The connection condition of the target port refers to the connection condition of the designated port of the cluster that can use the data migration tool for data migration, such as the network of the designated ports (such as port 2888, port 3888, etc.) of each source node in the source cluster and each target node in the target cluster is in an interoperable state.
[0097] In this embodiment, after the data migration tool obtains the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the above steps, it can further determine whether the first migration configuration information and the second migration configuration information meet the preset migration configuration condition.
[0098] Specifically, if the first version information of the source cluster meets the cluster version condition, the first target configuration information meets the target configuration condition, the connection information of the first target port meets the connection condition of the target port, and the second version information of the target cluster meets the cluster version condition, the second target configuration information meets the target configuration condition, and the connection information of the second target port meets the connection condition of the target port, then it can be determined that the first migration configuration information and the second migration configuration information both meet the preset migration configuration condition.
[0099] If the first version information of the source cluster does not meet the cluster version condition, or the first target configuration information does not meet the target configuration condition, or the connection information of the first target port does not meet the connection condition of the target port, or the second version information of the target cluster does not meet the cluster version condition, or the second target configuration information does not meet the target configuration condition, or the connection information of the second target port does not meet the connection condition of the target port, it is determined that the first migration configuration information and the second migration configuration information do not meet the preset migration configuration condition.
[0100] Specifically, if both the first migration configuration information and the second migration configuration information meet the preset migration configuration condition, step 410 is executed; if the first migration configuration information or the second migration configuration information does not meet the preset migration configuration condition, step 412 is executed.
[0101] Step 410: In response to a data migration request, determine source cluster information, target cluster information, and a target migration mode corresponding to the request.
[0102] Specifically, if the data migration tool determines that both the first migration configuration information and the second migration configuration information meet the preset migration configuration conditions, then in response to the data migration request, the source cluster information, target cluster information and target migration mode corresponding to the request are determined, and data migration processing is performed.
[0103] Step 412, return prompt information.
[0104] Specifically, if the data migration tool determines that the first migration configuration information or the second migration configuration information does not meet the preset migration configuration conditions, a prompt message is returned, wherein the prompt message includes the relevant migration configuration information that does not meet the migration configuration conditions, so that the user can adjust the corresponding cluster configuration or check the network according to the returned prompt information to troubleshoot the problem before continuing the migration.
[0105] In the above embodiment, the data migration tool receives a data migration request, establishes a connection with the source cluster and the target cluster respectively according to the source cluster information and the target cluster information, obtains the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the connection, so as to determine whether the first migration configuration information and the second migration configuration information meet the preset migration configuration conditions. When it is determined that the migration configuration conditions are met, the data migration request is responded to, the source cluster information, the target cluster information and the target migration mode corresponding to the request are determined, and data migration processing is performed. When it is determined that the migration configuration conditions are not met, prompt information is returned, so that the user can adjust the corresponding cluster configuration or check the network according to the returned prompt information, so as to continue the migration after troubleshooting the problem. In this way, the data migration tool performs a pre-check before data migration, performs data migration on the clusters that meet the migration configuration conditions, and returns a prompt when the migration configuration conditions are not met, thereby improving the automation of data migration.
[0106] In an exemplary embodiment, the target migration mode includes any one of a mode in which the source cluster maintains a service state after migration and a mode in which the source cluster is in a non-service state. The mode in which the source cluster maintains a service state means that the source cluster can continue to maintain a normal service state after the migration is completed; the mode in which the source cluster is in a non-service state means that the roles of the source cluster nodes are all non-voting followers after the migration is completed, so that they can no longer provide services. Then, in step 206, the target node is added to the source cluster with a target role type corresponding to the target migration mode, which may specifically include: if the target migration mode is a mode in which the source cluster maintains a service state, the corresponding target role type is determined to be an observer type, and the target node is added to the source cluster with an observer type; if the target migration mode is a mode in which the source cluster is in a non-service state, the corresponding target role type is determined to be a follower type, and the target node is added to the source cluster with a follower type. Since the target node and the source node are both in the same cluster at this time, by restarting the target node, it can be made to initiate a connection to the source node, thereby synchronizing the data in the source node.
[0107] In an exemplary embodiment, in step 208, adjusting nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration may specifically include:
[0108] If the target role type of the target node is a follower type, the data migration tool will remove each source node in the source cluster from the candidate cluster, that is, the source cluster will be offline. At this time, only the target node of the target cluster remains in the cluster, thus obtaining the target cluster after data migration, and the source cluster will no longer provide services. In this mode, since the target node of the target cluster joins the source cluster as a follower type to synchronize the source cluster data, it will not lose data during the migration process, and the application can also be completely smoothly migrated to the target cluster.
[0109] If the target role type of the target node is an observer type, the data migration tool removes the target node from the candidate cluster to obtain the first target cluster, where the first target cluster includes all source nodes in the source cluster, and the source cluster can continue to provide services. Then, the cluster configuration of the target node is restored, and based on the target node after the configuration restoration, the second target cluster is obtained, where the second target cluster includes all target nodes in the target cluster after data migration. In this mode, since the target node of the target cluster is added to the source cluster as an observer type to synchronize the source cluster data, the source cluster can continue to provide services after the migration is completed.
[0110] In an exemplary embodiment, the above data migration method is further described with a specific scenario. Specifically, for a certain scenario: the distributed service cluster (i.e., the source cluster) to which the application is connected has 3 nodes, and the version number of the distributed service cluster is 3.5.3. Since its version is too low, and the specifications of the deployed server 2c4g (referring to 2-core CPU, 4G memory) have become a performance bottleneck, it is now necessary to perform cluster upgrade and migration on the distributed service cluster. It is planned that the new distributed service cluster (i.e., the target cluster or new cluster) needs to have 5 nodes, and the specifications of the server are upgraded to 4c8g (referring to 4-core CPU, 8G memory), and the version of the new cluster is also the newer 3.8.0. However, the application deployment scale previously connected to the source cluster was large, with 12 application nodes simultaneously connecting to the source cluster and providing external services, requiring uninterrupted service during the migration and upgrade process.
[0111] Combined with the above scenario requirements, it can be seen that it is suitable to migrate in the mode where the target migration mode is the source cluster in a non-service state, that is, after the migration is completed, the source cluster node no longer provides services. Then, the target role type corresponding to the target migration mode can be determined as the follower type. Specifically, Figure 5 As shown, the corresponding data migration method may specifically include the following steps:
[0112] Step 502: Receive a data migration request.
[0113] The data migration request is initiated by the user based on the above migration requirements. For example, the user initiates a corresponding data migration request to the data migration tool based on a computer device, and the data migration tool can receive the corresponding data migration request.
[0114] Specifically, the data migration request carries source cluster information (including source cluster version number 3.5.3, IP addresses of each source node in the source cluster), target cluster information (including target cluster version number 3.5.3, IP addresses of each target node in the target cluster), and target migration mode (i.e., the mode in which the source cluster is in a non-service state).
[0115] Step 504: Establish connections with the source cluster and the target cluster.
[0116] Specifically, the data migration tool establishes connections with the source cluster and the target cluster based on the relevant information of the data migration request obtained above, for example, establishing connections with ports 2181 and 22 of the source cluster, and establishing connections with ports 2181 and 22 of the target cluster.
[0117] Step 506: Execute the pre-migration check command.
[0118] Specific as Figure 6As shown, the first migration configuration information of the source cluster and the second migration configuration information of the target cluster are obtained based on the connection established above, and it is determined whether the first migration configuration information and the second migration configuration information meet the preset migration configuration conditions. Specifically, the migration configuration conditions include that the version is at least not less than 3.5.0, the check configuration that allows 4-word commands and the configuration that allows reconfig need to be enabled, and the network of the designated ports (such as port 2888, port 3888, etc.) of each source node in the source cluster and each target node in the target cluster are in an interoperable state.
[0119] The above process can be implemented based on the pre-check command ". / zkAutoMigrate.sh check –fmigrate.conf".
[0120] Step 508: Determine relevant information of the data migration in response to the data migration request.
[0121] Specifically, after the above-mentioned pre-check, the data migration tool responds to the data migration request when it determines that it meets the preset migration configuration conditions, and determines the relevant information of the data migration, including the IP addresses of each source node in the source cluster and the IP addresses of each target node in the target cluster.
[0122] Step 510: Update the cluster configuration of the target node in the target cluster.
[0123] Specifically, Figure 7 As shown, the data migration tool establishes a remote connection with the target node based on the IP address of each target node in the target cluster, and based on the remote connection, adds the IP address information of each source node in the source cluster to the node address list of the target node to update the cluster configuration of the target node. After the target node is restarted, it can initiate a connection to the corresponding source node based on the node address list in the cluster configuration to synchronize the data in the source node.
[0124] Step 512: Add the target node to the source cluster as a follower type to obtain a candidate cluster.
[0125] Specifically, Figure 8 As shown, based on the above target migration mode, that is, the mode in which the source cluster is in a non-service state, the data migration tool issues a reconfig instruction to add the target node to the source cluster as a follower type, and obtains a candidate cluster (that is, a new cluster formed based on the source cluster and the target cluster). The candidate cluster includes all source nodes of the source cluster and all target nodes of the target cluster, thereby facilitating the smooth migration of subsequent applications.
[0126] In this embodiment, the above steps 510 and 512 can be implemented based on the data synchronization command “. / zkAutoMigrate.sh sync –f migrate.conf”.
[0127] Step 514: When the target node completes data synchronization, node adjustment is performed on the candidate cluster to obtain the target cluster after data migration.
[0128] Specifically, after the target node completes data synchronization, the user can also migrate the application, such as Fig. 9 As shown in the figure, the address of the source cluster to which the application is connected is changed to the address of the target cluster. If the application is to modify the configuration in a rolling manner and release and restart, the application can be smoothly migrated to the new cluster without stopping the service during the migration process, because at this time the applications with the new and old configurations are connected to the same large cluster (the candidate cluster), and no data inconsistency will occur.
[0129] After the application migration is completed, Fig.10 As shown, the data migration tool can connect to the source cluster through the API of the source cluster to perform reconfiguration, so as to remove each source node in the source cluster from the candidate cluster, that is, the source cluster is offline. At this time, only the target nodes of the target cluster remain in the cluster, thereby obtaining the target cluster after data migration.
[0130] Specifically, you can use the data migration tool to execute the command ". / zkAutoMigrate.sh finish –fmigrate.conf" to achieve this.
[0131] In an exemplary embodiment, for a certain scenario: the distributed service cluster (i.e., source cluster) to which the application is connected has 3 nodes, the version number of the distributed service cluster is 3.8.0, the application deployment scale is large, and 20 application nodes are simultaneously connected to the source cluster and provide external services. Due to the continuous increase in data of each application, the source cluster needs to be expanded and the data of some applications needs to be isolated to improve data security. It is planned that the new distributed service cluster (i.e., target cluster or new cluster) needs to have 5 nodes, and the version of the new cluster is 3.8.0.
[0132] Combined with the above scenario requirements, it can be known that it is suitable to migrate with the target migration mode as the source cluster in the service state mode, then it can be determined that the target role type corresponding to the target migration mode is the observer type. Specifically, in this embodiment, its specific migration process is the same as above Figure 5The example is similar to that shown in the figure, the only difference is that in this embodiment, the target node is added to the source cluster as an observer type to obtain a candidate cluster. After that, when the target node completes data synchronization, during the node adjustment of the candidate cluster, the data migration tool connects to the source cluster through the API of the source cluster to execute reconfig to move the nodes of the target cluster out of the entire large cluster. Finally, after all the nodes of the target cluster are moved out, only the nodes of the source cluster remain in the cluster, that is, the first target cluster (that is, the cluster that retains the source cluster nodes) is obtained. At this point, the data migration of the source cluster has been completed. The data migration tool can also restore the node configuration of the target cluster that has been moved out of the large cluster through ssh, and restart the nodes of the target cluster. In this way, the target cluster will have the data of the source cluster after the restart, and it can also provide services to the outside as an independent cluster, that is, the second target cluster (that is, the target cluster that synchronizes the source cluster data) is obtained, and the source cluster will not be affected.
[0133] This can be achieved by executing the command ". / zkAutoMigrate.sh finish –fmigrate.conf" through the data migration tool.
[0134] After the data migration is completed, the user can change the cluster address to which the application is connected to the address of the target cluster. Since the source cluster may also be writing data during the application switching process, this mode cannot guarantee that this part of the data will be synchronized to the new cluster. However, this mode migration will not affect the source cluster. It is a good choice in scenarios where the application is not sensitive to data timeliness and the source cluster needs to continue to provide services.
[0135] The above embodiment realizes automated migration by using a data migration tool, which can avoid the time-consuming problem of manually executing various commands on each node of the cluster, thereby improving migration efficiency, and can provide different migration modes for application in different scenarios to improve the diversity and flexibility of migration.
[0136] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0137] Based on the same inventive concept, the embodiment of the present application also provides a data migration device for implementing the data migration method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data migration device embodiments provided below can refer to the limitations on the data migration method above, and will not be repeated here.
[0138] In an exemplary embodiment, Fig.11 As shown, a data migration device is provided, including: a determination module 1102, a configuration update module 1104, a cluster update module 1106 and a node adjustment module 1108, wherein:
[0139] A determination module 1102 is configured to determine, in response to a data migration request, source cluster information, target cluster information, and a target migration mode corresponding to the data migration request;
[0140] A configuration updating module 1104 is configured to determine a target node in a target cluster according to the target cluster information, and update a cluster configuration of the target node in the target cluster based on the source cluster information;
[0141] The cluster updating module 1106 is configured to add the target node to the source cluster with a target role type corresponding to the target migration mode to obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster;
[0142] The node adjustment module 1108 is configured to adjust the nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration if the target node completes data synchronization.
[0143] In an exemplary embodiment, the source cluster information includes the address information of each source node in the source cluster, and the target cluster information includes the address information of each target node in the target cluster; the configuration update module is also used to: establish a remote connection with the target node based on the address information of each target node in the target cluster; based on the remote connection, add the address information of each source node in the source cluster to the node address list of the target node to update the cluster configuration of the target node in the target cluster.
[0144] In an exemplary embodiment, the node adjustment module is further used to: if the target role type of the target node is a follower type, move each source node in the source cluster out of the candidate cluster to obtain a target cluster after data migration.
[0145] In an exemplary embodiment, the node adjustment module is also used to: if the target role type of the target node is an observer type, remove the target node from the candidate cluster to obtain a first target cluster, the first target cluster including each source node in the source cluster; restore the cluster configuration of the target node, and obtain a second target cluster based on the target node after the configuration restoration, the second target cluster including each target node in the target cluster after data migration.
[0146] In an exemplary embodiment, the target migration mode includes any one of a mode in which the source cluster remains in service after migration and a mode in which the source cluster is in a non-service state; the cluster update module is also used to: if the target migration mode is a mode in which the source cluster remains in service, determine the corresponding target role type as an observer type, and add the target node to the source cluster as the observer type; if the target migration mode is a mode in which the source cluster is in a non-service state, determine the corresponding target role type as a follower type, and add the target node to the source cluster as the follower type.
[0147] In an exemplary embodiment, the determination module is also used to: receive a data migration request, the data migration request carrying source cluster information, target cluster information and target migration mode; establish connections with the source cluster and the target cluster respectively according to the source cluster information and the target cluster information; obtain first migration configuration information of the source cluster and second migration configuration information of the target cluster based on the connection; if the first migration configuration information and the second migration configuration information both meet preset migration configuration conditions, then, in response to the data migration request, determine the source cluster information, target cluster information and target migration mode corresponding to the data migration request.
[0148] In an exemplary embodiment, the device further includes an information returning module, which is used to return prompt information if the first migration configuration information or the second migration configuration information does not meet a preset migration configuration condition, wherein the prompt information includes the migration configuration information that does not meet the migration configuration condition.
[0149] In an exemplary embodiment, the migration configuration condition includes a cluster version condition, a target configuration condition, and a connection condition of a target port, the first migration configuration information includes the first version information of the source cluster, the first target configuration information, and the connection information of the first target port, and the second migration configuration information includes the second version information of the target cluster, the second target configuration information, and the connection information of the second target port; the determination module is also used for: if the first version information of the source cluster satisfies the cluster version condition, the first target configuration information satisfies the target configuration condition, the connection information of the first target port satisfies the connection condition of the target port, and the second version information of the target cluster satisfies the cluster version condition, and the second target configuration information satisfies the target configuration condition condition, and the connection information of the second target port meets the connection condition of the target port, then it is determined that the first migration configuration information and the second migration configuration information both meet the preset migration configuration condition; if the first version information of the source cluster does not meet the cluster version condition, or the first target configuration information does not meet the target configuration condition, or the connection information of the first target port does not meet the connection condition of the target port, or the second version information of the target cluster does not meet the cluster version condition, or the second target configuration information does not meet the target configuration condition, or the connection information of the second target port does not meet the connection condition of the target port, then it is determined that the first migration configuration information and the second migration configuration information do not meet the preset migration configuration condition.
[0150] Each module in the above data migration device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0151] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.12As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to data migration. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data migration method is implemented.
[0152] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0153] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above method when executing the computer program.
[0154] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0155] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of the above method when executed by a processor.
[0156] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0157] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0158] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0159] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data migration method, It is characterized in that The method comprises: In response to a data migration request, determining source cluster information, target cluster information, and a target migration mode corresponding to the data migration request; Determine a target node in a target cluster according to the target cluster information, and update a cluster configuration of the target node in the target cluster based on the source cluster information; Determine a target role type based on the target migration mode, add the target node to the source cluster with the target role type, and obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster; When the target node completes data synchronization, the candidate cluster is adjusted based on the target role type of the target node to obtain the target cluster after data migration.
2. The method according to claim 1, It is characterized in that The determining the target node in the target cluster according to the target cluster information, and updating the cluster configuration of the target node in the target cluster based on the source cluster information includes: Establishing a remote connection with the target node according to the address information of each target node in the target cluster; Based on the remote connection, the address information of each source node in the source cluster is added to the node address list of the target node to update the cluster configuration of the target node in the target cluster.
3. The method according to claim 1, It is characterized in that The step of adjusting the nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration includes: If the target role type of the target node is a follower type, each source node in the source cluster is removed from the candidate cluster to obtain a target cluster after data migration.
4. The method according to claim 1, It is characterized in that The step of adjusting the nodes of the candidate cluster based on the target role type of the target node to obtain the target cluster after data migration includes: If the target role type of the target node is an observer type, the target node is removed from the candidate cluster to obtain a first target cluster, where the first target cluster includes each source node in the source cluster; The cluster configuration of the target node is restored, and a second target cluster is obtained based on the target node after the configuration restoration, wherein the second target cluster includes each target node in the target cluster after the data migration.
5. The method according to claim 1, It is characterized in that The determining the target role type based on the target migration mode, and adding the target node to the source cluster with the target role type, includes: If the target migration mode is a mode in which the source cluster maintains a service state, determining that the corresponding target role type is an observer type, and adding the target node to the source cluster as the observer type; If the target migration mode is a mode in which the source cluster is in a non-service state, the corresponding target role type is determined to be a follower type, and the target node is added to the source cluster as the follower type.
6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: receiving a data migration request, wherein the data migration request carries source cluster information, target cluster information, and a target migration mode; Establishing connections with a source cluster and a target cluster respectively according to the source cluster information and the target cluster information; Acquire first migration configuration information of the source cluster and second migration configuration information of the target cluster based on the connection; If both the first migration configuration information and the second migration configuration information satisfy the preset migration configuration condition, the step of responding to the data migration request and determining the source cluster information, the target cluster information, and the target migration mode corresponding to the data migration request is performed.
7. The method according to claim 6, It is characterized in that After acquiring the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the connection, the method further includes: If the first migration configuration information or the second migration configuration information does not meet the preset migration configuration condition, prompt information is returned, where the prompt information includes the migration configuration information that does not meet the migration configuration condition.
8. The method according to claim 6, It is characterized in that After acquiring the first migration configuration information of the source cluster and the second migration configuration information of the target cluster based on the connection, the method further includes: If the version information of the source cluster satisfies the cluster version condition, the target configuration information of the source cluster satisfies the target configuration condition, the connection information of the target port of the source cluster satisfies the connection condition of the target port, and the version information of the target cluster satisfies the cluster version condition, the target configuration information of the target cluster satisfies the target configuration condition, and the connection information of the target port of the target cluster satisfies the connection condition of the target port, it is determined that both the first migration configuration information and the second migration configuration information satisfy the preset migration configuration condition; If the version information of the source cluster does not meet the cluster version condition, or the target configuration information of the source cluster does not meet the target configuration condition, or the connection information of the target port of the source cluster does not meet the connection condition of the target port, or the version information of the target cluster does not meet the cluster version condition, or the target configuration information of the target cluster does not meet the target configuration condition, or the connection information of the target port of the target cluster does not meet the connection condition of the target port, it is determined that the first migration configuration information and the second migration configuration information do not meet the preset migration configuration condition.
9. A data migration device, It is characterized in that The device comprises: A determination module, configured to determine, in response to a data migration request, source cluster information, target cluster information, and a target migration mode corresponding to the data migration request; A configuration update module, configured to determine a target node in a target cluster according to the target cluster information, and update a cluster configuration of the target node in the target cluster based on the source cluster information; A cluster update module, configured to determine a target role type based on the target migration mode, add the target node to a source cluster with the target role type, and obtain a candidate cluster, so that the target node synchronizes data based on the candidate cluster; The node adjustment module is used to adjust the node of the candidate cluster based on the target role type of the target node if the target node completes data synchronization, so as to obtain the target cluster after data migration.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Container-based cluster migration method and device
CN109857516A
Data migration method and device, electronic equipment and computer storage medium
CN113126884A
Cluster migration method, related device and storage medium
CN115878269A
Cluster upgrading fault processing method and device, equipment and storage medium
CN117439867A
Cited By
Server configuration method, computer equipment and storage medium
CN119544497A
