Data migration method, device, electronic device and storage medium in cluster
By obtaining the new creation plug-in and the original creation configuration information, creating a new storage data volume and migrating the data, the problem in the existing technology of long data backup time and the need to suspend the service is solved, and the data migration is completed without stopping the service. Improved user experience.
Patent Information
- Application Number
- CN202210001751.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-04
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-01-04
AI Technical Summary
In the prior art, due to the large amount of data and the long data backup time during the data backup import process, services need to be stopped from being provided to the outside world, resulting in the inability to use the business side normally, resulting in certain impacts.
By monitoring the data migration instructions for the target node in the cluster, obtain a new creation plug-in, obtain the creation configuration information of the original storage data volume, create a new storage data volume based on this information, and migrate the original data to the new data volume. Achieve fast backup.
Data migration can be completed without suspending the service, ensuring the normal use of cluster data during the migration process and improving user experience.
Smart Images

Figure CN114356504B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for data migration in a cluster. Background Art
[0002] With the development of Internet applications and the surge in the number of users, in order to meet user needs, services are usually stored in servers in a server cluster to provide services to the outside world. However, in actual application, service migration is inevitable. For example, when an online server cluster needs to be offline, the storage memory of a server is full, or the computer room is relocated for maintenance, the task of service migration will be faced. The services of the old server cluster need to be migrated to the new server cluster to continue to provide services.
[0003] The cluster migration method of the related technology copies and packages the data of the tenants to be migrated, then stops the current user cluster (old cluster) service and deletes the current cluster, then creates a new cluster with the same name as the previously deleted cluster, then copies the packaged data directly to the current newly created cluster and restarts the service.
[0004] However, in the cluster migration method in the prior art, during the data backup and import process, due to the large amount of data and the long data backup time, it is necessary to stop providing services to the outside world. The business end will not be able to use it normally due to the suspension of service, causing certain impacts. Summary of the invention
[0005] The present application provides a method, device, electronic device and storage medium for migrating data in a cluster, which are used to solve the problem in the prior art that, during the data backup and import process, due to the large amount of data and the long data backup time, it is necessary to stop providing services to the outside world, and the business end will not be able to use it normally due to the suspension of service, causing certain impacts.
[0006] In a first aspect, an embodiment of the present application provides a method for migrating data in a cluster, comprising:
[0007] After monitoring a data migration instruction for an original storage data volume included in a target node in the cluster, obtaining a new creation plug-in, wherein the target node is any node in the cluster;
[0008] Acquire original creation configuration information used when creating the original storage data volume;
[0009] Creating a new storage data volume according to the original creation configuration information and the new creation plug-in;
[0010] The storage data in the original storage data volume is transferred to the new storage data volume.
[0011] Optionally, creating a new storage data volume according to the original creation configuration information and the new creation plug-in includes:
[0012] Binding the original creation configuration information to the new creation plug-in;
[0013] The new creation plug-in is run to obtain the new storage data volume.
[0014] Optionally, the method further includes:
[0015] Deleting a target node in the cluster;
[0016] A new node is created, and the new node is bound to the new storage data volume.
[0017] Optionally, binding the new node to the new storage data volume includes:
[0018] Create a new persistent storage declaration;
[0019] The persistent storage declaration is bound to the original creation configuration information, and the original creation configuration information is bound to the new creation plug-in.
[0020] Optionally, after transferring the data in the original storage data volume to the new storage data volume, the method further includes:
[0021] Connecting the new node to the cluster;
[0022] Acquire incremental data sent by other nodes in the cluster, wherein the incremental data is difference data between data in the storage data volume included in the other nodes and data in the new storage data volume included in the new node, and the other nodes are nodes in the cluster except the new node.
[0023] Optionally, when a data migration instruction for data corresponding to a target node in a cluster is detected, before obtaining a new creation plug-in, the method further includes:
[0024] Obtaining the amount of data in the storage data volume included in each node in the cluster;
[0025] Comparing the amount of data in each of the storage data volumes with a respective preset value of the storage data volumes;
[0026] If the data volume is greater than or equal to the preset value, the node including the storage data volume is determined to be the target node, and the data migration instruction is generated.
[0027] Optionally, the preset value is smaller than the storage space of the storage data volume.
[0028] In a second aspect, an embodiment of the present application provides a data migration device in a cluster, including:
[0029] A first acquisition module is used to acquire a new creation plug-in after monitoring a data migration instruction for an original storage data volume included in a target node in the cluster, wherein the target node is any node in the cluster;
[0030] A second acquisition module is used to acquire original creation configuration information used when creating the original storage data volume;
[0031] A creation module, used to create a new storage data volume according to the original creation configuration information and the new creation plug-in;
[0032] The transfer module is used to transfer the storage data in the original storage data volume to the new storage data volume.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0034] The memory is used to store computer programs;
[0035] The processor is used to execute the program stored in the memory to implement the data migration method in the cluster described in the first aspect.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the method for migrating data in a cluster described in the first aspect is implemented.
[0037] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application, after monitoring the data migration instruction of the original storage data volume included in the target node in the cluster, obtains a new creation plug-in, the target node is any node in the cluster; obtains the original creation configuration information used when creating the original storage data volume; creates a new storage data volume according to the original creation configuration information and the new creation plug-in; and transfers the storage data in the original storage data volume to the new storage data volume. In this way, by obtaining a new creation plug-in and replacing the creation plug-in in the creation configuration information, a new storage data volume different from the original storage data volume existing in the cluster can be generated, and then, by transferring the data in the original storage data volume to the new storage data volume, the data in the original storage data volume can be quickly backed up. Since other nodes in the cluster are operating normally, there is no need to suspend the service during the data migration process, which ensures the normal call of the data in the cluster during the migration process and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 An application scenario diagram of a method for migrating data in a cluster provided in an embodiment of the present application;
[0041] Figure 2 A flowchart of a method for migrating data in a cluster provided in an embodiment of the present application;
[0042] Figure 3 A diagram showing the data before and after migration in a cluster data migration method provided in an embodiment of the present application;
[0043] Figure 4 A structural diagram of a data migration device in a cluster provided in an embodiment of the present application;
[0044] Figure 5 A structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0046] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following explanations.
[0047] Container Cluster Management System (Kubernetes): It is an open source system for managing containerized applications on multiple hosts in a cloud platform. The goal of the container cluster management system is to make the deployment of containerized applications simple and efficient. The container cluster management system provides a mechanism for application deployment, planning, updating, and maintenance. In the container cluster management system, you can create multiple containers, each of which runs an application instance, and then use the built-in load balancing strategy to manage, discover, and access this group of application instances.
[0048] Deployment unit (Pod): Pod is the smallest / simplest basic unit created or deployed by the container cluster management system. A Pod represents a process running on the cluster. A Pod encapsulates an application container (or multiple containers), storage resources, an independent network IP, and policy options for managing and controlling how the container runs. Pod represents a unit of deployment: an instance of a single application in Kubernetes, which may consist of a single container or resources shared by multiple containers.
[0049] Data storage node (mysql): deployed in the deployment unit Pod.
[0050] A Persistent Volume Claim (PVC) is used to describe the persistent properties that a Pod wants to use, such as storage size, read and write permissions, etc.
[0051] Persistent Volume (PV): A persistent storage volume used to describe a specific volume attribute, such as the volume type, mount directory, remote storage server address, etc.
[0052] Kubernetes controller (Statefulset): When creating Pods using Pod templates, they are numbered and created one by one in the order of numbers. When the "control loop" of StatefulSet finds that the "actual state" of the Pod is inconsistent with the "expected state" and needs to create or delete Pods for "tuning", it will strictly follow the order of these Pod numbers and complete these operations one by one.
[0053] Create configuration information (StorageClass): used to automatically create storage data volumes; contains two important parts: storage data volume attributes (for example, storage type, file set (Volume) size, etc.) and the plug-in required to create this storage data volume.
[0054] Create a plug-in (Provisoner) to create storage data volumes.
[0055] Cluster: Short for computer cluster, it is a computer system that is connected by a set of loosely integrated computer software (and / or) hardware to work together to complete computing tasks. In a sense, they can be regarded as a computer. Individual computers in a cluster system are usually called nodes, usually connected through a local area network, but there are other possible connection methods. Each cluster node is an independent server running its own process. When any node in the cluster fails, all tasks on the node are automatically transferred to other normal nodes, and this process does not affect the operation of the entire cluster or the provision of services. It is similar to running two or more identical nodes in a cluster. When a master node fails, other nodes as slave nodes will take over the tasks on the master node. The slave node can take over the resources (IP address, architecture identity, etc.) of the master node. At this time, the user will not find that the object providing the service has been transferred from the master node to the slave node, and the user end has no perception.
[0056] According to an embodiment of the present application, a method for migrating data in a cluster is provided. Optionally, in the embodiment of the present application, the above-mentioned method for migrating data in a cluster can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server cluster 102 shown in FIG. Figure 1 As shown, the server cluster 102 is connected to the terminal 101 via a network, and can be used to provide services (such as video services, application services, etc.) for the terminal or a client installed on the terminal. The server cluster 102 includes multiple service nodes that provide services, and data is connected to the terminal through each service node, and data is read and written in each service node. A corresponding database is set in each service node to provide data storage services for the server cluster 102. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc.
[0057] The cluster data migration method of the embodiment of the present application may be executed by a master control server of the management server cluster 102 , or by a server of a cluster management system.
[0058] Taking the master control server executing the cluster data migration method of the embodiment of the present application as an example, Figure 2 is a flow chart of an optional method for migrating data in a cluster according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:
[0059] Step 201: after monitoring a data migration instruction for an original storage data volume included in a target node in a cluster, obtain a new creation plug-in, where the target node is any node in the cluster.
[0060] In some embodiments, the creation plug-in is a plug-in for creating a storage data volume. After a data migration instruction is detected, a stored new creation plug-in is called to obtain the new creation plug-in.
[0061] Among them, the new creation plug-in can be stored in the database of the master control server, and the creation plug-in can be called directly from the master control server when used; or the creation plug-in can be stored in the database of each service node, and after monitoring the data migration instruction of the target node, the creation plug-in can be called from the database of the target node.
[0062] It is understandable that the creation plug-in can create different types of storage data volumes according to different server types. When different nodes in the cluster correspond to different servers, the creation plug-in can create corresponding types of storage data volumes according to the type of server corresponding to the target node.
[0063] It is understandable that the number of target nodes to be determined may be one or more than two. When there is one target node, there is one server corresponding to the target node. After calling the creation plug-in, the creation plug-in can create a storage data volume of the corresponding type according to the type of the server of the target node; when there are more than two target nodes, the server types corresponding to each target node may be different. For the server corresponding to each target node, after calling the creation plug-in, the creation plug-in can automatically create a storage data volume of the corresponding type according to the type of the server of the current target node.
[0064] In some embodiments, there are multiple ways to monitor data migration instructions. For example, when a user has a need for data migration during use, the user selects the original storage data volume included in the target node in the cluster management system, triggers the migration button in the display interface of the cluster management system, and the server of the cluster management system detects the trigger operation and monitors it. Alternatively, the user may obtain the data volume of the original storage data volume included in each node in the cluster, and compare the data volume of each storage data volume with the preset value of each storage data volume. If the data volume is greater than or equal to the preset value, the node including the storage data volume is determined to be the target node.
[0065] The preset values of the storage data volumes may be the same or different. Since the space capacity of the storage data volumes included in different nodes is different, each storage data volume may be set with its own preset value.
[0066] The preset value is smaller than the storage space of the data volume. For example, if the storage space of the data volume is 10G, the preset value may be 9.8G.
[0067] After obtaining the data amount of the storage data volume included in the node, the data amount is compared with the preset value. If the data amount reaches the preset value, it means that the remaining storage space of the original storage data volume included in the node is small, so the node is used as the target node, and a data migration instruction is generated, and then the data in the original storage data volume included in the target node is migrated.
[0068] Furthermore, when there are more than two target nodes, in order to avoid the inability to accurately bind the corresponding new storage data volume after the subsequent creation of a new node, the data corresponding to each target node can be sorted according to the amount of data, and the corresponding type of storage data volume can be created for each target node in order from large to small. Alternatively, the target nodes can be sorted according to the amount of remaining storage space of the original storage data volume included in each target node, and the corresponding type of storage data volume can be created for each target node in order from small to large remaining amount.
[0069] It should be noted that after creating a new storage data volume, you need to first connect the new storage data volume to the cluster before creating the next new storage data volume.
[0070] It should be noted that a cluster usually includes multiple nodes, each of which includes its own storage data volume. During the data reading and writing process, the data written by each node is different. After writing new data, the storage data volumes included in each node in the cluster will synchronize the latest written data.
[0071] After monitoring the data migration instructions of the original storage data volume included in the target node, in order to ensure that the data does not change after obtaining the data migration instructions, the reading and writing of the storage data volume included in the target node is first suspended. After the new storage data volume is generated and the data migration is completed, the new storage data volume is used to read and write data.
[0072] The migrated data may be user data, transaction data, etc. generated by the client during operation.
[0073] Step 202: Obtain original creation configuration information used when creating the original storage data volume.
[0074] In some embodiments, when a cluster is established, storage data volumes consistent with the number of nodes are created based on the number of nodes through the configured original creation configuration information, and the original creation configuration information is saved. There is a corresponding relationship between each node and the creation configuration information, so the corresponding original creation configuration information can be directly determined through the target node.
[0075] It is understandable that after the data migration instruction is detected, there is no particular order for obtaining the new creation plug-in and obtaining the original creation configuration information. The original creation configuration information may be obtained first and then the new creation plug-in, or both may be obtained at the same time.
[0076] Step 203: Create a new storage data volume according to the original creation configuration information and the new creation plug-in.
[0077] In some embodiments, since the original creation configuration information includes the storage data volume attributes and the plug-in required to create this storage data volume (i.e., the original creation plug-in), after obtaining the new creation plug-in, when the storage data volume is subsequently created, the new creation plug-in will replace the original creation plug-in for creation, thereby creating a new storage data volume different from the original storage data volume.
[0078] In an optional embodiment, creating a new storage data volume according to the original creation configuration information and the new creation plug-in specifically includes:
[0079] Bind the original creation configuration information to the new creation plug-in; run the new creation plug-in to obtain the new storage data volume.
[0080] In some embodiments, by binding the original creation configuration information to a new creation plug-in, the new creation plug-in can replace the original creation plug-in in the original creation configuration information, wherein the storage data volume attributes in the creation configuration information remain unchanged. Thus, the new creation plug-in can be run based on the storage data volume attributes to create a new storage data volume.
[0081] Step 204: transfer the storage data in the original storage data volume to the new storage data volume.
[0082] In some embodiments, after creating a new storage data volume, the storage data in the original storage data volume included in the target node can be migrated. Specifically, by transferring the data in the original storage data volume to the new storage data volume, the effect of quickly migrating the data in the original storage data volume to the new storage data volume is achieved.
[0083] There are many ways of transferring data, for example, it can be but not limited to dump. Migrating the stored data by dumping is faster than backing up data in related technologies and can reduce the service downtime of the migration node.
[0084] In the related art, when performing data migration, the new storage data volume is created using the original creation configuration information used when creating the original storage data volume. Therefore, the storage data volume created again using the original creation configuration information is the same as the storage data volume already existing in the cluster. Therefore, during data migration, the cluster service needs to be temporarily stopped to avoid the problem of being unable to read from the new storage data volume when reading data. In the present application, by obtaining a new creation plug-in and replacing the creation plug-in in the original creation configuration information with the new creation plug-in, the newly created storage data volume is different from the original storage data volume. Therefore, when performing data migration on a certain target node, the service of the target node can be suspended first, and the storage data volumes included in other nodes can continue to be served. Since the data of the storage data volumes in the cluster are synchronized with each other, when the target node suspends service, the reading and writing of data can be obtained from other nodes. Therefore, the data of the original storage data volume included in the target node can be migrated without suspending service.
[0085] In an optional embodiment, in order to enable the new storage data volume to be connected to the cluster and continue to read and write data, after creating the new storage data volume, the target node in the cluster is deleted; a new node is created, and the new node is bound to the new storage data volume.
[0086] In some embodiments, nodes are deployed in deployment units, and the storage data volumes included in the nodes store data. Therefore, if a new storage data volume is connected to the cluster, the target node in the original storage data volume needs to be deleted (that is, the process in the original storage data volume needs to be deleted), and then restarted to bind the new storage data volume. Since the number of replicas in the cluster is fixed, a new node will be automatically created after deletion, and the new node will be bound to the new storage data volume, thereby completing the connection of the new storage data volume to the cluster.
[0087] In an optional embodiment, binding the target node to the new storage data volume includes:
[0088] Create a new persistent storage declaration; bind the persistent storage declaration to the original creation configuration information, and bind the original creation configuration information to the new creation plug-in.
[0089] In some embodiments, after creating a new node, it is also necessary to create a new persistent storage declaration. By binding the new persistent storage declaration to the original creation configuration information, the persistent storage declaration can be matched with the original creation configuration information. Since the original creation configuration information is bound to the new storage data volume, a new read and write process is established between the new node and the new storage data volume, which facilitates subsequent reading and writing through the new node.
[0090] In an optional embodiment, after transferring the data in the original storage data volume to the new storage data volume, the method further includes:
[0091] Connect the new node to the cluster; obtain incremental data sent by other nodes in the cluster, where the incremental data is the difference between the data in the storage data volume of other nodes and the data in the new storage data volume, and other nodes are nodes in the cluster except the new node.
[0092] In some embodiments, the target node will first suspend service during data migration, and other nodes in the cluster will provide read and write services. The data in the original storage data volume will be dumped to the new storage data volume. After the new node establishes and finally binds the new storage data volume, the new node can be connected to the cluster. After the new node is connected to the cluster, new data will be written and stored in the original storage data volume included in other nodes during the suspension of the target node, so incremental data will be generated. By synchronizing the incremental data to the new storage data volume, consistency of the data in the new storage data volume and the original storage data volume included in other nodes is achieved.
[0093] In a specific embodiment, the cluster data migration method of the present application is described in detail in Figure 3 ,include:
[0094] After detecting the data migration instruction, create a new creation plug-in and bind the original creation configuration information to the new creation plug-in; delete the deployment unit and persistent storage declaration of the target node; restart the deployment unit, create a new persistent storage declaration to bind the original creation configuration information, and finally bind the new storage data volume; perform data migration, dump the data in the original storage data volume to the new storage data volume, and after the data migration is completed, connect the target node to the cluster and restore the incremental data.
[0095] in, Figure 3 MySQL0, MySQL1, and MySQL2 represent different nodes. The data in the original storage data volume included in MySQL2 is migrated, wherein, in the two branches of MySQL2, the dotted line represents the process of creating the original storage data volume for the MySQL2 node, and the solid line represents the process of creating a new storage data volume for the MySQL2 node, and the process of dumping the storage data in the original storage data volume to the new storage data volume.
[0096] It is understandable that after the target node completes the migration of corresponding data and the recovery of incremental data according to the above method, the data of other nodes in the cluster can be migrated one by one according to the above method.
[0097] In addition, this application can log in to the cluster to view what data needs to be migrated and view the data that needs to be migrated.
[0098] The data migration method in the cluster of the present application realizes the migration based on the MySQL cluster migration in the container without stopping the service. It can complete the data migration without stopping the service and will not affect the business end. During the data migration process, the client has no perception and will not affect the client's use, thereby improving the user experience.
[0099] In some embodiments, the storage data volumes in the cluster are placed in the same file storage (CFS, Cloud FileStorage) instance, which enables the successful migration of data from the shared file storage instance. Each user has an exclusive file storage instance, which can realize dynamic storage and achieve the file storage pooling function, providing convenience for subsequent maintenance and expansion and reduction.
[0100] Based on the same concept, an embodiment of the present application provides a data migration device in a cluster. The specific implementation of the device can refer to the description of the method embodiment part, and the repeated parts will not be repeated. Figure 4 As shown, the device mainly includes:
[0101] The first acquisition module 401 is used to acquire a new creation plug-in after monitoring a data migration instruction for an original storage data volume included in a target node in the cluster, where the target node is any node in the cluster;
[0102] The second acquisition module 402 is used to acquire original creation configuration information used when creating the original storage data volume;
[0103] A creation module 403, used to create a new storage data volume according to the original creation configuration information and the new creation plug-in;
[0104] The transfer module 404 is used to transfer the storage data in the original storage data volume to the new storage data volume.
[0105] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 5 As shown, the electronic device mainly includes: a processor 501, a memory 502 and a communication bus 503, wherein the processor 501 and the memory 502 communicate with each other through the communication bus 503. The memory 502 stores a program that can be executed by the processor 501, and the processor 501 executes the program stored in the memory 502 to implement the following steps:
[0106] After monitoring a data migration instruction for the original storage data volume included in the target node in the cluster, a new creation plug-in is obtained, and the target node is any node in the cluster;
[0107] Get the original creation configuration information used when creating the original storage data volume;
[0108] Create a new storage data volume based on the original creation configuration information and the new creation plug-in;
[0109] Transfer the storage data in the original storage data volume to the new storage data volume.
[0110] The communication bus 503 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 503 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0111] The memory 502 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the processor 501 .
[0112] The above-mentioned processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0113] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed on a computer, the computer executes the cluster data migration method described in the above embodiment.
[0114] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.
[0115] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0116] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for data migration in a cluster, characterized in that: include: After monitoring a data migration instruction for an original storage data volume included in a target node in the cluster, obtaining a new creation plug-in, wherein the target node is any node in the cluster; Acquire original creation configuration information used when creating the original storage data volume; Creating a new storage data volume according to the original creation configuration information and the new creation plug-in; The storage data in the original storage data volume is transferred to the new storage data volume.
2. The cluster data migration method according to claim 1, characterized in that: The creating a new storage data volume according to the original creation configuration information and the new creation plug-in includes: Binding the original creation configuration information to the new creation plug-in; The new creation plug-in is run to obtain the new storage data volume.
3. The method for cluster data migration according to claim 1 or 2, characterized in that: The method further comprises: Deleting a target node in the cluster; A new node is created, and the new node is bound to the new storage data volume.
4. The method for cluster data migration according to claim 3, characterized in that: The step of binding the new node to the new storage data volume includes: Create a new persistent storage declaration; The persistent storage declaration is bound to the original creation configuration information, and the original creation configuration information is bound to the new creation plug-in.
5. The method for data migration in a cluster according to claim 3, characterized in that: After transferring the data in the original storage data volume to the new storage data volume, the method further includes: Connecting the new node to the cluster; Acquire incremental data sent by other nodes in the cluster, wherein the incremental data is difference data between data in the storage data volume included in the other nodes and data in the new storage data volume included in the new node, and the other nodes are nodes in the cluster except the new node.
6. The method for data migration in a cluster according to claim 1, characterized in that: When a data migration instruction for data corresponding to a target node in a cluster is detected, before obtaining a new creation plug-in, the method further includes: Obtaining the amount of data in the storage data volume included in each node in the cluster; Comparing the amount of data in each of the storage data volumes with a respective preset value of the storage data volumes; If the data volume is greater than or equal to the preset value, the node including the storage data volume is determined to be the target node, and the data migration instruction is generated.
7. The method for cluster data migration according to claim 6, characterized in that: The preset value is smaller than the storage space of the storage data volume.
8. A data migration device in a cluster, characterized in that: include: A first acquisition module is used to acquire a new creation plug-in after monitoring a data migration instruction for an original storage data volume included in a target node in the cluster, wherein the target node is any node in the cluster; A second acquisition module is used to acquire original creation configuration information used when creating the original storage data volume; A creation module, used to create a new storage data volume according to the original creation configuration information and the new creation plug-in; The transfer module is used to transfer the storage data in the original storage data volume to the new storage data volume.
9. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the data migration method in the cluster described in any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for migrating data in a cluster as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
ZooKeeper containerization control method and device, storage medium and electronic equipment
CN111277460A
Database data migration method and device and storage medium
CN112306994A