CN113050890B - Data migration method and device - Google Patents
Data migration method and device Download PDFInfo
- Publication number
- CN113050890B CN113050890B CN202110324765.0A CN202110324765A CN113050890B CN 113050890 B CN113050890 B CN 113050890B CN 202110324765 A CN202110324765 A CN 202110324765A CN 113050890 B CN113050890 B CN 113050890B
- Authority
- CN
- China
- Prior art keywords
- data
- directory
- directory node
- migrated
- storage system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000013508 migration Methods 0.000 title claims abstract description 54
- 230000005012 migration Effects 0.000 title claims abstract description 54
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000012544 monitoring process Methods 0.000 claims description 34
- 238000013500 data storage Methods 0.000 claims description 19
- 238000012217 deletion Methods 0.000 claims description 19
- 230000037430 deletion Effects 0.000 claims description 19
- 230000008859 change Effects 0.000 claims description 17
- 238000004590 computer program Methods 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000012423 maintenance Methods 0.000 description 4
- 238000007726 management method Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
- G06F3/0607—Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0647—Migration mechanisms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0652—Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data migration method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: determining a directory file corresponding to data to be migrated in a first storage system; traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes; obtaining data to be migrated stored in each directory node path; according to the data format of the second storage system, assembling the directory node path and the data to be migrated; and storing the assembled directory node path and the data to be migrated to the second storage system. According to the embodiment, data migration can be performed among different storage systems, and switching and upgrading of the service framework storage systems are realized.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data migration method and apparatus.
Background
For various different services which can be provided under the service framework, the same storage system is often adopted to store the configuration information, domain name and other data of the services so as to realize unified management and maintenance of the different services under the service framework.
With the development and progress of storage systems, in order to improve the management and maintenance efficiency of services, it is necessary to switch or upgrade the storage systems that are currently used in the service framework. Because the data storage structures adopted by different storage systems are different, the data in the storage systems need to be migrated before the storage systems can be switched or upgraded. However, at present, data migration between different storage systems cannot be directly realized, and therefore, the storage systems of the service framework cannot be directly switched or upgraded.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a data migration method and apparatus, which can perform data migration between different storage systems, so as to implement switching and upgrading of a service framework storage system.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data migration method, including:
determining a directory file corresponding to data to be migrated in a first storage system;
Traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes;
Obtaining data to be migrated stored in each directory node path;
According to the data format of the second storage system, assembling the directory node path and the data to be migrated;
and storing the assembled directory node path and the data to be migrated to the second storage system.
Optionally, assembling the directory node path and the data to be migrated in a key-value form; and the directory node path is a key, and the data to be migrated is a value.
Optionally, the method further comprises:
and monitoring the directory node corresponding to each directory node path, so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
Optionally, the event includes any one or more of: directory node creation events, directory node deletion events, directory node data change events, directory node under-directory node sub-directory node deletion events.
Optionally, under the condition that a directory node data change event is monitored, updated data to be migrated stored under a directory node path is obtained from the first storage system, so as to update the data to be migrated corresponding to the directory node path in the second storage system.
Optionally, under the condition that a directory node deleting event is monitored, monitoring on the directory node is canceled, and a directory node path and data to be migrated corresponding to the directory node in the second storage system are deleted.
Optionally, under the condition that the event of creating the directory node is monitored, storing the directory node path corresponding to the created directory node and the data to be migrated into the second storage system, and monitoring the created directory node.
Optionally, under the condition that a subdirectory node deleting event under the directory node is monitored, monitoring on the directory node and the subdirectory node under the directory node is canceled;
and deleting all directory node paths containing the directory nodes and data to be migrated corresponding to the directory node paths in the second storage system.
Optionally, the directory node paths are stored in an array variable, so that the directory node corresponding to each directory node path is monitored by traversing the array variable.
Optionally, the first storage system is a Zookeeper, and the second storage system is Etcd.
To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided a data migration apparatus including: catalog file determining module, node path obtaining module, migration data obtaining module, data assembling module, data storing module: wherein,
The catalog file determining module is used for determining catalog files corresponding to data to be migrated in the first storage system;
the node path acquisition module is used for traversing the directory file to acquire one or more directory node paths from the root directory to the directory nodes;
the migration data acquisition module is used for acquiring data to be migrated stored in each directory node path;
the data assembling module is used for assembling the directory node path and the data to be migrated according to the data format of the second storage system;
and the data storage module is used for storing the assembled directory node path and the data to be migrated to the second storage system.
Optionally, the data assembling module is configured to assemble the directory node path and the data to be migrated in a key-value form; and the directory node path is a key, and the data to be migrated is a value.
Optionally, the data storage module is further configured to,
And monitoring the directory node corresponding to each directory node path, so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
Optionally, the event includes any one or more of: directory node creation events, directory node deletion events, directory node data change events, directory node under-directory node sub-directory node deletion events.
Optionally, the data storage module is further configured to,
Under the condition that the directory node data change event is monitored, updated data to be migrated stored in the directory node path is obtained from the first storage system, so that the data to be migrated corresponding to the directory node path in the second storage system is updated.
Optionally, the data storage module is further configured to,
And under the condition that the catalog node deleting event is monitored, monitoring on the catalog node is canceled, and the catalog node path and the data to be migrated corresponding to the catalog node in the second storage system are deleted.
Optionally, the data storage module is further configured to,
And under the condition that the directory node creation event is monitored, storing the directory node path corresponding to the created directory node and the data to be migrated to the second storage system, and monitoring the created directory node.
Optionally, under the condition that a subdirectory node deleting event under the directory node is monitored, monitoring on the directory node and the subdirectory node under the directory node is canceled;
and deleting all directory node paths containing the directory nodes and data to be migrated corresponding to the directory node paths in the second storage system.
Optionally, the data storage module is configured to store the directory node paths to an array variable, so as to monitor, by traversing the array variable, a directory node corresponding to each directory node path.
Optionally, the first storage system is a Zookeeper, and the second storage system is Etcd.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic device for data migration, including: one or more processors; and storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement any of the methods of data migration described above.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements any one of the data migration methods described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of traversing directory files in a first storage system, obtaining directory node paths from the target to the directory nodes and data to be migrated stored under the directory node paths, and assembling the directory node paths and the data to be migrated according to a data format of a second storage system so as to store the data to the second storage system, so that data migration between the first storage system and the second storage system with different data storage structures is realized, and the first storage system can be directly switched or used as the second storage system.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a data migration method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of another data migration method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main modules of a data migration apparatus according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
Fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a data migration method according to an embodiment of the present invention, and as shown in fig. 1, the data migration method may specifically include the following steps:
step S101, determining a directory file corresponding to data to be migrated in a first storage system.
That is, the first storage system stores service configuration information, service port numbers, service domain names, and waiting for migration data in a directory structure. Specifically, taking the first storage system as a Zookeeper as an example, the Zookeeper is taken as an important component of Hadoop and Hbase, and provides services such as configuration maintenance, domain name service, distributed synchronization and the like for a plurality of application services, so that a directory file stored therein is provided with one or more directory nodes, including a root directory node, a child directory node, a descendant directory node and the like. More specifically, the directory structure indicated by the directory file corresponding to the data to be migrated in the Zookeeper is as follows:
root_key:// root directory
Level_1_key1:// first tier directory node 1
Level 2 key 1:// second level directory node 1
Level 3 key 1:// third tier directory node 1
Level 4 key 1:// layer four directory node 1
Level_5_key1:// fifth level directory node 1
Level_5_key2:// fifth level directory node 2
Level 4 key 2:// layer four directory node 2
Level 3 key 2:// third tier directory node 2
Level 2 key2:// second level directory node 2
Level_1_key2:// first tier directory node 2
The root_key, the level_1_key1, the level_1_key2 and the like are directory nodes; further, root_key is a root directory node, level_1_key1 and level_1_key2 are child directory nodes under the root directory, level_2_key1 is a child directory node under level_1_key1, and level_3_key1 is a child directory node under level_2_key1 or a child directory node under level_1_key1. It can be seen that the same directory node may be either a child directory node of another directory node or a descendant directory node of another directory node. That is, for any one directory node, it may or may not have a child directory node of the next level; in addition, service configuration information, a service port number, service domain name waiting migration data may be stored under each directory node, and the corresponding data waiting for migration may be empty.
Step S102, traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes.
Specifically, still taking the directory file in the Zookeeper as an example, a directory node path traversing from a root directory node to any directory node can be obtained. Taking the directory node level_1_key1 as an example, the corresponding directory node path is/root_key/level_1_key1, and taking the directory node level_2_key1 as an example, the corresponding directory node path is/root_key/level_1_key1/lev2_1_key1, and further, one or more directory node paths acquired after traversing the directory file are as follows:
/root_key
/root_key/level_1_key1
/root_key/level_1_key1/level_2_key1
/root_key/level_1_key1/level_2_key1/level_3_key1
/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1
/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1/level_5_key1
/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1/level_5_key2
/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key2
/root_key/level_1_key1/level_2_key1/level_3_key2
/root_key/level_1_key1/level_2_key2
/root_key/level_1_key2
step S103, obtaining the data to be migrated stored in each directory node path.
Specifically, the corresponding data to be migrated can be obtained by directly reading the data stored under the directory node path. Because the service configuration information, the service port number and the service domain name waiting for the migration data may be stored under each directory node, and the corresponding data to be migrated may be empty, in order to ensure normal management and maintenance of the service after migration, when the data to be migrated is read to be empty, the corresponding directory path node is still reserved, and the corresponding data to be migrated is directly recorded to be empty or blank.
Step S104, according to the data format of the second storage system, the directory node path and the data to be migrated are assembled.
In particular, taking the second storage system Etcd as an example, compared with the Zookeeper, in terms of function implementation, etcd can capture all events by only calling a watch operation once, so that the workload of a client developer is greatly simplified; in terms of code development, etcd uses the Go language and the Google gRPC protocol, while the ZooKeeper uses the Java language and its own TCP protocol, so that a developer is limited to the SDK provided by the ZooKeeper official, and only can directly use Java and C languages for development, so that flexibility is low, and in some business scenarios, etcd is considered to replace ZooKeeper storage configuration information and the like to manage and maintain services. Since Etcd adopts a distributed key-value pair (key-value) database to store metadata such as configuration information and the like so as to coordinate and manage services, the directory node path and the data to be migrated are assembled in a key-value form under the condition that Etcd is adopted to replace a Zookeeper; and the directory node path is a key, and the data to be migrated is a value. Based on this, the assembled directory node path, data to be migrated, are exemplified as follows:
(/root_key,root_key_value)
(/root_key/level_1_key1,level_1_key1_value)
(/root_key/level_1_key1/level_2_key1,level_2_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1,level_3_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1,level_4_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1/level_5_key1,level_5_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1/level_5_key2,level_5_key2_value)
Step S105, storing the assembled directory node path and the data to be migrated to the second storage system.
That is, by synchronizing the assembled directory node path with the key-value form and the total amount of data to be migrated to the second storage system Etcd, the migration of the data such as the configuration information stored in the first storage system Zookeeper to the second storage system Etcd is realized, and based on this, etcd can be used to replace the Zookeeper to manage and maintain the application service.
It will be appreciated that during one migration of data in the first storage system to the second storage system, or before the first storage system is switched to the second storage system, the directory node and the data to be migrated in the first storage system may still change, so in an alternative embodiment, to ensure high availability of the second storage system, the method further includes: and monitoring the directory node corresponding to each directory node path, so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
Wherein the event comprises any one or more of the following: directory node creation events, directory node deletion events, directory node data changes, directory node under-directory node subdirectory node deletion events. Specifically, the snoopable (watch) events in the Zookeeper share the following:
EventNodeCreated: directory node creation event
EventNodeDeleted: directory node delete event
EventNodeDataChanged: directory node data change event
EventNodeChildrenChanged: sub-directory node change event under directory node
The event of changing subdirectory node under the directory node specifically comprises subdirectory node creation, subdirectory node deletion and subdirectory node data change. However, in the embodiment of the present invention, the monitoring of the above-mentioned directory node creation event, directory node deletion event, directory node data change event is performed for each directory node including, but not limited to, a root directory, a child directory node, a descendant directory node, etc., so as to avoid repetition of the child directory node change event under the directory node, so that only monitoring of the child directory node deletion event under the directory node is reserved.
More specifically, one or more directory node paths obtained by traversing the directory file may be stored in an array variable, so as to monitor, by traversing the array variable, a directory node corresponding to each directory node path. It will be appreciated that the monitoring may also be performed by writing directory node paths to files or tables, etc.
In an optional implementation manner, under the condition that a directory node data change event is monitored, updated data to be migrated stored in a directory node path is obtained from the first storage system, so as to update the data to be migrated corresponding to the directory node path in the second storage system.
In an optional implementation manner, under the condition that a directory node deletion event is monitored, monitoring of the directory node is canceled, and the directory node path and data to be migrated corresponding to the directory node in the second storage system are deleted.
In an alternative embodiment, if the event of creating the directory node is monitored, the directory node path corresponding to the created directory node and the data to be migrated are stored in the second storage system, and the created directory node is monitored.
In an alternative embodiment, in case of monitoring a subdirectory node deletion event under a directory node, monitoring of the directory node, subdirectory nodes under the directory node is canceled; and deleting all directory node paths containing the directory nodes and data to be migrated corresponding to the directory node paths in the second storage system.
Based on the above embodiment, by traversing the directory file in the first storage system, obtaining the directory node path from the destination to the directory node and the data to be migrated stored under the directory node path, and assembling the directory node path according to the data format of the second storage system, where the data to be migrated is stored in the second storage system, the data migration between the first storage system and the second storage system with different data storage structures is implemented, and thus the first storage system can be directly switched or used as the second storage system.
Referring to fig. 2, on the basis of the foregoing embodiment, the embodiment of the present invention provides another data migration method, which may specifically include the following steps:
Step S201, determining a directory file corresponding to the data to be migrated in the first storage system.
Step S202, traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes.
Step S203, obtaining data to be migrated stored in each directory node path.
Step S204, according to the data format of the second storage system, the directory node path and the data to be migrated are assembled.
Step S205, storing the assembled directory node path and the data to be migrated to the second storage system.
Step S206, monitoring the directory node corresponding to each directory node path. Specifically, in the case where the directory node data change event is heard, the following step S207 is continued to be executed; if the event of deleting the directory node is monitored, the following step S208 is continued; in the case where the directory node creation event is monitored, the following step S209 is continued; in the case where the event of deletion of the subdirectory node under the directory node is heard, the following step S210 is continued.
Step S207, obtaining updated data to be migrated stored in the directory node path from the first storage system, so as to update the data to be migrated corresponding to the directory node path in the second storage system.
Specifically, when it is monitored that the directory node level_1_key1 data corresponding to the directory node path/root_key/level_1_key1 is changed to be described as an example, the latest data to be migrated (e.g. 152) stored under the directory node path/root_key/level_1_key1 is obtained from the first storage system, and then the value in the key value pair (/ root_key/level_1_key1, level_1_key1_value) stored in the second storage system is updated to 152.
And step S208, canceling monitoring of the directory nodes, and deleting the directory node paths and the data to be migrated corresponding to the directory nodes in the second storage system.
Specifically, describing the event of deleting the directory node corresponding to the directory node level_2_key1 as an example, the key value pair (/ root_key/level_1_key1/level_2_key1, level_2_key1_value) is deleted from the second storage system.
Step S209, storing the directory node path and the data to be migrated corresponding to the created directory node to the second storage system, and monitoring the created directory node.
Taking the case of monitoring that a new directory node level_1_key3 is created under the directory node root_key as an example, monitoring events such as a directory node creation event, a directory node deletion event, a directory node data change, a sub-directory node deletion event under the directory node and the like are carried out on the directory node level_1_key3, and simultaneously, a key value pair (/ root_key/level_1_key3, level_1_key3_value) corresponding to the directory node level_1_key3 is stored into a second storage system.
Step S210, monitoring of the directory node and sub-directory nodes under the directory node is canceled, and all directory node paths containing the directory node and data to be migrated corresponding to the directory node paths in the second storage system are deleted.
Taking the event of deleting the subdirectory node under the directory node corresponding to the monitored level_1_key1 as an example, because the directory node paths corresponding to the directory node level_1_key1 and the subdirectory nodes level_2_key1, level_3_key1, level_4_key1, level_5_key1 and the like all comprise the directory node level_1_key1, the monitoring of the directory node level_1_key1 and the subdirectory nodes level_2_key1, level_3_key1, level_4_key1, level_5_key1 and the like is canceled; meanwhile, the corresponding key value pairs of the directory nodes level_1_key1, level_2_key1, level_3_key1, level_4_key1, level_5_key1 and the like are deleted in the second storage system, namely the following key value pairs are deleted from the second storage system:
(/root_key/level_1_key1,level_1_key1_value)
(/root_key/level_1_key1/level_2_key1,level_2_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1,level_3_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1,level_4_key1_value)
(/root_key/level_1_key1/level_2_key1/level_3_key1/level_4_key1/level_5_key1,level_5_key1_value)
Therefore, after the data in the first storage system is synchronized to the second storage system in one-time whole quantity, real-time performance and effectiveness of the directory node path and the data to be migrated in the second storage system are guaranteed through monitoring of the directory node, and high availability of the second storage system is improved.
Referring to fig. 3, on the basis of the above embodiment, an embodiment of the present invention provides a data migration apparatus 300, including: catalog file determination module 301, node path acquisition module 302, migration data acquisition module 303, data assembly module 304, data storage module 305: wherein,
The directory file determining module 301 is configured to determine a directory file corresponding to data to be migrated in the first storage system;
the node path obtaining module 302 is configured to traverse the directory file to obtain one or more directory node paths from the root directory to the directory nodes;
The migration data obtaining module 303 is configured to obtain data to be migrated stored in each directory node path;
the data assembling module 304 is configured to assemble the directory node path and the data to be migrated according to a data format of the second storage system;
the data storage module 305 is configured to store the assembled directory node path and the data to be migrated to the second storage system.
In an alternative embodiment, the data assembling module 304 is configured to assemble the directory node path and the data to be migrated in a key-value form; and the directory node path is a key, and the data to be migrated is a value.
In an alternative embodiment, the data storage module 305 is further configured to,
And monitoring the directory node corresponding to each directory node path, so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
In an alternative embodiment, the event includes any one or more of the following: directory node creation events, directory node deletion events, directory node data change events, directory node under-directory node sub-directory node deletion events.
In an alternative embodiment, the data storage module 305 is further configured to,
Under the condition that the directory node data change event is monitored, updated data to be migrated stored in the directory node path is obtained from the first storage system, so that the data to be migrated corresponding to the directory node path in the second storage system is updated.
In an alternative embodiment, the data storage module 305 is further configured to,
And under the condition that the catalog node deleting event is monitored, monitoring on the catalog node is canceled, and the catalog node path and the data to be migrated corresponding to the catalog node in the second storage system are deleted.
In an alternative embodiment, the data storage module 305 is further configured to,
And under the condition that the directory node creation event is monitored, storing the directory node path corresponding to the created directory node and the data to be migrated to the second storage system, and monitoring the created directory node.
In an alternative embodiment, in case of monitoring a subdirectory node deletion event under a directory node, monitoring of the directory node, subdirectory nodes under the directory node is canceled; and deleting all directory node paths containing the directory nodes and data to be migrated corresponding to the directory node paths in the second storage system.
In an alternative embodiment, the data storage module 305 is configured to store the directory node paths to array variables, so as to monitor, by traversing the array variables, the directory node corresponding to each directory node path.
In an alternative embodiment, the first storage system is a Zookeeper and the second storage system is Etcd.
Fig. 4 illustrates an exemplary system architecture 400 in which a data migration method or data migration apparatus of embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various applications, such as a visualization application, etc., may be installed on the terminal devices 401, 402, 403 to demonstrate the progress of data migration.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, for example, a background management server processing a data migration request sent by a user using the terminal devices 401, 402, 403, so as to feed back a data migration progress to the terminal devices.
It should be noted that, the data migration method provided in the embodiment of the present invention is generally executed by the server 405, and accordingly, the data migration device is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises a catalog file determining module, a node path obtaining module, a migration data obtaining module, a data assembling module and a data storage module element. The names of these modules do not in some cases limit the module itself, and for example, the directory file determining module may also be described as "a module for determining a directory file corresponding to data to be migrated in the first storage system".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: determining a directory file corresponding to data to be migrated in a first storage system; traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes; obtaining data to be migrated stored in each directory node path; according to the data format of the second storage system, assembling the directory node path and the data to be migrated; and storing the assembled directory node path and the data to be migrated to the second storage system.
According to the technical scheme of the embodiment of the invention, the directory node path from the destination to the directory node and the data to be migrated stored under the directory node path are obtained by traversing the directory file in the first storage system, and the directory node path and the data to be migrated are assembled according to the data format of the second storage system so as to be stored in the second storage system, so that the data migration between the first storage system and the second storage system with different data storage structures is realized, and the first storage system can be directly switched or changed into the second storage system.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (11)
1. A method of data migration, comprising:
determining a directory file corresponding to data to be migrated in a first storage system;
Traversing the directory file to obtain one or more directory node paths from the root directory to the directory nodes;
Obtaining data to be migrated stored in each directory node path;
According to the data format of the second storage system, assembling the directory node path and the data to be migrated; assembling the directory node path and the data to be migrated in a key-value form; the directory node path is a key, and the data to be migrated is a value;
storing the assembled directory node path and the data to be migrated to the second storage system;
and monitoring the directory node corresponding to each directory node path, so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
2. The method of data migration according to claim 1, wherein,
The event includes any one or more of the following: directory node creation events, directory node deletion events, directory node data change events, directory node under-directory node sub-directory node deletion events.
3. The method of data migration as claimed in claim 2, wherein,
Under the condition that the directory node data change event is monitored, updated data to be migrated stored in the directory node path is obtained from the first storage system, so that the data to be migrated corresponding to the directory node path in the second storage system is updated.
4. The method of data migration as claimed in claim 2, wherein,
And under the condition that the catalog node deleting event is monitored, monitoring on the catalog node is canceled, and the catalog node path and the data to be migrated corresponding to the catalog node in the second storage system are deleted.
5. The method of data migration as claimed in claim 2, wherein,
And under the condition that the directory node creation event is monitored, storing the directory node path corresponding to the created directory node and the data to be migrated to the second storage system, and monitoring the created directory node.
6. The method of data migration as claimed in claim 2, wherein,
Under the condition that a subdirectory node deleting event under a directory node is monitored, monitoring of the directory node and the subdirectory node under the directory node is canceled;
and deleting all directory node paths containing the directory nodes and data to be migrated corresponding to the directory node paths in the second storage system.
7. The method of data migration according to claim 1, wherein,
And storing the directory node paths into array variables, and monitoring the directory nodes corresponding to each directory node path in a manner of traversing the array variables.
8. The method of data migration according to claim 1, wherein,
The first storage system is a Zookeeper, and the second storage system is Etcd.
9. A data migration apparatus, comprising: catalog file determining module, node path obtaining module, migration data obtaining module, data assembling module, data storing module: wherein,
The catalog file determining module is used for determining catalog files corresponding to data to be migrated in the first storage system;
the node path acquisition module is used for traversing the directory file to acquire one or more directory node paths from the root directory to the directory nodes;
the migration data acquisition module is used for acquiring data to be migrated stored in each directory node path;
The data assembling module is used for assembling the directory node path and the data to be migrated according to the data format of the second storage system; assembling the directory node path and the data to be migrated in a key-value form; the directory node path is a key, and the data to be migrated is a value;
The data storage module is used for storing the assembled directory node path and the data to be migrated to the second storage system; and the method is also used for monitoring the directory node corresponding to each directory node path so as to process the directory node path and the data to be migrated stored in the second storage system according to the monitored event.
10. An electronic device for data migration, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-8.
11. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110324765.0A CN113050890B (en) | 2021-03-26 | 2021-03-26 | Data migration method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110324765.0A CN113050890B (en) | 2021-03-26 | 2021-03-26 | Data migration method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113050890A CN113050890A (en) | 2021-06-29 |
CN113050890B true CN113050890B (en) | 2024-10-18 |
Family
ID=76515461
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110324765.0A Active CN113050890B (en) | 2021-03-26 | 2021-03-26 | Data migration method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113050890B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113468509B (en) * | 2021-07-05 | 2024-01-30 | 曙光信息产业(北京)有限公司 | User authentication migration method, device, equipment and storage medium |
CN117370310B (en) * | 2023-10-19 | 2024-05-28 | 中电云计算技术有限公司 | Distributed file system cross-cluster data increment migration method |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102667772A (en) * | 2010-03-01 | 2012-09-12 | 株式会社日立制作所 | File level hierarchical storage management system, method, and apparatus |
CN105530273A (en) * | 2014-09-29 | 2016-04-27 | 国际商业机器公司 | Method and device for data migration |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7672981B1 (en) * | 2007-02-28 | 2010-03-02 | Emc Corporation | Object classification and indexing of very large name spaces using grid technology |
EP2840481B1 (en) * | 2013-07-02 | 2017-09-06 | Hitachi Data Systems Engineering UK Limited | Apparatus and computer program product for virtualization of a file system |
CN106933508B (en) * | 2017-02-14 | 2020-05-12 | 深信服科技股份有限公司 | Application container migration method and device |
CN106953893A (en) * | 2017-02-15 | 2017-07-14 | 北京百度网讯科技有限公司 | Data Migration between cloud storage system |
CN109150936A (en) * | 2017-06-19 | 2019-01-04 | 北京宝兰德软件股份有限公司 | The sharing method and device of session object Session in a kind of distributed type assemblies |
CN107391629B (en) * | 2017-06-30 | 2021-01-29 | 三六零科技集团有限公司 | Method, system, server and computer storage medium for data migration between clusters |
CN109753229B (en) * | 2017-11-08 | 2020-09-18 | 华为技术有限公司 | Data migration method and device, network attached storage equipment and storage medium |
CN110019208A (en) * | 2017-11-14 | 2019-07-16 | 中国移动通信有限公司研究院 | A kind of data migration method, device and medium |
US10769117B2 (en) * | 2018-01-18 | 2020-09-08 | International Business Machines Corporation | Effective handling of HSM migrated files and snapshots |
CN110543520B (en) * | 2019-08-30 | 2022-02-01 | 京东科技控股股份有限公司 | Data migration method and device |
-
2021
- 2021-03-26 CN CN202110324765.0A patent/CN113050890B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102667772A (en) * | 2010-03-01 | 2012-09-12 | 株式会社日立制作所 | File level hierarchical storage management system, method, and apparatus |
CN105530273A (en) * | 2014-09-29 | 2016-04-27 | 国际商业机器公司 | Method and device for data migration |
Also Published As
Publication number | Publication date |
---|---|
CN113050890A (en) | 2021-06-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113050890B (en) | Data migration method and device | |
CN112965761B (en) | Data processing method, system, electronic equipment and storage medium | |
CN111309415A (en) | UI (user interface) information processing method and device of application program and electronic equipment | |
CN111290871A (en) | Method and device for acquiring crash information of application program | |
CN114157658A (en) | Mirror image warehouse deployment method and device, electronic equipment and computer readable medium | |
CN113742376A (en) | Data synchronization method, first server and data synchronization system | |
CN113364887A (en) | File downloading method based on FTP, proxy server and system | |
CN111309366B (en) | Method, device, medium and electronic equipment for managing registration core | |
CN110674082B (en) | Method and device for removing online document, electronic equipment and computer readable medium | |
CN116737662A (en) | Method, device, electronic equipment and storage medium for processing business data | |
CN115480877A (en) | External exposure method and device of application service in multi-cluster environment | |
CN112306984A (en) | Data source routing method and device | |
CN115442129A (en) | Method, device and system for managing cluster access authority | |
CN116049142A (en) | Data processing method, device, electronic equipment and storage medium | |
CN111984686A (en) | Data processing method and device | |
CN113722007B (en) | Configuration method, device and system of VPN branch equipment | |
CN110851192B (en) | Method and device for responding to degraded switch configuration | |
CN115189931A (en) | Distributed key management method, device, equipment and storage medium | |
CN110058790B (en) | Method, apparatus and computer program product for storing data | |
CN112882741A (en) | Application management system and method | |
CN111309367A (en) | Method, device, medium and electronic equipment for managing service discovery | |
CN114077639B (en) | Data writing method, device, electronic equipment and storage medium | |
CN114500485B (en) | Data processing method and device | |
CN111199000B (en) | Method and device for processing request | |
CN112583614B (en) | Host cluster management method, device and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |