CN107608764A - The moving method and moving apparatus of a kind of server - Google Patents
The moving method and moving apparatus of a kind of server Download PDFInfo
- Publication number
- CN107608764A CN107608764A CN201710897386.4A CN201710897386A CN107608764A CN 107608764 A CN107608764 A CN 107608764A CN 201710897386 A CN201710897386 A CN 201710897386A CN 107608764 A CN107608764 A CN 107608764A
- Authority
- CN
- China
- Prior art keywords
- file
- migrated
- virtual machine
- hard disk
- target virtual
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000013508 migration Methods 0.000 claims abstract description 52
- 230000005012 migration Effects 0.000 claims abstract description 52
- 238000006243 chemical reaction Methods 0.000 claims description 26
- 238000012545 processing Methods 0.000 claims description 9
- 238000013500 data storage Methods 0.000 claims description 8
- 238000012546 transfer Methods 0.000 claims 2
- 238000013519 translation Methods 0.000 claims 1
- 230000001360 synchronised effect Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000012795 verification Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及通信技术领域,尤其涉及一种服务器的迁移方法及迁移装置。The present invention relates to the field of communication technologies, in particular to a server migration method and migration device.
背景技术Background technique
随着云技术的快速发展,云平台在各个企业中得到了广泛应用,对于一开始没有应用云平台而在后来才应用云平台的企业来说,往往会遇到需要将原先所部署的服务器迁移至云平台中的情况。With the rapid development of cloud technology, cloud platforms have been widely used in various enterprises. For enterprises that did not apply cloud platforms at the beginning but later applied cloud platforms, they often encountered the need to migrate the originally deployed servers. to the situation in the cloud platform.
相关技术中,由于待迁移服务器的文件的文件格式与云平台能够识别的文件格式不同,因此,服务器的迁移往往是首先获取服务器中的硬盘的文件,然后将硬盘的文件的文件格式转换为云平台能够识别的文件格式,最后再将完成格式转换的硬盘的文件传输至云平台中的目标虚拟机。In the related technology, because the file format of the file of the server to be migrated is different from the file format that the cloud platform can recognize, therefore, the migration of the server is often to first obtain the file of the hard disk in the server, and then convert the file format of the hard disk file to the cloud platform. The file format that the platform can recognize, and finally the file of the hard disk that has completed the format conversion is transferred to the target virtual machine in the cloud platform.
然而,这种方法十分浪费时间,从而造成迁移效率低下。However, this method is time-consuming, resulting in inefficient migration.
发明内容Contents of the invention
为了解决上述技术问题,本发明提供一种服务器的迁移方法及迁移装置,能够节约服务器迁移过程中所耗费的时间,提高迁移效率。In order to solve the above technical problems, the present invention provides a server migration method and a migration device, which can save time spent in the server migration process and improve migration efficiency.
为了达到本发明目的,本发明提供了一种服务器的迁移方法,包括:In order to achieve the purpose of the present invention, the present invention provides a server migration method, including:
扫描待迁移服务器,得到N个待迁移硬盘;其中,N为正整数;Scan the server to be migrated to obtain N hard disks to be migrated; where N is a positive integer;
获取所述N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,所述预设文件格式为目标虚拟机支持的文件格式;Obtaining the files of the N hard disks to be migrated, and converting the file format of the obtained files into a preset file format; wherein, the preset file format is a file format supported by the target virtual machine;
将转换文件格式后的文件发送给所述目标虚拟机。Send the converted file to the target virtual machine.
所述获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式,包括:The acquisition of the files of N hard disks to be migrated, and converting the file format of the obtained files into a preset file format includes:
获取所述N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法将获得的文件的文件格式转换为所述预设文件格式。The files of the N hard disks to be migrated are obtained, and the file format of the obtained files is converted into the preset file format through the pre-written file format conversion algorithm in the preset file format conversion interface.
所述将转换文件格式后的文件发送给目标虚拟机,包括:The described sending the file after the converted file format to the target virtual machine includes:
通过所述待迁移服务器的网卡,依次将转换文件格式后的第i个待迁移硬盘的文件根据目的地址发送至所述目标虚拟机预先创建的第i个硬盘中;其中,所述目的地址是所述目标虚拟机所在服务器为所述目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。Through the network card of the server to be migrated, the files of the i-th hard disk to be migrated after the converted file format are sent to the i-th hard disk pre-created by the target virtual machine according to the destination address; wherein, the destination address is The address of the storage space allocated by the server where the target virtual machine is located for data storage of the target virtual machine; i=1, 2...N.
所述获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式之后,还包括:After obtaining the files of N hard disks to be migrated, and converting the file format of the obtained files into a preset file format, it also includes:
根据转换文件格式后的文件生成第一校验码;Generate the first check code according to the file after the converted file format;
所述将转换文件格式后的文件发送给目标虚拟机之后,还包括:After sending the file after the converted file format to the target virtual machine, it also includes:
从所述目标虚拟机中获取所述N个待迁移硬盘的文件;Acquiring the files of the N hard disks to be migrated from the target virtual machine;
根据从所述目标虚拟机中获取所述N个待迁移硬盘的文件生成第二校验码;generating a second check code according to the files obtained from the target virtual machine for the N hard disks to be migrated;
比较所述第二校验码与所述第一校验码是否相同;comparing whether the second check code is the same as the first check code;
若所述第二校验码与所述第一校验码不相同,将转换文件格式后的文件重新发送至所述目标虚拟机,直到所述第二校验码与所述第一校验码相同。If the second check code is not the same as the first check code, resend the converted file to the target virtual machine until the second check code is the same as the first check code. same code.
所述扫描待迁移服务器,得到N个待迁移硬盘之前,还包括:Before the scanning of the server to be migrated to obtain N hard disks to be migrated, it also includes:
控制所述待迁移服务器启动,并控制所述待迁移服务器进入预先设置的文件迁移界面。Controlling the server to be migrated to start, and controlling the server to be migrated to enter a preset file migration interface.
本发明还提供了一种服务器的迁移装置,包括:The present invention also provides a server migration device, including:
扫描模块,用于扫描待迁移服务器,得到N个待迁移硬盘;其中,N为正整数;The scanning module is used to scan the server to be migrated to obtain N hard disks to be migrated; wherein, N is a positive integer;
处理模块,用于获取所述N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,所述预设文件格式为目标虚拟机支持的文件格式;A processing module, configured to obtain the files of the N hard disks to be migrated, and convert the file format of the obtained files into a preset file format; wherein, the preset file format is a file format supported by the target virtual machine;
发送模块,用于将转换文件格式后的文件发送至所述目标虚拟机。A sending module, configured to send the converted file format to the target virtual machine.
所述处理模块,具体用于获取所述N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法获得的文件的文件格式转换为所述预设文件格式。The processing module is specifically configured to obtain the files of the N hard disks to be migrated, and convert the file format of the file obtained through the file format conversion algorithm pre-written in the preset file format conversion interface into the preset file format .
所述发送模块,具体用于通过所述待迁移服务器的网卡,依次将转换文件格式后的第i个待迁移硬盘的文件根据目的地址发送至所述目标虚拟机预先创建的第i个硬盘中;其中,所述目的地址是所述目标虚拟机所在服务器为所述目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。The sending module is specifically configured to, through the network card of the server to be migrated, sequentially send the file of the i-th hard disk to be migrated after the converted file format to the i-th hard disk pre-created by the target virtual machine according to the destination address ; Wherein, the destination address is the address of the storage space allocated by the server where the target virtual machine is located for data storage of the target virtual machine; i=1, 2...N.
还包括:生成模块,用于根据转换文件格式后的文件生成第一校验码;It also includes: a generation module, which is used to generate the first check code according to the converted file format;
获取模块,用于从所述目标虚拟机中获取所述N个待迁移硬盘的文件;An acquisition module, configured to acquire the files of the N hard disks to be migrated from the target virtual machine;
所述生成模块,还用于根据从所述目标虚拟机中获取所述N个待迁移硬盘的文件生成第二校验码;The generating module is further configured to generate a second check code according to the files obtained from the target virtual machine of the N hard disks to be migrated;
比较模块,用于比较所述第二校验码与所述第一校验码是否相同;A comparison module, configured to compare whether the second check code is the same as the first check code;
所述发送模块,还用于若所述第二校验码与所述第一校验码不相同,将转换文件格式后的文件重新发送至所述目标虚拟机,直到所述第二校验码与所述第一校验码相同。The sending module is further configured to, if the second check code is different from the first check code, resend the converted file to the target virtual machine until the second check code The code is the same as the first check code.
还包括:控制模块,用于控制所述待迁移服务器启动,并控制所述待迁移服务器进入预先设置的文件迁移界面。It also includes: a control module, configured to control the server to be migrated to start, and control the server to be migrated to enter a preset file migration interface.
与现有技术相比,本发明至少包括扫描待迁移服务器,得到N个待迁移硬盘;获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式;将转换文件格式后的文件发送给目标虚拟机。从本发明提供的技术方案可见,由于获取待迁移硬盘的文件的同时,就将待迁移硬盘的文件的文件格式转换为预设文件格式,因此实现了待迁移硬盘的文件获取与文件格式转换的同步进行,从而节约服务器迁移过程中所耗费的时间,提高迁移效率。Compared with the prior art, the present invention at least includes scanning the server to be migrated to obtain N hard disks to be migrated; obtaining the files of the N hard disks to be migrated, and converting the file format of the obtained file into a preset file format; wherein, the preset Set the file format as a file format supported by the target virtual machine; send the converted file to the target virtual machine. It can be seen from the technical solution provided by the present invention that when the files of the hard disk to be migrated are obtained, the file format of the files of the hard disk to be migrated is converted into a preset file format, so the acquisition of the files of the hard disk to be migrated and the conversion of the file format are realized. Simultaneously, thereby saving time spent in the server migration process and improving migration efficiency.
本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
附图说明Description of drawings
附图用来提供对本发明技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本发明的技术方案,并不构成对本发明技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solution of the present invention, and constitute a part of the description, and are used together with the embodiments of the application to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the present invention.
图1为本发明实施例提供的一种服务器的迁移方法的流程示意图;FIG. 1 is a schematic flowchart of a server migration method provided by an embodiment of the present invention;
图2为本发明实施例提供的另一种服务器的迁移方法的流程示意图;FIG. 2 is a schematic flowchart of another server migration method provided by an embodiment of the present invention;
图3为本发明实施例提供的又一种服务器的迁移方法的流程示意图;FIG. 3 is a schematic flowchart of another server migration method provided by an embodiment of the present invention;
图4为本发明实施例提供的一种服务器的迁移装置的结构示意图;FIG. 4 is a schematic structural diagram of a server migration device provided by an embodiment of the present invention;
图5为本发明实施例提供的另一种服务器的迁移装置的结构示意图;FIG. 5 is a schematic structural diagram of another server migration device provided by an embodiment of the present invention;
图6为本发明实施例提供的又一种服务器的迁移装置的结构示意图。FIG. 6 is a schematic structural diagram of another server migration device provided by an embodiment of the present invention.
具体实施方式detailed description
为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.
本发明实施例提供一种服务器的迁移方法,如图1所示,该方法包括:An embodiment of the present invention provides a server migration method, as shown in Figure 1, the method includes:
步骤101、扫描待迁移服务器,得到N个待迁移硬盘。Step 101. Scan the server to be migrated to obtain N hard disks to be migrated.
其中,N为正整数。Wherein, N is a positive integer.
需要说明的是,待迁移服务器可能包括C盘、D盘和E盘,这个N就等于3。It should be noted that the server to be migrated may include disk C, disk D, and disk E, and this N is equal to 3.
步骤102、获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式。Step 102: Acquire the files of N hard disks to be migrated, and convert the file format of the obtained files into a preset file format.
其中,预设文件格式为目标虚拟机支持的文件格式。Wherein, the preset file format is a file format supported by the target virtual machine.
具体的,N个待迁移硬盘的文件的文件格式可能是img格式,而目标虚拟机不支持该格式的文件,而支持qcow2格式的文件,因此,预设文件格式就是qcow2格式。Specifically, the file format of the N hard disk files to be migrated may be in img format, but the target virtual machine does not support files in this format, but supports files in qcow2 format. Therefore, the default file format is qcow2 format.
步骤103、将转换文件格式转换后的文件发送给目标虚拟机。Step 103, sending the converted file to the target virtual machine.
需要说明的是,在将文件格式转换为预设文件格式的N个待迁移硬盘的文件发送给目标虚拟机后,引导启动虚拟机,以查看待迁移硬盘的文件是否迁移成功。It should be noted that, after the N hard disk files to be migrated are sent to the target virtual machine with the file format converted into a preset file format, the virtual machine is booted to check whether the files on the hard disk to be migrated are successfully migrated.
本发明实施例所提供的服务器的迁移方法,扫描待迁移服务器,得到N个待迁移硬盘;获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式;将转换文件格式后的文件发送给目标虚拟机。从本发明提供的技术方案可见,由于获取待迁移硬盘的文件的同时,就将待迁移硬盘的文件的文件格式转换为预设文件格式,因此实现了待迁移硬盘的文件获取与文件格式转换的同步进行,从而节约服务器迁移过程中所耗费的时间,提高迁移效率。The server migration method provided by the embodiment of the present invention scans the server to be migrated to obtain N hard disks to be migrated; obtains the files of the N hard disks to be migrated, and converts the file format of the obtained file into a preset file format; wherein, The preset file format is a file format supported by the target virtual machine; the converted file format is sent to the target virtual machine. It can be seen from the technical solution provided by the present invention that when the files of the hard disk to be migrated are obtained, the file format of the files of the hard disk to be migrated is converted into a preset file format, so the acquisition of the files of the hard disk to be migrated and the conversion of the file format are realized. Simultaneously, thereby saving time spent in the server migration process and improving migration efficiency.
本发明实施例提供另一种服务器的迁移方法,如图2所示,该方法包括:The embodiment of the present invention provides another server migration method, as shown in Figure 2, the method includes:
步骤201、扫描待迁移服务器,得到N个待迁移硬盘。Step 201. Scan the server to be migrated to obtain N hard disks to be migrated.
其中,N为正整数。Wherein, N is a positive integer.
步骤202、获取N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法将获得的文件的文件格式转换为预设文件格式。Step 202: Acquire the files of N hard disks to be migrated, and convert the file format of the obtained files into a preset file format through the pre-written file format conversion algorithm in the preset file format conversion interface.
具体的,文件格式转换算法可以是以程序的形式写在预设文件格式转换接口中的。Specifically, the file format conversion algorithm may be written in the preset file format conversion interface in the form of a program.
需要说明的是,预设文件格式转换接口是开放的接口,如果目标虚拟机所支持的文件格式发生了变化,则可以重新编写文件格式转换算法以写入预设文件转换接口中。It should be noted that the preset file format conversion interface is an open interface. If the file format supported by the target virtual machine changes, the file format conversion algorithm can be rewritten to be written into the preset file conversion interface.
步骤203、通过待迁移服务器的网卡,依次将转换文件格式后的第i个待迁移硬盘的文件根据目的地址发送给目标虚拟机预先创建的第i个硬盘中。Step 203, through the network card of the server to be migrated, sequentially send the file of the i-th hard disk to be migrated after the format conversion to the i-th hard disk created in advance by the target virtual machine according to the destination address.
其中,目的地址是目标虚拟机所在服务器为目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。Wherein, the destination address is the address of the storage space allocated by the server where the target virtual machine is located for data storage of the target virtual machine; i=1, 2...N.
具体的,待迁移硬盘的文件的发送是以硬盘为单位的,假设待迁移服务器的硬盘有C盘、D盘和E盘,那么利用待迁移服务器的网卡、通过配置互联网协议(InternetProtocol,IP)地址、网关、掩码等信息,依次将文件格式转换为预设文件格式的第1个待迁移硬盘的文件,即将C盘的文件作为一个整体根据目的地址发送给目标虚拟机预先创建的第1个硬盘中,即虚拟机的C盘;将文件格式转换为预设文件格式的第2个待迁移硬盘的文件,即将D盘的文件作为一个整体根据目的地址发送给目标虚拟机预先创建的第2个硬盘中,即虚拟机的D盘;将文件格式转换为预设文件格式的第3个待迁移硬盘的文件,即将E盘的文件作为一个整体根据目的地址发送给目标虚拟机预先创建的第3个硬盘中,即虚拟机的E盘。Concretely, the sending of the file of the hard disk to be migrated is based on the hard disk. Assuming that the hard disk of the server to be migrated has C disk, D disk and E disk, then using the network card of the server to be migrated, by configuring Internet Protocol (Internet Protocol, IP) Information such as address, gateway, mask, etc., the file format is converted into the first file of the hard disk to be migrated in the preset file format in turn, that is, the file on the C drive is sent as a whole to the first pre-created file of the target virtual machine according to the destination address. One hard disk, that is, the C drive of the virtual machine; the file format of the second hard disk to be migrated is converted to the preset file format, that is, the file of the D drive as a whole is sent to the pre-created second hard disk of the target virtual machine according to the destination address. Among the two hard disks, that is, the D disk of the virtual machine; the file format of the third hard disk to be migrated is converted to the preset file format, that is, the file of the E disk as a whole is sent to the pre-created target virtual machine according to the destination address The third hard disk is the E disk of the virtual machine.
需要说明的是,该方法屏蔽了待迁移服务器内部具体运行的系统、组件、运行环境等详细信息,以整个硬盘的所有文件为单位进行迁移,效果与整机迁移相同,完整保留了待迁移服务器所依赖的运行环境以及配置信息等,极大降低了迁移时需要做的繁杂环境配置,而且对迁移后服务器的稳定运行也提供了极大的安全保障。It should be noted that this method shields detailed information such as the specific operating system, components, and operating environment of the server to be migrated, and migrates all files on the entire hard disk as a unit. The effect is the same as the whole machine migration, and the server to be migrated is completely retained. The operating environment and configuration information it relies on greatly reduces the complicated environment configuration that needs to be done during migration, and also provides a great security guarantee for the stable operation of the server after migration.
本发明实施例所提供的服务器的迁移方法,扫描待迁移服务器,得到N个待迁移硬盘;获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式;将转换文件格式后的文件发送给目标虚拟机。从本发明提供的技术方案可见,由于获取待迁移硬盘的文件的同时,就将待迁移硬盘的文件的文件格式转换为预设文件格式,因此实现了待迁移硬盘的文件获取与文件格式转换的同步进行,从而节约服务器迁移过程中所耗费的时间,提高迁移效率。The server migration method provided by the embodiment of the present invention scans the server to be migrated to obtain N hard disks to be migrated; obtains the files of the N hard disks to be migrated, and converts the file format of the obtained file into a preset file format; wherein, The preset file format is a file format supported by the target virtual machine; the converted file format is sent to the target virtual machine. It can be seen from the technical solution provided by the present invention that when the files of the hard disk to be migrated are obtained, the file format of the files of the hard disk to be migrated is converted into a preset file format, so the acquisition of the files of the hard disk to be migrated and the conversion of the file format are realized. Simultaneously, thereby saving time spent in the server migration process and improving migration efficiency.
本发明实施例提供又一种服务器的迁移方法,如图3所示,该方法包括:The embodiment of the present invention provides another server migration method, as shown in Figure 3, the method includes:
步骤301、控制待迁移服务器启动,并控制待迁移服务器进入预先设置的文件迁移界面。Step 301. Control the server to be migrated to start, and control the server to be migrated to enter a preset file migration interface.
步骤302、扫描待迁移服务器,得到N个待迁移硬盘。Step 302. Scan the server to be migrated to obtain N hard disks to be migrated.
其中,N为正整数。Wherein, N is a positive integer.
步骤303、获取N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法将获得的文件的文件格式转换为预设文件格式。Step 303: Obtain the files of N hard disks to be migrated, and convert the file format of the obtained files into a preset file format through the file format conversion algorithm pre-written in the preset file format conversion interface.
步骤304、根据转换文件格式后的文件生成第一校验码。Step 304, generating a first verification code according to the converted file format.
具体的,第一校验码可以是采用预设算法加密文件格式转换为预设文件格式的N个待迁移硬盘的文件而生成的,其中,预设算法可以是消息摘要算法第五版(MessageDigest Algorithm 5,MD5)。Specifically, the first check code may be generated by using a preset algorithm to encrypt the file format and convert the files of the N hard disks to be migrated into the preset file format, wherein the preset algorithm may be the fifth version of the message digest algorithm (MessageDigest Algorithm 5, MD5).
步骤305、通过待迁移服务器的网卡,依次将转换文件格式后的第i个待迁移硬盘的文件根据目的地址发送给目标虚拟机预先创建的第i个硬盘中。Step 305 , through the network card of the server to be migrated, sequentially send the file of the i-th hard disk to be migrated after the file format conversion to the i-th hard disk pre-created by the target virtual machine according to the destination address.
其中,目的地址是目标虚拟机所在服务器为目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。Wherein, the destination address is the address of the storage space allocated by the server where the target virtual machine is located for data storage of the target virtual machine; i=1, 2...N.
步骤306、从目标虚拟机中获取N个待迁移硬盘的文件。Step 306, acquiring N hard disk files to be migrated from the target virtual machine.
步骤307、根据从目标虚拟机中获取N个待迁移硬盘的文件生成第二校验码。Step 307, generating a second check code according to the files obtained from the target virtual machine on the N hard disks to be migrated.
需要说明的是,第二校验码可以是采用预设算法加密从目标虚拟机中获取N个待迁移硬盘的文件而生成的,其中,生成第二校验码所采用的预设算法应该与生成第一校验码所采用的预设算法应该一致,如果生成第一校验码所采用的预设算法是MD5,那么生成第二校验所采用的预设算法也应该是MD5。It should be noted that the second check code may be generated by encrypting the files of the N hard disks to be migrated from the target virtual machine using a preset algorithm, wherein the preset algorithm used to generate the second check code should be the same as The preset algorithm used to generate the first check code should be consistent. If the preset algorithm used to generate the first check code is MD5, then the preset algorithm used to generate the second check code should also be MD5.
步骤308、比较第二校验码与第一校验码是否相同。Step 308, comparing whether the second check code is the same as the first check code.
需要说明的是,比较第二校验码与第一校验码是否相同是为了检验待迁移硬盘的文件在发送给目标虚拟机的过程中是否出现漏传、错传等情况。It should be noted that the purpose of comparing whether the second check code is the same as the first check code is to check whether the files on the hard disk to be migrated are missed or wrongly transmitted during the process of sending them to the target virtual machine.
步骤309、若第二校验码与第一校验码不相同,将转换文件格式后的文件重新发送给目标虚拟机,直到第二校验码与第一校验码相同。Step 309 , if the second check code is different from the first check code, resend the converted file to the target virtual machine until the second check code is the same as the first check code.
具体的,若第二校验码与第一校验码相同,说明待迁移硬盘的文件没有出现漏传、错传等情况;若第二校验码与第一校验码不相同,说明待迁移硬盘的文件出现了漏传、错传等情况,因此将文件格式转换为预设文件格式的N个待迁移硬盘的文件重新发送给目标虚拟机,直到生成的第二校验码与第一校验码相同。Specifically, if the second check code is the same as the first check code, it means that the files on the hard disk to be migrated have not been missed or mistransferred; The files on the migrated hard disk are missing or mistransmitted, so the N hard disk files to be migrated are resent to the target virtual machine after the file format is converted to the preset file format, until the generated second checksum is the same as the first The checksums are the same.
本发明实施例所提供的服务器的迁移方法,扫描待迁移服务器,得到N个待迁移硬盘;获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式;将转换文件格式后的文件发送给目标虚拟机。从本发明提供的技术方案可见,由于获取待迁移硬盘的文件的同时,就将待迁移硬盘的文件的文件格式转换为预设文件格式,因此实现了待迁移硬盘的文件获取与文件格式转换的同步进行,从而节约服务器迁移过程中所耗费的时间,提高迁移效率。The server migration method provided by the embodiment of the present invention scans the server to be migrated to obtain N hard disks to be migrated; obtains the files of the N hard disks to be migrated, and converts the file format of the obtained file into a preset file format; wherein, The preset file format is a file format supported by the target virtual machine; the converted file format is sent to the target virtual machine. It can be seen from the technical solution provided by the present invention that when the files of the hard disk to be migrated are obtained, the file format of the files of the hard disk to be migrated is converted into a preset file format, so the acquisition of the files of the hard disk to be migrated and the conversion of the file format are realized. Simultaneously, thereby saving time spent in the server migration process and improving migration efficiency.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,计算机可执行指令用于执行上述任一项服务器的迁移方法。An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute any server migration method described above.
本发明实施例还提供一种服务器的迁移装置,如图4所示,该迁移装置4包括:The embodiment of the present invention also provides a server migration device, as shown in Figure 4, the migration device 4 includes:
扫描模块41,用于扫描待迁移服务器,得到N个待迁移硬盘;其中,N为正整数。The scanning module 41 is configured to scan the server to be migrated to obtain N hard disks to be migrated; wherein, N is a positive integer.
处理模块42,用于获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式。The processing module 42 is configured to obtain the files of the N hard disks to be migrated, and convert the file format of the obtained files into a preset file format; wherein, the preset file format is a file format supported by the target virtual machine.
发送模块43,用于将转换文件格式后的文件发送给目标虚拟机。The sending module 43 is configured to send the converted file format to the target virtual machine.
进一步,处理模块42,具体用于获取N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法将获得的文件的文件格式转换为预设文件格式。Further, the processing module 42 is specifically configured to obtain the files of the N hard disks to be migrated, and convert the file format of the obtained files into a preset file format through a file format conversion algorithm pre-written in the preset file format conversion interface.
发送模块43,具体用于通过待迁移服务器的网卡,依次将转换文件格式转换后的第i个待迁移硬盘的文件根据目的地址发送给目标虚拟机预先创建的第i个硬盘中;其中,目的地址是目标虚拟机所在服务器为目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。The sending module 43 is specifically used to send the file of the i-th hard disk to be migrated after the converted file format to the i-th hard disk pre-created by the target virtual machine according to the destination address through the network card of the server to be migrated; wherein, the purpose The address is the address of the storage space allocated by the server where the target virtual machine is located for data storage of the target virtual machine; i=1, 2...N.
进一步,在图4对应的实施例的基础上,本发明实施例提供另一种服务器的迁移装置,如图5所示,该迁移装置4还包括:Further, on the basis of the embodiment corresponding to FIG. 4 , the embodiment of the present invention provides another server migration device. As shown in FIG. 5 , the migration device 4 further includes:
生成模块44,用于根据转换文件格式后的文件生成第一校验码。The generating module 44 is configured to generate a first verification code according to the converted file format.
获取模块45,用于从目标虚拟机中获取N个待迁移硬盘的文件。The acquiring module 45 is configured to acquire the files of N hard disks to be migrated from the target virtual machine.
生成模块44,还用于根据从目标虚拟机中获取N个待迁移硬盘的文件生成第二校验码。The generating module 44 is further configured to generate a second check code according to the files obtained from the target virtual machine on the N hard disks to be migrated.
比较模块46,用于比较第二校验码与第一校验码是否相同。A comparing module 46, configured to compare whether the second check code is the same as the first check code.
发送模块43,还用于若第二校验码与第一校验码不相同,将转换文件格式后的文件重新发送给目标虚拟机,直到第二校验码与第一校验码相同。The sending module 43 is further configured to resend the converted file to the target virtual machine if the second check code is different from the first check code until the second check code is the same as the first check code.
进一步,在图5对应的实施例的基础上,本发明实施例提供又一种服务器的迁移装置,如图4所示,该迁移装置4还包括:Further, on the basis of the embodiment corresponding to FIG. 5 , the embodiment of the present invention provides another server migration device. As shown in FIG. 4 , the migration device 4 further includes:
控制模块47,用于控制待迁移服务器启动,并控制待迁移服务器进入预先设置的文件迁移界面。The control module 47 is configured to control the server to be migrated to start, and control the server to be migrated to enter a preset file migration interface.
本发明实施例所提供的服务器的迁移装置,扫描待迁移服务器,得到N个待迁移硬盘;获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式;将转换文件格式后的文件发送给目标虚拟机。从本发明提供的技术方案可见,由于获取待迁移硬盘的文件的同时,就将待迁移硬盘的文件的文件格式转换为预设文件格式,因此实现了待迁移硬盘的文件获取与文件格式转换的同步进行,从而节约服务器迁移过程中所耗费的时间,提高迁移效率。The server migration device provided by the embodiment of the present invention scans the server to be migrated to obtain N hard disks to be migrated; acquires the files of the N hard disks to be migrated, and converts the file format of the obtained file into a preset file format; wherein, The preset file format is a file format supported by the target virtual machine; the converted file format is sent to the target virtual machine. It can be seen from the technical solution provided by the present invention that when the files of the hard disk to be migrated are obtained, the file format of the files of the hard disk to be migrated is converted into a preset file format, so the acquisition of the files of the hard disk to be migrated and the conversion of the file format are realized. Simultaneously, thereby saving time spent in the server migration process and improving migration efficiency.
在实际应用中,所述扫描模块41、处理模块42、发送模块43、生成模块44、获取模块45、比较模块46、控制模块47均可由位于服务器的迁移装置的中央处理器(CentralProcessing Unit,CPU)、微处理器(Micro Processor Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)或现场可编程门阵列(Field Programmable GateArray,FPGA)等实现。In practical applications, the scanning module 41, the processing module 42, the sending module 43, the generating module 44, the obtaining module 45, the comparing module 46, and the control module 47 can all be controlled by the central processing unit (Central Processing Unit, CPU) of the migrating device located at the server. ), a microprocessor (Micro Processor Unit, MPU), a digital signal processor (Digital Signal Processor, DSP) or a field programmable gate array (Field Programmable GateArray, FPGA).
本发明实施例还提供一种用于实现服务器迁移的装置,包括存储器和处理器,其中,存储器中存储有以下可被处理器执行的指令:An embodiment of the present invention also provides an apparatus for implementing server migration, including a memory and a processor, wherein the memory stores the following instructions executable by the processor:
扫描待迁移服务器,得到N个待迁移硬盘;其中,N为正整数。Scan the server to be migrated to obtain N hard disks to be migrated; wherein, N is a positive integer.
获取N个待迁移硬盘的文件,并将获得的文件的文件格式转换为预设文件格式;其中,预设文件格式为目标虚拟机支持的文件格式。Obtain the files of the N hard disks to be migrated, and convert the obtained file format into a preset file format; wherein, the preset file format is a file format supported by the target virtual machine.
将转换文件格式后的文件发送给目标虚拟机。Send the converted file format to the target virtual machine.
进一步,存储器中具体存储有以下可被处理器执行的指令:Further, the following instructions executable by the processor are specifically stored in the memory:
获取N个待迁移硬盘的文件,并通过预设文件格式转换接口中预先写入的文件格式转换算法将获得的文件的文件格式转换为预设文件格式。Obtain the files of the N hard disks to be migrated, and convert the file formats of the obtained files into the preset file format through the pre-written file format conversion algorithm in the preset file format conversion interface.
进一步,存储器中具体还存储有以下可被处理器执行的指令:Further, the following instructions executable by the processor are specifically stored in the memory:
通过待迁移服务器的网卡,依次将转换文件格式后的第i个待迁移硬盘的文件根据目的地址发送给目标虚拟机预先创建的第i个硬盘中;其中,目的地址是目标虚拟机所在服务器为目标虚拟机进行数据存储而分配的存储空间的地址;i=1、2...N。Through the network card of the server to be migrated, the file of the i-th hard disk to be migrated after the converted file format is sent to the i-th hard disk pre-created by the target virtual machine according to the destination address; where the destination address is the server where the target virtual machine is located. The address of the storage space allocated by the target virtual machine for data storage; i=1, 2...N.
进一步,存储器中还存储有以下可被处理器执行的指令:Further, the memory also stores the following instructions executable by the processor:
根据转换文件格式后的文件生成第一校验码。A first verification code is generated according to the converted file format.
从目标虚拟机中获取N个待迁移硬盘的文件。Obtain the files of N hard disks to be migrated from the target virtual machine.
根据从目标虚拟机中获取N个待迁移硬盘的文件生成第二校验码。A second check code is generated according to the files obtained from the target virtual machine on the N hard disks to be migrated.
比较第二校验码与第一校验码是否相同。Compare whether the second check code is the same as the first check code.
若第二校验码与第一校验码不相同,将转换文件格式后的文件重新发送给目标虚拟机,直到第二校验码与第一校验码相同。If the second check code is different from the first check code, resend the converted file to the target virtual machine until the second check code is the same as the first check code.
进一步,存储器中还存储有以下可被处理器执行的指令:Further, the memory also stores the following instructions executable by the processor:
控制待迁移服务器启动,并控制待迁移服务器进入预先设置的文件迁移界面。Control the server to be migrated to start, and control the server to be migrated to enter the preset file migration interface.
虽然本发明所揭露的实施方式如上,但所述的内容仅为便于理解本发明而采用的实施方式,并非用以限定本发明。任何本发明所属领域内的技术人员,在不脱离本发明所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本发明的专利保护范围,仍须以所附的权利要求书所界定的范围为准。Although the embodiments disclosed in the present invention are as above, the described content is only an embodiment adopted for understanding the present invention, and is not intended to limit the present invention. Anyone skilled in the field of the present invention can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed by the present invention, but the patent protection scope of the present invention must still be The scope defined by the appended claims shall prevail.
Claims (10)
- A kind of 1. moving method of server, it is characterised in that including:Server to be migrated is scanned, obtains N number of hard disk to be migrated;Wherein, N is positive integer;The file of N number of hard disk to be migrated is obtained, and the file format of the file of acquisition is converted into default file form;Its In, the default file form is the file format that target virtual machine is supported;File after convert file formats is sent to the target virtual machine.
- 2. moving method according to claim 1, it is characterised in that the file for obtaining N number of hard disk to be migrated, and will The file format of the file of acquisition is converted to default file form, including:Obtain the file of N number of hard disk to be migrated, and the tray by being previously written in default file form translation interface The file format of the file of acquisition is converted to the default file form by formula transfer algorithm.
- 3. moving method according to claim 2, it is characterised in that the file by after convert file formats is sent to Target virtual machine, including:By the network interface card of the server to be migrated, successively by the file root of i-th of hard disk to be migrated after convert file formats Sent according to destination address in i-th of hard disk being pre-created to the target virtual machine;Wherein, the destination address is the mesh Server where mark virtual machine carries out the address for the memory space that data storage is distributed for the target virtual machine;I=1, 2...N。
- 4. according to the moving method described in claim any one of 1-3, it is characterised in that the N number of hard disk to be migrated of acquisition File, and after the file format of the file of acquisition is converted into default file form, in addition to:According to the check code of file generated first after convert file formats;After the file by after convert file formats is sent to target virtual machine, in addition to:The file of N number of hard disk to be migrated is obtained from the target virtual machine;According to the check code of file generated second that N number of hard disk to be migrated is obtained from the target virtual machine;Compare second check code and whether first check code is identical;If second check code differs with first check code, the file after convert file formats is re-transmitted to institute Target virtual machine is stated, until second check code is identical with first check code.
- 5. moving method according to claim 4, it is characterised in that scanning server to be migrated, obtain N number of waiting to move Move before hard disk, in addition to:The startup of server to be migrated is controlled, and controls the server to be migrated to enter file migration circle pre-set Face.
- A kind of 6. moving apparatus of server, it is characterised in that including:Scan module, for scanning server to be migrated, obtain N number of hard disk to be migrated;Wherein, N is positive integer;Processing module, for obtaining the file of N number of hard disk to be migrated, and the file format of the file of acquisition is converted to pre- If file format;Wherein, the default file form is the file format that target virtual machine is supported;Sending module, for the file after convert file formats to be sent to the target virtual machine.
- 7. moving apparatus according to claim 6, it is characterised in thatThe processing module, the file specifically for obtaining N number of hard disk to be migrated, and connect by the conversion of default file form The file format for the file that the file format transfer algorithm being previously written in mouthful obtains is converted to the default file form.
- 8. moving apparatus according to claim 7, it is characterised in thatThe sending module, specifically for the network interface card by the server to be migrated, successively by i-th after convert file formats The file of individual hard disk to be migrated is sent in i-th of hard disk being pre-created to the target virtual machine according to destination address;Wherein, The destination address is that server where the target virtual machine is deposited for what target virtual machine progress data storage was distributed Store up the address in space;I=1,2...N.
- 9. according to the moving apparatus described in claim any one of 6-8, it is characterised in that also include:Generation module, for according to the check code of file generated first after convert file formats;Acquisition module, for obtaining the file of N number of hard disk to be migrated from the target virtual machine;The generation module, it is additionally operable to according to the file generated that N number of hard disk to be migrated is obtained from the target virtual machine Second check code;Whether comparison module is identical for second check code and first check code;The sending module, differed if being additionally operable to second check code with first check code, by convert file formats File afterwards is re-transmitted to the target virtual machine, until second check code is identical with first check code.
- 10. moving apparatus according to claim 9, it is characterised in that also include:Control module, for controlling the startup of server to be migrated, and control the server to be migrated to enter and pre-set File migration interface.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710897386.4A CN107608764A (en) | 2017-09-27 | 2017-09-27 | The moving method and moving apparatus of a kind of server |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710897386.4A CN107608764A (en) | 2017-09-27 | 2017-09-27 | The moving method and moving apparatus of a kind of server |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107608764A true CN107608764A (en) | 2018-01-19 |
Family
ID=61059064
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710897386.4A Pending CN107608764A (en) | 2017-09-27 | 2017-09-27 | The moving method and moving apparatus of a kind of server |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107608764A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108449426A (en) * | 2018-04-13 | 2018-08-24 | 郑州云海信息技术有限公司 | A kind of internet of things net controller and data center's communication means and system |
| CN109542582A (en) * | 2018-10-22 | 2019-03-29 | 广东天唯科技有限公司 | A kind of method and system for the replacement server under safeguards system normal operation |
| CN111913938A (en) * | 2020-08-11 | 2020-11-10 | 中国工商银行股份有限公司 | Data migration method, system, device, electronic equipment and medium |
| CN113064699A (en) * | 2021-04-09 | 2021-07-02 | 上海安畅网络科技股份有限公司 | Heterogeneous cloud non-stop service migration method, device, equipment and storage medium |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101101592A (en) * | 2006-07-04 | 2008-01-09 | 联想(北京)有限公司 | File format automatic conversion method and device |
| CN102982116A (en) * | 2012-11-09 | 2013-03-20 | 中国联合网络通信集团有限公司 | Multi-media transfer method and system based on cloud |
| US9141415B2 (en) * | 2010-11-16 | 2015-09-22 | Syddansk Universitet | Method for dynamically transforming the bytecode of Java virtual machine bootstrap classes |
| CN106293879A (en) * | 2016-08-05 | 2017-01-04 | 浪潮(北京)电子信息产业有限公司 | A kind of P2V moving method for Linux physical server and system thereof |
| CN106775928A (en) * | 2016-11-25 | 2017-05-31 | 国家电网公司 | A kind of virtual machine Autonomic Migration Framework system and method between isomery cloud platform |
-
2017
- 2017-09-27 CN CN201710897386.4A patent/CN107608764A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101101592A (en) * | 2006-07-04 | 2008-01-09 | 联想(北京)有限公司 | File format automatic conversion method and device |
| US9141415B2 (en) * | 2010-11-16 | 2015-09-22 | Syddansk Universitet | Method for dynamically transforming the bytecode of Java virtual machine bootstrap classes |
| CN102982116A (en) * | 2012-11-09 | 2013-03-20 | 中国联合网络通信集团有限公司 | Multi-media transfer method and system based on cloud |
| CN106293879A (en) * | 2016-08-05 | 2017-01-04 | 浪潮(北京)电子信息产业有限公司 | A kind of P2V moving method for Linux physical server and system thereof |
| CN106775928A (en) * | 2016-11-25 | 2017-05-31 | 国家电网公司 | A kind of virtual machine Autonomic Migration Framework system and method between isomery cloud platform |
Non-Patent Citations (2)
| Title |
|---|
| 王先龙: "《计算机辅助药物设计实践指南》", 30 June 2016, 电子科技大学出版社 * |
| 郑淑芬: "《电子商务整合方案实战 BizTalk Server 2000 & XML》", 31 January 2002, 北京科海集团公司 * |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108449426A (en) * | 2018-04-13 | 2018-08-24 | 郑州云海信息技术有限公司 | A kind of internet of things net controller and data center's communication means and system |
| CN108449426B (en) * | 2018-04-13 | 2021-01-22 | 苏州浪潮智能科技有限公司 | Method and system for communication between Internet of things controller and data center |
| CN109542582A (en) * | 2018-10-22 | 2019-03-29 | 广东天唯科技有限公司 | A kind of method and system for the replacement server under safeguards system normal operation |
| CN111913938A (en) * | 2020-08-11 | 2020-11-10 | 中国工商银行股份有限公司 | Data migration method, system, device, electronic equipment and medium |
| CN113064699A (en) * | 2021-04-09 | 2021-07-02 | 上海安畅网络科技股份有限公司 | Heterogeneous cloud non-stop service migration method, device, equipment and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104144073B (en) | Master-slave device environment deployment method and master-slave device environment deployment system | |
| CN105052111B (en) | Service Migration Across Cluster Boundaries | |
| CN107608764A (en) | The moving method and moving apparatus of a kind of server | |
| CN104636189B (en) | Virtual machine deployment system and method based on Xen | |
| US11977637B2 (en) | Technique for authentication and prerequisite checks for software updates | |
| WO2019184164A1 (en) | Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium | |
| CN107729020A (en) | A kind of method for realizing extensive container rapid deployment | |
| CN110162332A (en) | A kind of construction method and system of RN project | |
| CN107526626A (en) | A kind of Docker containers thermomigration process and system based on CRIU | |
| CN104239122B (en) | A kind of virtual machine migration method and device | |
| CN103970908A (en) | Virtual machine template IVF storage method | |
| US20190199775A1 (en) | Streaming zip | |
| CN104281484B (en) | A kind of virtual machine migration method and device | |
| CN105518619A (en) | Scanning files for inappropriate content during synchronization | |
| CN108345493A (en) | Cross-cloud migration method for Windows virtual machines based on multi-cloud management system | |
| CN106293879A (en) | A kind of P2V moving method for Linux physical server and system thereof | |
| CN108075914A (en) | A kind of method and the network equipment of dynamic capacity-expanding capacity reducing | |
| CN114465877A (en) | Edge cloud migration method and system suitable for wireless self-organizing network environment | |
| CN112181436A (en) | Service deployment method, apparatus, server, and readable storage medium | |
| CN107203400A (en) | A kind of method and device of remote deployment component | |
| CN106878333B (en) | A third-party authentication method, device and application system server | |
| CN113448688A (en) | Method, system and computer medium for automatically correcting network configuration in cloud migration scene | |
| KR102006640B1 (en) | System, server system, method and program | |
| CN111371620A (en) | Bare computer service deployment method and system based on distributed cache | |
| CN107220388A (en) | A kind of method and apparatus of upper transmitting file |
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 | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180119 |
|
| RJ01 | Rejection of invention patent application after publication |