Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite not making creative work, all belongs to the scope of protection of the invention.
The online moving method schematic flow sheet of file that Fig. 1 provides for the embodiment of the present invention one.The file that the present embodiment can realize between two NAS equipment moves online, and as shown in Figure 1, the online moving method of the present embodiment file can comprise the following steps:
Step 101, share agreement by network file source device is mounted to target device;
Wherein, source device and target device are NAS equipment.
Network file is shared agreement and is specifically as follows Server Message Block (Server Message Block, SMB) agreement, or NFS (Network File System, NFS) agreement.It will be appreciated by persons skilled in the art that in practical application, can arrange on NAS equipment as required and support SMB agreement or NFS agreement, share to set up network file by this agreement and other equipment.It will be understood by those skilled in the art that after source device is mounted to target device, target device just can file system on access originator equipment.
Step 102, set up the image file of source device files on the target device, this image file is initially empty file;
Step 103, to be shared agreement by network file the data in source device files are migrated in image file corresponding on target device by Internet Transmission;
Step 104, in data migration process by the access request of target device process user.
In the present embodiment, source device and target device are NAS equipment, when to need the file migration on source device to target device, share agreement by network file and source device is mounted to target device, then by target device at the image file self setting up source device files, and after image file is set up, in corresponding migrated file Data Migration in file each on source device set up to target device by Internet Transmission, and processed by the access request of target device to user in data migration process, do not need to interrupt customer service.
The online moving method of the file that the present embodiment provides, utilize network file to share agreement and source device is mounted to target device, and after target device establishes mirror image file, utilize Internet Transmission to carry out the migration of file data, and processed by the access request of target device to user in file migration process, thus the online migration of file can be realized, do not need in file migration process to interrupt customer service; The online moving method of the file that the present embodiment provides by the restriction of file migration equipment self, does not have higher compatibility, and the file between the NAS equipment that can be applicable to various criterion or manufacturer moves online, improves practicality and applicability that file moves online.
The online moving method schematic flow sheet of file that Fig. 2 provides for the embodiment of the present invention two.The online moving method of the present embodiment file can comprise the following steps:
Step 201, target device share agreement carry source device by network file;
Step 202, target device share the metadata of agreement to source device acquisition request source device files by network file;
Step 203, target device are according to the metadata of the source device files obtained, and set up the image file corresponding with the file on source device, each image file is initially empty file;
Step 204, target device, after image file is set up, notify that customer service switches in image file corresponding on target device by keeper;
Step 205, target device are shared agreement by network file and the data in source device files are migrated to target device by Internet Transmission;
Step 206, target device, in data migration process, process the access request of user;
On step 207, source device, the data of each file all move on target device after corresponding image file, can verification msg content, are rolled off the production line by source device from target device.
In above-mentioned steps 201, target device and source device are NAS equipment, these two NAS equipment can be the equipment adopting identical standard, or adopt the equipment of various criterion, also can be that different vendor manufactures, and these two NAS equipment all support identical network file sharing protocol, like this, target device just can be shared agreement by network file and source device is mounted to target device, makes target device can be visited information in source device by network.
In above-mentioned steps 202 and step 203, during by source device carry to target device, specifically can pass through Server Message Block (Server Message Block, SMB) agreement, or NFS (NetworkFile System, NFS) source device is mounted to target device by agreement, it will be understood by those skilled in the art that, in practical application, can arrange on NAS equipment as required and support SMB agreement or NFS agreement, share to set up network file by this agreement and other equipment.Target device is by after source device carry, just can send metadata request information to source device, after source device receives this metadata request information, the metadata of the file that just self can be stored returns to target device, wherein, the metadata of file is the attribute information of file, for the associated description information of file, comprise file size, file modification information and file extent attribute etc., wherein file extent attribute comprises the information such as file access path, like this, after target device obtains the metadata of the file on source device, just can set up image file identical with its attribute, wherein, the image file set up is empty file, be understandable that, when source device there being multiple file, need again target device sets up multiple image file accordingly, and these image files are empty file.
In practical application, above-mentioned steps 202 and step 203 are establishing mirror image in file processes, also can set up target monitoring point on the target device, with the situation of change of monitor source equipment files, and at the synchronous image file corresponding with the file changed of target device.Due in the process establishing mirror image file, file on source device likely can change, data etc. are such as increased newly, the metadata of file is caused to change, therefore, by the situation of change of monitor source equipment files, can in image file process of establishing, the metadata of the file changed by source device carries out synchronously, guaranteeing the consistent of file attribute to image file corresponding on target device.
Particularly, to the monitoring of the situation of change of source device files, index node by Linux is monitored (inotify) to realize, wherein, Inotify is a Linux characteristic, can monitor file system operation, such as read, write and establishment etc., thus can the change of monitor source equipment files in real time, this monitoring can be arranged on the target device, and shares by network file the change that agreement carrys out monitor source equipment files.
In above-mentioned steps 204, after target device establishes mirror image file, just can notify that customer service is switched to target device by manager, to be processed by the request of target device to user.It will be understood by those skilled in the art that and customer service is switched to target device, can by the domain name that user is accessed, the access domain name of the file namely source device stored, points to the IP address of target device.In practical application, also can automatically notify that domain name system changes IP address corresponding to domain name by target device or source device, so that the access of user is directed to target device, the present embodiment is to this and be not particularly limited.
In above-mentioned steps 205 and step 206, after customer service switches to target device, just can share agreement by network file, by the data copy in file each on source device to target device in corresponding image file, to realize the Data Migration of image file.In addition, in data migration process, target device can receive the access request of user, the access request of user is processed, such as when user's read data, can by corresponding data from target device this locality read be supplied to user, or by network file share agreement by target device from source device read after reoffer to user.
In above-mentioned steps 207, after source device data all migrate to target device, just can the data on target device be verified, such as, mode by manual verification verify data on target device whether with the data consistent on target device, and after verifying, uninstalled from target device by source device, thus complete the online migration of file.
In addition, establish mirror image in above-mentioned steps 203 and 204 file time, also can not set up control point to monitor source device files situation of change, but before target device has not also set up image file, target device can process the access request of user by notification source equipment time-out.Because the image file process of establishing time is shorter, within this short period, suspend the process to access request, therefore less to the normal influence on system operation of customer service.
The schematic flow sheet that the access request of target device to user that Fig. 3 provides for the embodiment of the present invention three processes.On above-mentioned Fig. 1 or technical scheme basis embodiment illustrated in fig. 2, set up the image file of source device files when target device and the access request of user is pointed to after target device, target device just can process the access request of user, particularly, as shown in Figure 3, target device, when processing the read request in the access request of user, can comprise the following steps:
Step 301, target device receive the read request that user sends;
Step 302, searching the data whether target device existing read request and will read, is perform step 303, otherwise, perform step 304;
Step 303, read data from the image file of target device, and return to user, terminate.
Step 304, target device are shared agreement by network file and are read the read request data that will read from source device, return to user, end.
In the present embodiment, after customer service switches to target device, target device will ask the data read according to read request, confirm whether these data have existed in corresponding image file, then direct from this locality reading data, otherwise, share agreement by network file, from source device, read corresponding data in corresponding file.
It will be understood by those skilled in the art that target device is when reading the data on source device, according to the access path information in the extended attribute recorded in file metadata, can share agreement by network file, file reading data from source device.
By the Data Migration of source device file in the process of target device, because the data of user's request may migrate in the image file of target device, also likely also target device is not migrated to, therefore, when the present embodiment receives the read request of user's transmission, can judge to ask the data read whether to be present in target device, to determine whether that needing target device to share agreement by network file obtains from source device, to guarantee carrying out smoothly of customer service.
The schematic flow sheet that the access request of target device to user that Fig. 4 provides for the embodiment of the present invention four processes.With above-mentioned technical scheme embodiment illustrated in fig. 3 unlike, the present embodiment is on above-mentioned Fig. 1 or technical scheme basis embodiment illustrated in fig. 2, when processing read request, if desired data are obtained from source device, can the data of acquisition be stored on image file, and then return to user, specifically can comprise the following steps:
Step 401, target device receive the read request that user sends;
Step 402, searching the data whether target device existing read request and will read, is perform step 403, otherwise, perform step 404;
Step 403, read data from the image file of target device, and return to user, terminate.
Step 404, target device are shared agreement by network file and are read the read request data that will read from source device;
Step 405, the data that read from source device are stored on the target device in corresponding image file;
Step 406, these data are returned to user, terminate.
In the present embodiment, the data that will read as user are not on the target device, need by network file share agreement read corresponding data from source device time, the data read from source device can be stored after in the corresponding image file set up on the target device returns to user by the data of reading again, like this, follow-up repetition can be avoided to read this data from source device, to save the Data Migration time; In addition, because the data of user's access are often the data needing amendment or access, after being stored in target device, the again access of user to these data can be convenient to, to improve the treatment effeciency of user access request.
The schematic flow sheet that the access request of target device to user that Fig. 5 provides for the embodiment of the present invention five processes.On above-mentioned Fig. 1 to Fig. 4 arbitrary illustrated embodiment technical scheme basis, further comprises when target device receives the write request of user, to the handling process that the write request of user processes, particularly, as shown in Figure 5, the present embodiment target device processes the write request in the access request of user, can comprise the following steps:
Step 501, target device receive the write request that user sends;
Whether step 502, the data of searching in image file corresponding to data that write request will write at target device have moved, and are perform step 503, otherwise perform step 504;
Step 503, directly the data that write request will be write are write in corresponding image file, terminate;
Step 504, the data that write request will be write to be write in temporary file, so that the Data Migration in corresponding image file is write in image file after completing again.
In above-mentioned steps 502, when receiving the write request that user sends, first can determine whether the data in the image file that data that this write request will be write are corresponding have moved, wherein, the data of file corresponding with this image file on source device all copy this image file to, then illustrate that the Data Migration in image file completes.
In the present embodiment, when processing the write request of user, the data that can will need to write in image file that Data Migration not yet completes, temporarily write in a temporary file, until the Data Migration of corresponding image file completes, or the data of whole source device all migrate to target device, then the data write in temporary file are write corresponding image file.
The schematic flow sheet that the access request of target device to user that Fig. 6 provides for the embodiment of the present invention six processes.On above-mentioned Fig. 1 to Fig. 4 arbitrary illustrated embodiment technical scheme basis, further comprises when target device receives the write request of user, to the handling process that the write request of user processes, but embodiment illustrated in fig. 6 and above-mentioned technical scheme embodiment illustrated in fig. 5 unlike, the present embodiment is when the write request sent user processes, if desired the data in the image file that the data write are corresponding have not also been moved, then can preferentially by the data copy in the corresponding document of source device to image file, after the Data Migration of this image file is completed, direct again the data that write request will be write are write in this image file, particularly, as shown in Figure 6, when the present embodiment target device processes the write request in the access request of user, can comprise the following steps:
Step 601, target device receive the write request that user sends;
Whether step 602, the data of searching in image file corresponding to data that write request will write at target device have moved, and are perform step 603, otherwise perform step 604;
Step 603, directly the data that write request will be write are write in corresponding image file, terminate;
Step 604, target device are shared agreement by network file and the high priority data in file corresponding for image file corresponding with write request on source device are migrated to target device;
After step 605, Data Migration in the file that the image file that write request is corresponding is corresponding complete, data write request will write directly are write in image file.
In the present embodiment, when the data in the image file that the data that user will write are corresponding have not been moved, preferentially can carry out Data Migration to this image file, namely preferentially agreement is shared by the data copy in file corresponding on source device in this image file by network file, so that data write request will write directly write in this image file, like this, follow-up still needs can be avoided to carry out Data Migration to image file, save the Data Migration time, simultaneously, also image file can be avoided to have moved after, also need again the data temporarily write to be write image file again from temporary file, in addition, because the data of user's access are often the data needing amendment or access, after being stored in target device, the again access of user to these data can be convenient to, to improve the treatment effeciency of user access request.
The online moving apparatus structural representation of file that Fig. 7 provides for the embodiment of the present invention seven.The online moving apparatus of the present embodiment file is NAS equipment, can realize the online migration of file, and particularly, as shown in Figure 7, this device for carrying out said can comprise carry module 11, mirror module 12, Data Migration module 13 and Service Processing Module 14, wherein:
Carry module 11, is mounted to target device for sharing agreement by network file by source device;
Mirror module 12, for setting up the image file of source device files on the target device, this image file is initially empty file;
Data in source device files are migrated in image file corresponding on target device for being shared agreement by network file by Data Migration module 13 by Internet Transmission;
Service Processing Module 14, in data migration process by the access request of target device process user.
On the target device, the file on source device is migrated to target device online, wherein target device and source device are NAS equipment to the online moving apparatus accessible site of the present embodiment file.
The present embodiment can realize the online migration of file between NAS equipment, and its specific implementation see the explanation of the invention described above embodiment of the method, can not repeat them here.
The online moving apparatus structural representation of file that Fig. 8 provides for the embodiment of the present invention eight.On above-mentioned technical scheme basis embodiment illustrated in fig. 7, as shown in Figure 8, mirror module 12 specifically can comprise metadata acquiring unit 121 and mirror image unit 122, wherein:
Metadata acquiring unit 121, for sharing the metadata of agreement to source device acquisition request source device files by network file;
Mirror image unit 122, for the metadata according to the source device files obtained, sets up the image file corresponding with the file on source device.
In addition, can also comprise in the device that the embodiment of the present invention provides:
Monitoring module 123, for the situation of change of monitor source equipment files, and image file synchronous corresponding with the file changed in target device.
Concrete, this monitoring module in image file process of establishing, can be monitored the situation of change of source device files, to guarantee the consistency of the image file on target device and the file on source device.
The structural representation of Service Processing Module in the online moving apparatus of file that Fig. 9 provides for the embodiment of the present invention nine.On above-mentioned Fig. 7 or technical scheme basis embodiment illustrated in fig. 8, as shown in Figure 9, in the present embodiment, Service Processing Module 14 comprises: read request receiving element 141, read request search unit 142, first read request processing unit 143 and the second read request processing unit 144, wherein:
Read request receiving element 141, for receiving the read request that user sends;
Read request searches unit 142, whether there are for searching target device the data that this read request will read;
First read request processing unit 143, for when there are the data that this read request will read in target device, from target device, corresponding image file reads data, returns to user;
Second read request processing unit 144, when there are not for target device the data that this read request will read, share agreement by network file and read from source device the data that this read request will read, return to user, or read from source device the data that read request will read for being shared agreement by network file, and store after in the corresponding image file set up on the target device and return to user.
The present embodiment can process the read request that user sends, and to guarantee the normal operation of user, its specific implementation see the explanation of the invention described above embodiment of the method three or four, can not repeat them here.
The structural representation of Service Processing Module in the online moving apparatus of file that Figure 10 provides for the embodiment of the present invention ten.On above-mentioned Fig. 7, Fig. 8 or technical scheme basis embodiment illustrated in fig. 9, as shown in Figure 10, in the present embodiment, Service Processing Module 14 specifically can also comprise write request receiving element 145, write request searches unit 146, first write request processing unit 147 and the second write request processing unit 148, wherein:
Write request receiving element 145, for receiving the write request that user sends;
Whether write request searches unit 146, moved for the data of searching in target device in image file corresponding to data that this write request will write;
The data that write request will be write, for when the Data Migration in the image file that the data that write request will be write are corresponding completes, are directly write in corresponding image file by the first write request processing unit 147;
Second write request processing unit 148, when not moved for the data of searching at target device in image file corresponding to data that this write request will write, the data that this write request will be write are write in temporary file, to write again in image file after the Data Migration in corresponding image file completes, or for being shared after the high priority data in file corresponding for image file corresponding with write request on source device migrates to target device by agreement by network file, the data that write request will be write are write in image file.
The present embodiment can process the write request that user sends, and its specific implementation see the explanation of the invention described above embodiment of the method five or six, can not repeat them here.
The online migration system architecture schematic diagram of file that Figure 11 provides for the embodiment of the present invention 11.The online migratory system of this enforcement file can comprise target device 10 and source device 20, this target device 10 and source device 20 are NAS equipment, wherein this target device 10 can comprise the online moving apparatus of file that above-mentioned Fig. 7 to Figure 10 any embodiment provides, and can realize the online migration of file between target device 10 and source device 20.
It will be understood by those skilled in the art that the online moving apparatus of file that above-mentioned source device 20 also can comprise above-mentioned Fig. 7-8 any embodiment and provides, this present embodiment is not particularly limited.
One of ordinary skill in the art will appreciate that: all or part of step realizing above-mentioned each embodiment of the method can have been come by the hardware that program command is relevant.Aforesaid program can be stored in a computer read/write memory medium.This program, when performing, performs the step comprising above-mentioned each embodiment of the method; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Last it is noted that above each embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to foregoing embodiments to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein some or all of technical characteristic; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme.