A data transmission method, apparatus, device, and medium
By obtaining the kth data based on the changing state of incremental data when the target program is in the running state, and controlling the target program to maintain the running state or switch to the non-running state, combining hot migration and cold migration for data transmission, the problems of service interruption and data loss during data synchronization in the prior art are solved, and efficient and stable data transmission is achieved.
Patent Information
- Application Number
- CN202111630288.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-12-28
AI Technical Summary
When the prior art realizes data synchronization between physical machines and cloud virtual machines, cold migration requires business interruption, affecting timeliness, while the probability of data loss during hot migration is high, resulting in low efficiency and poor stability.
By obtaining the kth data based on the changing state of the incremental data when the target program is in the running state, and controlling the target program to remain in the running state or switch to the non-running state, the data is realized by combining the hot migration and cold migration methods to transmit data.
It realizes data synchronization without interrupting services, reduces the probability of data loss, and improves the stability and efficiency of data transmission.
Smart Images

Figure CN114416288B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and particularly to a data transmission method, apparatus, device and medium. Background Art
[0002] In practical applications, the data synchronization between physical machine devices and cloud virtual machines (Physical to Virtual, P2V) is usually achieved by cold migration or hot migration methods. However, cold migration can only be carried out after the user's service is interrupted, which has a great impact on the timeliness of the user's service; while the probability of data loss during hot migration is very high. Summary of the Invention
[0003] Based on the above problems, embodiments of this application provide a data transmission method, apparatus, device and medium.
[0004] The technical solution provided by the embodiments of this application is as follows:
[0005] Embodiments of this application provide a data transmission method, which is applied to a first device, and the method includes:
[0006] When the target program is in a running state, based on the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period, the k-th data is obtained; where k is an integer greater than or equal to 2;
[0007] Based on the k-th data, control the target program to maintain the running state or switch to any non-running state;
[0008] Transmit the k-th data to a second device through the k-th data transmission operation;
[0009] If the target program is in any non-running state, control the target program to switch to the running state.
[0010] Embodiments of this application also provide a data transmission apparatus, which includes a processing module, a control module and a transmission module, where:
[0011] The processing module is configured to, when the target program is in a running state, based on the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period, obtain the k-th data; where k is an integer greater than or equal to 2;
[0012] The control module is configured to control the target program to maintain the running state or switch to any non-running state based on the k-th data;
[0013] The transmission module is configured to transmit the k-th data to a second device through a k-th data transmission operation;
[0014] The control module is further configured to, if the target program is in any of the non-running states, control the target program to switch to the running state.
[0015] An embodiment of the present application further provides a first device, which includes a processor and a memory; wherein, a computer program is stored in the memory; when the computer program is executed by the processor, it can implement the data transmission method described in any of the previous paragraphs.
[0016] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor of an electronic device, it can implement the data transmission method described in any of the previous paragraphs.
[0017] As can be seen from the above, for the data transmission method applied to the first device provided by the embodiment of the present application, when the target program is in the running state, the k-th data is obtained based on the change state of the incremental data associated with the running state of the target program in the first storage space within the k-th period, and then based on the k-th data, the target program is controlled to maintain the running state or switch to any non-running state, and the k-th data is transmitted to the second device through the k-th data transmission operation. Moreover, when the target program is in any non-running state, the target program can also be controlled to switch to the running state.
[0018] In this way, when the target program is controlled to maintain the running state based on the k-th data, the k-th data is transmitted to the second device through the k-th data transmission operation, thereby realizing the hot migration operation of the k-th data; and when the target program is controlled to switch to any non-running state based on the k-th data, and the k-th data is transmitted to the second device through the k-th data transmission operation, thereby realizing the cold migration operation of the k-th data, that is, the data transmission operation between the first device and the second device is realized by combining hot migration and cold migration; since the k-th data during cold migration execution is also the change state of the incremental data associated with the running state in the first storage space of the first device, therefore, by virtue of the stability of cold migration data transmission, the probability of data loss during the hot migration process between the first device and the second device can also be reduced, thereby improving the stability of data transmission between the first device and the second device.
[0019] When the first device is a physical machine device and the second device is a cloud virtual machine device, the data transmission method applied to the first device provided by the embodiment of the present application can reduce the probability of data loss during the P2V data synchronization process and improve the P2V data synchronization efficiency. Description of the Drawings
[0020] Figure 1 Schematic flow chart of the data transmission method provided by an embodiment of the present application;
[0021] Figure 2 Schematic flow chart of controlling the running state of a target program provided by an embodiment of the present application;
[0022] Figure 3 Schematic flow chart of controlling a target program to switch to any non - running state provided by an embodiment of the present application;
[0023] Figure 4 Schematic flow chart of obtaining the k - th data provided by an embodiment of the present application;
[0024] Figure 5 Another schematic flow chart of obtaining the k - th data provided by an embodiment of the present application;
[0025] Figure 6 Schematic flow chart of executing the k - th data transmission operation provided by an embodiment of the present application;
[0026] Figure 7 Another schematic flow chart of the data transmission method provided by an embodiment of the present application;
[0027] Figure 8 Schematic architecture diagram of the data transmission operation between the first device and the second device provided by an embodiment of the present application;
[0028] Figure 9 Schematic structural diagram of the data transmission device provided by an embodiment of the present application;
[0029] Figure 10 Schematic structural diagram of the first device provided by an embodiment of the present application. Detailed implementation manners
[0030] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application.
[0031] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0032] The present application relates to the field of information technology, and in particular, to a data transmission method, device, equipment, and medium.
[0033] In practical applications, the implementation methods of P2V mainly include cold migration and hot migration. Among them, the disadvantage of cold migration is that it requires a long interruption of the customer's business, which will have a great impact on the stability of the customer's business; while hot migration does not require interruption of the customer's business and has less impact on the customer's business, but data loss often occurs during the hot migration process, thus reducing the efficiency of P2V.
[0034] Based on the above problems, an embodiment of the present application provides a data transmission method, which can be implemented by a processor of a first device.
[0035] It should be noted that the above-mentioned processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor.
[0036] In one implementation, the first device can be a physical machine device. Exemplarily, the physical machine device can be a computer device; Exemplarily, the computer device can be a server, a personal computer, etc., or can also be a mobile terminal device, such as a notebook computer, etc.
[0037] Figure 1 The flowchart of the data transmission method provided by the embodiment of the present application is shown in Figure 1 As shown, the method may include steps 101 to 104:
[0038] Step 101, when the target program is in a running state, obtain the k-th data based on the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period.
[0039] Where k is an integer greater than or equal to 2.
[0040] Exemplarily, when the target program is in a non-running state, the change state of the data in the first storage space may not be processed.
[0041] In one implementation, the target program may include only one application program or may include multiple application programs; Exemplarily, when the target program includes multiple application programs, the types of the respective application programs may be different, and moreover, the data processing methods, the data to be processed, and the target data generated during the running process of the respective application programs may also be different.
[0042] In one embodiment, the target program can be used to respond to a customer's service request and process the service request, so as to realize the customer's service request.
[0043] In one embodiment, the k-th period can be a period with a preset fixed time length, such as ten minutes or one hour.
[0044] In one embodiment, the k-th period can be determined according to at least one of the types of application programs in the target program, the number of application programs, and the amount of data associated with the running state of the target application program. Exemplarily, the time length of the k-th period can be shortened as at least one of the types of application programs in the target program, the number of application programs, and the amount of data associated with the running state of the target application program increases, and can also be extended as at least one of the types of application programs in the target program, the number of application programs, and the amount of data associated with the running state of the target program decreases.
[0045] In one embodiment, the amount of data associated with the running state of the target program can include at least one of the data relied on during the running of the target program, the data output during the running of the target program, and the intermediate data generated during the running of the target program; Exemplarily, the intermediate data generated during the running of the target program can include log data during the running of the target program, etc.
[0046] In one embodiment, the amount of data associated with the running state of the target program can include the number of data affected by the running state of the target program per unit time; Exemplarily, the unit time can be one minute or ten minutes, and the embodiments of the present application do not limit this; Exemplarily, the number of data affected by the running state of the target program can include the capacity sizes of at least one of the disk space, memory space, and cache space occupied due to the running state of the target program.
[0047] In one embodiment, the first storage space can include the disk space set in the first device, can also include the memory space of the first device, and can also include the external storage space connected to the first device; Exemplarily, the external storage space can be a hard disk (Hard Disk Drive, HDD) that has established a communication connection with the first device; Exemplarily, the first storage space can include multiple storage spaces, and the positions, types, and functions of each storage space can be different.
[0048] In one embodiment, the incremental data associated with the running state in the first storage space of the first device during the k-th period may include the incremental data generated due to the running state of the target program; for example, when the first application included in the target program is used to implement the data acquisition function, the incremental data associated with the running state may include at least one of the data collected by the first application during the k-th period, the storage capacity data in the first storage space occupied by the first application due to data collection during the k-th period, and the memory capacity data of the first device occupied by the first application due to data collection during the k-th period.
[0049] In one embodiment, the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period may include at least one of the change speed information of the incremental data associated with the running state in the first storage space during the k-th period and the type change information of the incremental data; for example, the type change information of the incremental data includes the new type information in the incremental data. When the incremental data includes multiple types of data, the type change information of the incremental data may further include the proportion change information of various types of data in the incremental data.
[0050] Step 102, based on the k-th data, control the target program to maintain the running state or switch to any non-running state.
[0051] In one embodiment, any non-running state may include any one of Stop, Pause, and Suspend.
[0052] In one embodiment, based on the k-th data, controlling the target program to maintain the running state or switch to any non-running state may be implemented by any of the following methods:
[0053] Obtain the data type information in the k-th data. When the data type information indicates that the k-th data contains the specified type of data, control the target program to maintain the running state. When the data type information indicates that the k-th data does not contain the specified type of data, control the target program to switch to any non-running state.
[0054] Obtain the change speed information of the incremental data in the k-th data. When the change speed information indicates that the growth speed of the incremental data included in the k-th data is greater than or equal to the preset speed threshold, control the target program to maintain the running state; if the change speed information indicates that the growth speed of the incremental data included in the k-th data is less than the preset threshold, control the target program to switch to any non-running state.
[0055] In the case where the target program includes multiple programs, based on the k-th data, control the specified program in the target program to maintain the running state, and control other programs in the target program except the specified program to switch to the non-running state; Exemplarily, the specified program can be a user application program or a system application program.
[0056] Step 103: Transmit the k-th data to the second device through the k-th data transmission operation.
[0057] In one implementation, the second device may include a virtual machine device set in a remote server; Exemplarily, the operating system of the virtual machine device may be the same as the operating system of the first device; Exemplarily, the remote server may include the cloud.
[0058] In one implementation, the number of second devices may be multiple, and each second device may be respectively set in different remote servers; Exemplarily, the first device may send the k-th data to the corresponding second device according to the data type of the k-th data, the k-th time period, and the application type corresponding to the k-th data.
[0059] In one implementation, a third storage space corresponding to the first storage space may be set in the second device; Exemplarily, the size of the third storage space may be the same as the size of the first storage space. At this time, after receiving the k-th data, the second device may store the k-th data in the third storage space.
[0060] In one implementation, the k-th data transmission operation may be different from the (k - 1)-th data transmission operation; Exemplarily, the data volume size and type of the k-th data included in the k-th data transmission operation may be different from the data volume size and type of the (k - 1)-th data included in the (k - 1)-th data transmission operation.
[0061] In one implementation, the data transmission technology adopted by the k-th data transmission operation and the (k - 1)-th data transmission operation may be the same.
[0062] Step 104: If the target program is in any non-running state, control the target program to switch to the running state.
[0063] Correspondingly, if the target program is in the running state, control the target program to maintain the running state.
[0064] It should be noted that in the embodiments of the present application, steps 101 to 104 may be executed in sequence according to the time order. That is, after the k-th data transmission operation ends, the processor of the first device may judge the current state of the target program. In the case where the target program is in any non-running state, the target program may be controlled to switch to the running state so that the target program continues to run.
[0065] As can be seen from the above, for the data transmission method applied to the first device provided in the embodiments of the present application, when the target program is in a running state, the k-th data is obtained based on the change state of the incremental data associated with the running state of the target program in the first storage space during the k-th period, and then based on the k-th data, the target program is controlled to maintain the running state or switch to any non-running state, and the k-th data is transmitted to the second device through the k-th data transmission operation. Moreover, when the target program is in any non-running state, the target program can also be controlled to switch to the running state.
[0066] In this way, when the target program is controlled to maintain the running state based on the k-th data, the k-th data is transmitted to the second device through the k-th data transmission operation, thereby realizing the hot migration operation of the k-th data; if the target program is controlled to switch to any non-running state based on the k-th data, and the k-th data is transmitted to the second device through the k-th data transmission operation, the cold migration operation of the k-th data is realized, that is, the data transmission operation between the first device and the second device is realized by combining hot migration and cold migration; since the k-th data during cold migration execution is also the change state of the incremental data associated with the running state in the first storage space of the first device, therefore, by virtue of the stability of cold migration data transmission, through the combination of hot migration and cold migration, the probability of data loss during the hot migration process between the first device and the second device can also be reduced, thereby improving the stability of data transmission between the first device and the second device.
[0067] When the first device is a physical machine device and the second device is a cloud virtual machine device, the data transmission method applied to the first device provided in the embodiments of the present application can reduce the probability of data loss during the P2V data synchronization process and improve the P2V data synchronization efficiency.
[0068] Based on the foregoing embodiments, in the data transmission method applied to the first device provided in the embodiments of the present application, based on the k-th data, controlling the target program to maintain the running state or switch to any non-running state can be achieved by Figure 2 implemented, Figure 2 is a schematic flowchart of the process for controlling the running state of the target program provided in the embodiments of the present application. As Figure 2 shown, the process may include steps 1021 to 1022:
[0069] Step 1021, obtain a data volume threshold.
[0070] In one implementation, the data volume threshold may be preset before obtaining the k-th data; exemplarily, the data volume threshold may be fixed.
[0071] In one embodiment, the data volume threshold can be adjustable; for example, the data volume threshold can be flexibly adjusted according to at least one of the number and type of application programs in the target program, the data volume change rate of the data associated when the application program is in the running state, and the running period of the target program. For example, the running period of the target program can be divided according to the number of requests processed by the target program. For example, the running period of the target program can include a peak running period such as the working hours on weekdays, and a non-peak running period such as non-working days.
[0072] In one embodiment, the data volume thresholds corresponding to different first devices can be different; for example, the data volume threshold can vary according to the data processing speed, the size of the memory space, and the size of the buffer storage space of the first device, which is not limited in the embodiments of the present application. For example, the data processing speed of the first device can be related to at least one of the main frequency and the number of cores of the processor of the first device.
[0073] Step 1022: If the data volume of the k-th data is less than the data volume threshold, control the target program to switch to any non-running state; if the data volume of the k-th data is greater than or equal to the data volume threshold, control the target program to remain in the running state.
[0074] In one embodiment, if the data volume of the k-th data is less than the data volume threshold and there are multiple application programs in the target program, the non-running states switched by the multiple application programs can be different. For example, the non-running state switched by the first application program can be the stop state (Stop), and the non-running state switched by the second application program can be the pause state (Pause).
[0075] As can be seen from the above, the data transmission method applied to the first device provided by the embodiments of the present application can determine the state of the target program according to the size relationship between the data volume threshold and the data volume of the k-th data after obtaining the k-th data. When the data volume threshold is adjustable, it is possible to flexibly control the execution conditions of the k-th data transmission operation, that is, it is possible to flexibly control the hot migration and cold migration of data between the first device and the second device, thereby further improving the efficiency of data synchronization operations between the first device and the second device and reducing the probability of data loss when the first device synchronizes data to the second device. When the first device is a physical machine device and the second device is a cloud virtual machine device, it can improve the flexibility of P2V data synchronization, reduce the probability of data loss during P2V data synchronization, and improve the data synchronization efficiency of P2V.
[0076] Meanwhile, in the embodiment of the present application, the data stored in the first storage space and associated with the running state of the target program can be directly transmitted to the second device, so that the data generated during the running of the target program, such as business data, can be directly transmitted to the second device; compared with the method in the related art where cloud business data needs to be synchronized through the management network, the data transmission method applied to the first device provided by the embodiment of the present application can also reduce the cost of data transmission and improve the data transmission rate.
[0077] Based on the foregoing embodiments, in the data transmission method applied to the first device provided by the embodiment of the present application, to control the target program to switch to any non-running state, it can be achieved by Figure 3 realize Figure 3 FIG. is a schematic flowchart of controlling the target program to switch to any non-running state provided by the embodiment of the present application. As Figure 3 shown, the process may include steps 10221 to 10223:
[0078] Step 10221, obtain the data transmission speed between the first device and the second device.
[0079] In one implementation, the data transmission speed between the first device and the second device may vary with at least one of the data transmission protocol adopted by the k-th data transmission operation, the network routing state between the first device and the second device, and the time period range during which the k-th data transmission operation is executed. Exemplarily, when the network routing state is poor and the time period range during which the k-th data transmission operation is executed is the peak business period, the data transmission speed between the first device and the second device may decrease.
[0080] Step 10222, determine the duration of any non-running state based on the k-th data and the data transmission speed.
[0081] In one implementation, the duration of any non-running state may be determined based on the quotient of the data volume of the k-th data and the data transmission speed.
[0082] In one implementation, the duration of the target program switching to any non-running state may be less than or equal to a preset time threshold; Exemplarily, the preset time threshold may be the time length when the target program switches to any non-running state and the duration of the non-running state does not affect the processing of business data, or the degree of influence of the duration of the non-running state on the processing of business data is less than or equal to the expected influence degree; Exemplarily, the preset time threshold may change according to at least one of the type of the application program, the type of the business data processed by the application program, and the business data processing flow of the application program.
[0083] Step 10223, based on the duration, control the target program to switch to any non - running state.
[0084] In one implementation, based on the duration, controlling the target program to switch to any non - running state may include controlling the target program to switch to any non - running state and controlling the target program to maintain the non - running state for a duration of time equal to the duration.
[0085] As can be seen from the above, in the data transmission method applied to the first device provided by the embodiments of the present application, the first device can determine the duration of the target program in any non - running state based on the k - th data and the data transmission speed. In this way, for different k - th data, the duration of the target program switching to any non - running state can be flexibly adjusted to meet the diverse transmission requirements of different data between the first device and the second device; and since the data volume of the k - th data is less than the data volume threshold, controlling the time length of the target program switching to any non - running state to be the duration obtained based on the k - th data can also reduce the impact of the target program switching to any non - running state on customer business processing.
[0086] Based on the foregoing embodiments, in the data transmission method applied to the first device provided by the embodiments of the present application, the k - th data can be obtained based on the change state of the data increment associated with the running state in the first storage space of the first device during the k - th period, and it can be achieved through the Figure 4 process shown below. Figure 4 This is a schematic flowchart of the process for obtaining the k - th data provided by the embodiments of the present application. As Figure 4 shown, this process may include steps A1 to A2:
[0087] Step A1, during the k - th period, monitor the change state of the data associated with the running state in the first storage space through inotify.
[0088] In one implementation, the change state of the data associated with the running state in the first storage space may include two states: the data associated with the running state changes in the first storage space and the data does not change.
[0089] In one implementation, the change state of the data associated with the running state in the first storage space may include whether at least one event such as addition, deletion, modification, and movement of the data associated with the running state in the first storage space occurs. If at least one of the above events occurs, it can be determined that the data associated with the running state changes in the first storage space.
[0090] Step A2: If it is monitored that the data associated with the running state changes in the first storage space, count the data increment of the data associated with the running state in the first storage space to obtain the k-th data.
[0091] In one implementation, if inotify detects that the data associated with the running state changes in the first storage space, then count the data increment of the data associated with the running state under at least one path in the first storage space to obtain a statistical result, and use the statistical result as the k-th data.
[0092] As can be seen from the above, in the data transmission method applied to the first device provided in the embodiments of the present application, the first device can monitor the change status of the data associated with the running state of the target program in the first storage space through inotify, and based on this change status, count the incremental data of the data associated with the running state in the first storage space to obtain the k-th data. Since inotify is sensitive, simple to use and can achieve efficient data monitoring, therefore, through inotify, it is possible to achieve efficient and accurate monitoring of the change status of the data associated with the running state in the first storage space, thereby improving the data transmission efficiency between the first device and the second device, and further accelerating the data synchronization speed between the first device and the second device.
[0093] Based on the foregoing embodiments, in the data transmission method applied to the first device provided in the embodiments of the present application, based on the change status of the incremental data associated with the running state in the first storage space of the first device within the k-th period, the k-th data is obtained, and it can also be achieved through Figure 5 implementation. Figure 5 This is another process schematic diagram for obtaining the k-th data provided by the embodiments of the present application. As Figure 5 shown, this process may include steps B1 to B3:
[0094] Step B1: Obtain the (k - 1)-th result of the (k - 1)-th data transmission operation.
[0095] In one implementation, the (k - 1)-th result may include any one of the following: the (k - 1)-th data transmission operation successfully transmits all the (k - 1)-th data to the second device, the (k - 1)-th data transmission operation successfully transmits some of the (k - 1)-th data to the second device, and all the (k - 1)-th data transmitted by the (k - 1)-th data transmission operation fails. Exemplarily, in the case where the (k - 1)-th result indicates that at least some of the (k - 1)-th data fails, the (k - 1)-th result may further include the reason for the failure of at least some of the (k - 1)-th data, and may also include the data information of the successfully transmitted data in the (k - 1)-th data.
[0096] Step B2. If the (k - 1)th result indicates that at least some of the data in the (k - 1)th data fails to be transmitted, obtain the data in the (k - 1)th data that fails to be transmitted.
[0097] Correspondingly, if the (k - 1)th result indicates that the (k - 1)th data is successfully transmitted, there is no need to perform the operation of obtaining the data in the (k - 1)th data that fails to be transmitted.
[0098] In one implementation, the data in the (k - 1)th data that fails to be transmitted can be determined according to the data information of the successfully transmitted data in the (k - 1)th result and the (k - 1)th data.
[0099] Step B3. Based on the change status of the incremental data associated with the running state in the first storage space during the kth period and the data in the (k - 1)th data that fails to be transmitted, obtain the kth data.
[0100] In one implementation, the kth data can be obtained in the following manner:
[0101] Combine the data in the (k - 1)th data that fails to be transmitted with the incremental data associated with the running state in the first storage space that has changed during the kth period to obtain the kth data.
[0102] As can be seen from the above, in the data transmission method applied to the first device provided by the embodiments of the present application, the kth data can be obtained based on the data in the (k - 1)th data that fails to be transmitted and the change status of the incremental data associated with the running state in the first storage space during the kth period, and the kth data is transmitted to the second device through the kth data transmission operation, thereby further reducing the probability of data loss during the data synchronization process from the first device to the second device.
[0103] Based on the foregoing embodiments, in the data transmission method applied to the first device provided by the embodiments of the present application, the kth data transmission operation includes a data transmission operation based on rsync. Correspondingly, transmitting the kth data to the second device through the kth data transmission operation can be achieved by Figure 6 implemented. Figure 6 It is a schematic flowchart of the execution of the kth data transmission operation provided by the embodiments of the present application. As Figure 6 shown, this process may include Step 1031 to Step 1032:
[0104] Step 1031. Encrypt the kth data to obtain the encrypted kth data.
[0105] In one implementation, the encryption method for the kth data can be determined according to at least one of the type of the kth data, the data volume size, the type of the application program associated with the kth data, and the privacy of the kth data, etc.
[0106] In one embodiment, encrypting the k-th data can be achieved through the Secure Shell Protocol (SSH). Here, SSH is a security protocol based on the application layer. SSH is a highly reliable protocol dedicated to providing security for remote login sessions and other network services.
[0107] Step 1032: Transmit the encrypted k-th data to the second device through rsync.
[0108] In one embodiment, the first device can, within the k-th time period, collect all incremental data associated with the running state in the first storage space through rsync to obtain the k-th data, encrypt the k-th data, and then send the encrypted k-th data to the second device. Correspondingly, after receiving the encrypted k-th data, the second device can perform a decryption operation on it to obtain the k-th data and store the k-th data in the third storage space.
[0109] In one embodiment, the first device can collect partial incremental data associated with the running state in the first storage space through rsync within the k-th time period to obtain the k-th data. Exemplarily, the partial incremental data can include partial types of incremental data associated with the running state in the first storage space, and can also include incremental data under partial paths associated with the running state in the first storage space, etc. The embodiments of the present application do not limit this.
[0110] As can be seen from the above, for the data transmission method applied to the first device provided by the embodiments of the present application, after obtaining the k-th data, the k-th data is encrypted, and then the encrypted k-th data is sent to the second device through rsync. In this way, on the one hand, the security of the k-th data during the transmission to the second device can be improved. On the other hand, since rsync itself has an incremental data synchronization function and can cooperate with various data transmission methods to achieve synchronous data transmission, the cost of data transmission between the first device and the second device can be reduced, and the flexibility of data transmission between the first device and the second device can be improved.
[0111] Based on the foregoing embodiments, for the data transmission method applied to the first device provided by the embodiments of the present application, before obtaining the k-th data based on the change state of the incremental data associated with the running state in the first storage space of the first device within the k-th time period, steps C1 to C2 can also be performed:
[0112] Step C1: Obtain all data associated with the running state in the first storage space to obtain the first data.
[0113] In one embodiment, obtaining the full amount of data associated with the running state in the first storage space may be an operation performed within a specified time length after detecting the running of the target program; exemplarily, the full amount of data may include all types of full amount of data associated with the running state in the first storage space.
[0114] In one embodiment, after obtaining the first data, the first data may also be encrypted to obtain the encrypted first data; exemplarily, the first data may be encrypted through SSH.
[0115] Step C2: Transmit the first data to the second device through the first data transmission operation.
[0116] Exemplarily, the first data transmission operation may transmit the first data to the second device in a manner different from the k-th data transmission operation.
[0117] Exemplarily, the first data transmission operation includes a data transmission operation based on tar.
[0118] Exemplarily, the encrypted first data may be transmitted to the second device through tar. Correspondingly, after receiving the encrypted first data, the second device may decrypt it to obtain the first data and store the first data in the third storage space.
[0119] As can be seen from the above, in the data transmission method applied to the first device provided by the embodiments of the present application, when the processor of the first device detects that the target program is in a running state, it can obtain the full amount of data associated with the running state in the first storage space, that is, the first data, and transmit the first data to the second device through the first data transmission operation. In this way, the first data transmitted by the first data transmission operation and the k-th data transmitted by the k-th data transmission operation constitute all the data associated with the running process of the target program in the first device, thus realizing the full transmission of the data associated with the running state of the target program in the first device.
[0120] Based on the foregoing embodiments, in the data transmission method applied to the first device provided by the embodiments of the present application, the first storage space includes a storage space configured with a file system.
[0121] In one embodiment, the file system may include any one of ext2, ext3, ext4, xfs, and reisfers; exemplarily, when the first storage space includes multiple storage spaces, the file systems of each storage space may be different.
[0122] In the embodiments of the present application, after controlling the target program to switch to any non-running state, the data transmission method applied to the first device provided by the embodiments of the present application may further include steps D1 to D3:
[0123] Step D1: Obtain the target data stored in the second storage space.
[0124] Among them, the second storage space includes a storage space without a configured file system.
[0125] In one implementation, the target data stored in the second storage space can be log data; this log data can be generated during the operation of the first device or during the operation of the target program, and the embodiments of the present application do not limit this.
[0126] Exemplarily, in the second device, a storage space identical to the second storage space can be set, and exemplarily, this storage space can be recorded as the fourth storage space.
[0127] Step D2: Encrypt the target data to obtain the encrypted target data.
[0128] In one implementation, the target data can be encrypted through SSH to obtain the encrypted target data.
[0129] Step D3: Transmit the encrypted target data to the second device.
[0130] Exemplarily, the encrypted target data can be transmitted to the second device through dd.
[0131] Exemplarily, after receiving the encrypted target data, the second device can decrypt the encrypted target data to obtain the target data and store the target data in the fourth storage space.
[0132] Exemplarily, a fourth storage space corresponding to the second storage space can be set in the second device; exemplarily, the fourth storage space can also not be configured with a file system.
[0133] As can be seen from the above, in the data transmission method applied to the first device provided by the embodiments of the present application, the first device can not only transmit the data in the first storage space configured with a file system to the second device through a method combining hot migration and cold migration, but also securely and stably transmit the data in the second storage space without a configured file system to the second device after the application program switches to any non-running state, thereby realizing diversified and flexible data synchronization of various storage spaces between the first device and the second device.
[0134] Figure 7 It is another process schematic diagram of the data transmission method provided by the embodiments of the present application. As Figure 7 shown, this method can include steps 201 to 207:
[0135] Step 201, data transmission starts.
[0136] Exemplarily, at the start of data transmission, the target program may already be in a running state; exemplarily, when it is detected that the target program starts, the data transmission process may be started simultaneously.
[0137] Step 202, monitor the change status of files through inotify.
[0138] Exemplarily, the processor of the first device may monitor the change status of the data associated with the running state of the target program in the first storage space of the first device through inotify. Exemplarily, this data may be stored in a file. Therefore, by monitoring the change status of the file in the first storage space through inotify, the k-th data can be obtained.
[0139] Step 203, notify rsync that the file has been updated through inotify.
[0140] Exemplarily, when inotify monitors that the data in any file associated with the running state in the first storage space has changed, a notification message can be sent to rsync to start the incremental data statistics process.
[0141] Step 204, obtain the k-th data through rsync.
[0142] Exemplarily, rsync can count the incremental data of the data contained in the file based on the update status of the file, so as to obtain the k-th data.
[0143] Step 205, determine whether the data volume of the k-th data is less than the data volume threshold.
[0144] Exemplarily, the data volume threshold can be preset. For example, the data volume threshold can be 500M.
[0145] If the data volume of the k-th data is less than the data volume threshold, step 206 can be executed; if the data volume of the k-th data is greater than or equal to the quantity threshold, the incremental data can be transmitted to the second device through rsync, and step 202 can be continued to be executed.
[0146] Step 206, pause the target application and transmit the k-th data.
[0147] Exemplarily, the first device can transmit the k-th data to the second device through the k-th data transmission operation; exemplarily, the k-th data transmission operation can be rsync.
[0148] It should be noted that although the previous steps are not shown, before any data transmission, the first data or the k-th data can be encrypted to obtain the encrypted first data or the k-th data, and then the encrypted first data is transmitted to the second device through tar, and the encrypted k-th data is transmitted to the second device through rsync.
[0149] Step 207, the k-th data transmission operation ends.
[0150] Exemplarily, after the k-th data transmission operation ends, the target program can be controlled to switch to the running state to execute the k + 1-th data transmission process.
[0151] Exemplarily, for the k + 1-th data transmission process, the data that fails to be transmitted in the k-th data can be determined based on the k-th result of the k-th data transmission operation, and then based on the data that fails to be transmitted in the k-th data and the file change status monitored by inotify, the k + 1-th data is obtained, and the k + 1-th data is transmitted to the second device through the k + 1-th data transmission operation.
[0152] Figure 8 This is a schematic architecture diagram of the data transmission operation between the first device and the second device provided by the embodiments of the present application. As Figure 8 shown, a communication connection is established between the first device 301 and the cloud device 302, and a second device 3021 is set in the cloud device 302. Exemplarily, the second device 3021 can be a virtual machine.
[0153] Exemplarily, a first storage space 3011 and a second storage space 3012 can be set in the first device 301. Among them, the first storage space 3011 can be configured with a file system, and the second storage space 3012 may not be configured with a file system.
[0154] Exemplarily, in addition to the second device 3021 in the cloud device 302, a physical storage area 3022 can also be set, and the physical storage area 3022 includes a first storage area 30221 and a second storage area 30222.
[0155] Exemplarily, before the data transmission operation between the first device 301 and the second device 3021 starts, the cloud device 302 can obtain the device information of the first device 301 through the communication connection and create the second device 3021 according to this device information; Exemplarily, the device information of the first device 301 can include the operating system loaded by the first device 301, the disk partition information in the first device 301, the network port configuration of the first device 301, etc. Exemplarily, after the second device 3021 is created, a third storage space 30211 and a fourth storage space 30212 can be created according to the disk partition information in the first device 301.
[0156] Exemplarily, the first device 301 may send the file system information of the first storage space 3011 to the second device 3021. The second device 3021 creates a third storage space 30211 with the same file system as that of the first storage space 3011 according to the received file system information, and the third storage space 30211 is mapped to the first storage area 30211. The second device may also create a fourth storage space 30212 corresponding to the second storage space 3012, and the fourth storage space 30212 may be mapped to the second storage area 30222.
[0157] Exemplarily, a target program may be running in the first device 301, and the target program may be started simultaneously with the data transmission method in the first device 301. After the target program is started, the first device 301 first obtains all the data associated with the running state of the target program in the first storage space 3011, i.e., the first data, encrypts the first data, and then transmits the encrypted first data through tar, thereby completing the first data transmission operation.
[0158] Exemplarily, when k is greater than or equal to 2, the processor of the first device 301 may obtain the k-th data through the process as Figure 7 shown, determine whether to suspend the target program based on the relationship between the data volume of the k-th data and the data volume threshold, and may also encrypt the k-th data and transmit the encrypted k-th data to the second device 3021 through rsync.
[0159] Exemplarily, after receiving the encrypted first data or the encrypted k-th data, the second device 3021 may decrypt the encrypted first data or the encrypted k-th data to obtain the first data or the k-th data, and store the first data or the k-th data in the third storage space 30211, thereby forming a mirror of the first data or the k-th data in the first storage area 30221. Exemplarily, the mirror of the first data or the k-th data in the first storage area 30221 may be in the qcow2 format.
[0160] Exemplarily, after the target program is suspended, the first device 301 may obtain the target data stored in the second storage space 3012, encrypt it to obtain the encrypted target data, and transmit the encrypted target data to the second device 3021 through dd. After receiving the encrypted target data, the second device 3021 may decrypt the encrypted target data to obtain the target data, and store the target data in the fourth storage space 30212, thereby forming a mirror of the target data in the second storage area 30222. Exemplarily, the mirror of the target data in the second storage area 30222 may be in the qcow2 format.
[0161] As can be seen from the above, for the data associated with the running state of the target program in the first storage space 3011 configured with a file system, the synchronization between it and the second device 3021 can be achieved by combining hot migration and cold migration; for the data stored in the second storage space 3012 without a configured file system, its synchronization with the second device 3021 can be achieved during the cold migration of the data in the first storage space 3011.
[0162] Based on the foregoing embodiments, an embodiment of the present application further provides a data transmission device 4, Figure 9 which is a schematic structural diagram of the data transmission device 4 provided by the embodiment of the present application. As Figure 9 shown, the data transmission device may include: a processing module 401, a control module 402, and a transmission module 403, where:
[0163] The processing module 401 is configured to, when the target program is in a running state, obtain the k-th data based on the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period; where k is an integer greater than or equal to 2;
[0164] The control module 402 is configured to control the target program to maintain the running state or switch to any non-running state based on the k-th data;
[0165] The transmission module 403 is configured to transmit the k-th data to the second device through the k-th data transmission operation;
[0166] The control module 402 is further configured to, if the target program is in any non-running state, control the target program to switch to the running state.
[0167] In one implementation, the processing module 401 is configured to obtain a data volume threshold;
[0168] The control module 402 is configured to, if the data volume of the k-th data is less than the data volume threshold, control the target program to switch to any non-running state; if the data volume of the k-th data is greater than or equal to the data volume threshold, control the target program to maintain the running state.
[0169] In one implementation, the processing module 401 is configured to obtain the data transmission speed between the first device and the second device; determine the duration of any non-running state based on the k-th data and the data transmission speed;
[0170] The control module 402 is configured to control the target program to switch to any non-running state based on the duration.
[0171] In one embodiment, the processing module 401 is configured to obtain the (k - 1)th result of the (k - 1)th data transmission operation; if the (k - 1)th result indicates that at least part of the data in the (k - 1)th data fails to be transmitted, obtain the data that fails to be transmitted in the (k - 1)th data; and obtain the kth data based on the change status of the incremental data associated with the running state in the first storage space during the kth period and the data that fails to be transmitted in the (k - 1)th data.
[0172] In one embodiment, the processing module 401 is configured to monitor, through inotify, the change status of the data associated with the running state in the first storage space during the kth period; if it is monitored that the data associated with the running state changes in the first storage space, count the data increment associated with the running state in the first storage space to obtain the kth data.
[0173] In one embodiment, for the kth data transmission operation, the processing module 401 is configured to encrypt the kth data to obtain the encrypted kth data; and transmit the encrypted kth data to the second device through rsync.
[0174] In one embodiment, the processing module 401 is configured to obtain the full amount of data associated with the running state in the first storage space to obtain the first data;
[0175] The transmission module 403 is configured to transmit the first data to the second device through the first data transmission operation.
[0176] In one embodiment, the processing module 401 is configured to obtain the target data stored in the second storage space; encrypt the target data to obtain the encrypted target data;
[0177] wherein, the second storage space includes a storage space without a configured file system;
[0178] The transmission module 403 is configured to transmit the encrypted target data to the second device.
[0179] Based on the foregoing embodiments, the embodiments of the present application further provide a first device 5, Figure 10 which is a schematic structural diagram of the first device 5 provided by the embodiments of the present application. As Figure 5 shown, the first device 5 may include a processor 501 and a memory 502. Among them, a computer program is stored in the memory 502, and when the computer program is executed by the processor 501, it can implement the data transmission method applied to the first device as described in any previous embodiment.
[0180] It should be noted that the foregoing processor 501 may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0181] The aforementioned memory 502 can be a volatile memory, such as a Random Access Memory (RAM); or a non-volatile memory, such as a Read-Only Memory (ROM), flash memory, Hard Disk Drive (HDD), or Solid State Disk (SSD); or a combination of the aforementioned types of memories, and provides instructions and data to the processor 501.
[0182] The aforementioned processing module 401, control module 402, and transmission module 403 can be implemented by the processor 501.
[0183] Based on the foregoing embodiments, an embodiment of the present application further provides a computer-readable storage medium. A computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor of an electronic device, it can implement the data transmission method applied to the first device as described in any of the previous embodiments.
[0184] The descriptions of the various embodiments above tend to emphasize the differences between the various embodiments. Their similarities or resemblances can be referred to each other. For the sake of brevity, they will not be elaborated herein.
[0185] The methods disclosed in the method embodiments provided by the present application can be arbitrarily combined without conflict to obtain new method embodiments.
[0186] The features disclosed in the product embodiments provided by the present application can be arbitrarily combined without conflict to obtain new product embodiments.
[0187] The features disclosed in the method or device embodiments provided by the present application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0188] It should be noted that the above computer-readable storage medium can be a ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; it can also be various electronic devices including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0189] It should be noted that in this text, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising such element.
[0190] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.
[0191] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus necessary general hardware nodes. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the various embodiments of the present application.
[0192] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce means for implementing the functions specified in the Figure 1 one or more of the flows and / or blocks Figure 1 one or more of the blocks.
[0193] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in the Figure 1 one or more of the flows and / or blocks Figure 1 one or more of the blocks.
[0194] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in the Figure 1 one or more of the flows and / or blocks Figure 1 one or more of the blocks.
[0195] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.
Claims
1. A data transmission method, characterized in that, The method is applied to a first device, and the method includes: When the target program is in a running state, obtaining k-th data based on the change state of incremental data associated with the running state in the first storage space of the first device during the k-th period; where k is an integer greater than or equal to 2; Based on the k-th data, controlling the target program to maintain the running state or switch to any non-running state; Transmitting the k-th data to a second device through a k-th data transmission operation; If the target program is in any non-running state, controlling the target program to switch to the running state; The controlling the target program to maintain the running state or switch to any non-running state based on the k-th data includes: Obtaining a data volume threshold; If the data volume of the k-th data is less than the data volume threshold, controlling the target program to switch to any non-running state; If the data volume of the k-th data is greater than or equal to the data volume threshold, controlling the target program to maintain the running state.
2. The method according to claim 1, characterized in that, The controlling the target program to switch to any non-running state includes: Obtaining the data transmission speed between the first device and the second device; Based on the k-th data and the data transmission speed, determining the duration of any non-running state; Based on the duration, controlling the target program to switch to any non-running state.
3. The method according to claim 1, characterized in that, The obtaining the k-th data based on the change state of incremental data associated with the running state in the first storage space of the first device during the k-th period includes: Obtaining a (k - 1)-th result of a (k - 1)-th data transmission operation; If the (k - 1)-th result indicates that at least part of the (k - 1)-th data fails to be transmitted, obtaining the data that fails to be transmitted in the (k - 1)-th data; Based on the change state of incremental data associated with the running state in the first storage space during the k-th period and the data that fails to be transmitted in the (k - 1)-th data, obtaining the k-th data.
4. The method according to claim 1, characterized in that, The obtaining the k-th data based on the change state of data increment associated with the running state in the first storage space of the first device during the k-th period includes: During the k-th period, monitoring the change state of data associated with the running state in the first storage space through inotify; If it is monitored that the data associated with the running state changes in the first storage space, counting the data increment associated with the running state in the first storage space to obtain the k-th data.
5. The method according to claim 1, characterized in that, The k-th data transmission operation includes a data transmission operation based on rsync; the transmitting the k-th data to the second device through the k-th data transmission operation includes: Encrypting the k-th data to obtain the encrypted k-th data; Transmitting the encrypted k-th data to the second device through rsync.
6. The method according to claim 1, characterized in that, Before obtaining the k-th data based on the change state of incremental data associated with the running state in the first storage space of the first device during the k-th period, it further includes: Obtain the full amount of data associated with the running state in the first storage space to obtain the first data; Transmit the first data to the second device through the first data transmission operation.
7. The method according to claim 1, characterized in that, The first storage space includes a storage space configured with a file system. After controlling the target program to switch to any of the non-running states, it further includes: Obtain the target data stored in the second storage space; wherein, the second storage space includes a storage space not configured with a file system; Encrypt the target data to obtain the encrypted target data; Transmit the encrypted target data to the second device.
8. A data transmission device, characterized in that, The device includes a processing module, a control module, and a transmission module, wherein: The processing module is used to, when the target program is in the running state, obtain the k-th data based on the change state of the incremental data associated with the running state in the first storage space of the first device during the k-th period; where k is an integer greater than or equal to 2; The control module is used to control the target program to maintain the running state or switch to any non-running state based on the k-th data; The transmission module is used to transmit the k-th data to the second device through the k-th data transmission operation; The control module is further used to, if the target program is in any of the non-running states, control the target program to switch to the running state; The processing module is used to obtain the data volume threshold; The control module is used to, if the data volume of the k-th data is less than the data volume threshold, control the target program to switch to any of the non-running states; if the data volume of the k-th data is greater than or equal to the data volume threshold, control the target program to maintain the running state.
9. A first device, characterized in that, The first device includes a processor and a memory; wherein, a computer program is stored in the memory; when the computer program is executed by the processor, it can implement the data transmission method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor of the electronic device, it can implement the data transmission method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Linux virtual machine migration method and system
CN106909442A