File synchronization method, device, equipment and storage medium
By obtaining subnet information and file information of hydraulic support equipment in the coal mine industry, and finding equipment that has been synchronized for cross-subnet file transmission, it solves the inefficiency problem of the centralized control center equipment synchronizing files to multiple hydraulic support equipment. , enabling faster file transfers and lower loads.
Patent Information
- Application Number
- CN202210605613.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-05-30
AI Technical Summary
In the coal mine industry, when the centralized control center equipment synchronizes files to multiple hydraulic support equipment, the cross-subnet transmission efficiency is low, resulting in a long time and a large load, which reduces the efficiency of file synchronization.
By obtaining the subnet information and file information of the device to be synchronized, find out whether there is a device that has completed synchronization. If it exists, send synchronization control instructions to the device to enable cross-subnet file transmission, reducing the number of direct cross-subnet transmissions , improve efficiency.
It improves the speed and efficiency of file synchronization, reduces the load of centralized control center equipment, simplifies the file transfer process, and avoids the complexity of NAT traversal.
Smart Images

Figure CN117201510B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data synchronization, and in particular to a file synchronization method, device, equipment and storage medium. Background Art
[0002] At present, in the field of coal mining industry, various equipment required for coal mining is managed through centralized control center equipment. Taking hydraulic support equipment as an example, hydraulic support equipment is a device that uses hydraulic power to achieve lifting, forward movement and other movements to support the roof. It is a key equipment for comprehensive mechanized mining in coal mines and is of great significance to modern coal mine production. During the use of hydraulic support equipment, the centralized control center equipment can synchronize files to multiple hydraulic support equipment. For example, when a software upgrade package for hydraulic support equipment is developed or the model of hydraulic support equipment needs to be configured, the centralized control center equipment needs to send software upgrade packages or model configuration files to multiple hydraulic support equipment to achieve the upgrade and configuration of multiple hydraulic support equipment. Of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. Among them, for multiple hydraulic support equipment of the same model, the files to be synchronized are the same.
[0003] In the prior art, the coal mine industry network includes multiple subnets. Usually, the centralized control center equipment and multiple hydraulic support equipment are in different subnets, for example, the centralized control center equipment is in subnet 1, and multiple hydraulic support equipment are in subnet 2. Therefore, when the centralized control center equipment synchronizes files to the hydraulic support equipment, it is necessary to transmit the files to be synchronized to multiple hydraulic support equipment across subnets. In the process of transmitting files to be synchronized across subnets, the transmitted data packets (files to be synchronized) need to pass through multiple routing nodes. Each time a routing node is passed, the routing node needs to process the transmitted data packets, such as addressing, data encapsulation and data decapsulation, etc. Therefore, it takes a long time and is inefficient to transmit files to be synchronized across subnets. In addition, when the centralized control center equipment needs to synchronize the same file to multiple hydraulic support equipment, the centralized control center equipment needs to send the files to be synchronized to each hydraulic support equipment separately, resulting in a large load on the centralized control center equipment, further increasing the time consumption of file synchronization and reducing the efficiency of file synchronization. Summary of the invention
[0004] In view of this, the present application provides a file synchronization method, apparatus, device and storage medium to help solve the problem of low file synchronization efficiency in the prior art.
[0005] In a first aspect, an embodiment of the present application provides a file synchronization method, which is applied to a first device, and the method includes:
[0006] Obtain the subnet information of the device to be synchronized and the file information to be synchronized;
[0007] Obtaining the record information of the synchronization file, and determining whether there is the subnet information of the second device and the file information that has been synchronized according to the subnet information of the device to be synchronized and the file information to be synchronized in the record information of the synchronization file; wherein the subnet information and the file information that have been synchronized of the second device are the same as the subnet information and the file information to be synchronized of the device to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized;
[0008] If so, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.
[0009] A possible implementation of the first aspect also includes:
[0010] Receiving a synchronization completion response message returned by the second device;
[0011] The record information of the synchronization file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0012] In a possible implementation manner of the first aspect, before obtaining the subnet information of the device to be synchronized and the file information to be synchronized, the method further includes:
[0013] Receiving a file synchronization request message sent by the device to be synchronized; the file synchronization request message carries subnet information and file information to be synchronized;
[0014] Sending a synchronization file response message to the device to be synchronized;
[0015] The obtaining of subnet information of the device to be synchronized and file information to be synchronized includes:
[0016] The subnet information of the device to be synchronized and the file information to be synchronized are obtained from the file synchronization request message.
[0017] Preferably, the file synchronization request message also carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized when performing file transfer.
[0018] A possible implementation manner of the first aspect, before sending the synchronization control instruction to the second device, further includes:
[0019] Sending a synchronization file notification message to the device to be synchronized;
[0020] A file synchronization response message sent by the device to be synchronized is received, wherein the file synchronization response message carries the file transmission port information of the device to be synchronized.
[0021] In a possible implementation manner of the first aspect, the synchronization control instruction carries file transfer port information of the device to be synchronized.
[0022] In a possible implementation manner of the first aspect, if any, sending the synchronization control instruction to the second device includes:
[0023] If there are, and the subnet information and synchronized file information of at least two second devices are the same as the subnet information and the file information to be synchronized of the device to be synchronized, then the load information of the at least two second devices is obtained;
[0024] A target second device is determined according to the load information of the at least two second devices, and a synchronization control instruction is sent to the target second device.
[0025] In a possible implementation of the first aspect, the devices to be synchronized include at least two;
[0026] The determining the target second device according to the load information of the at least two second devices comprises:
[0027] For each of the at least two devices to be synchronized, a target second device corresponding to each of the devices to be synchronized is determined according to the load information of the at least two second devices.
[0028] In a possible implementation manner of the first aspect, the first device and the device to be synchronized belong to different subnets.
[0029] A possible implementation of the first aspect also includes:
[0030] If it does not exist, obtaining the file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the device to be synchronized;
[0031] The record information of the synchronization file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0032] In a second aspect, an embodiment of the present application provides a file synchronization method, which is applied to a second device, and the method includes:
[0033] Receiving a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit the to-be-synchronized file to the to-be-synchronized device;
[0034] Determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction;
[0035] The file to be synchronized is acquired according to the file information to be synchronized, and the file to be synchronized is sent to the device to be synchronized.
[0036] A possible implementation of the second aspect also includes:
[0037] A synchronization completion response message is sent to the first device.
[0038] In a possible implementation of the second aspect, the synchronization control instruction carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized when performing file transfer;
[0039] The sending the to-be-synchronized file to the to-be-synchronized device comprises:
[0040] The file to be synchronized is sent to the device to be synchronized via the port indicated by the file transfer port information.
[0041] In a third aspect, an embodiment of the present application provides a file synchronization method, including:
[0042] Receive files to be synchronized;
[0043] According to the files to be synchronized, corresponding files are updated.
[0044] A possible implementation manner of the third aspect, before receiving the file to be synchronized, further includes:
[0045] Sending a file synchronization request message to the first device; the file synchronization request message carries subnet information and file information to be synchronized;
[0046] Receive a synchronization file response message sent by the first device.
[0047] In a possible implementation manner of the third aspect, the file synchronization request message further carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized for file transfer.
[0048] A possible implementation manner of the third aspect, before receiving the file to be synchronized, further includes:
[0049] Receiving a synchronization file notification message sent by the first device;
[0050] A file synchronization response message is sent to the first device, where the file synchronization response message carries the file transfer port information of the device to be synchronized.
[0051] In a possible implementation manner of the third aspect, receiving the file to be synchronized includes:
[0052] The file to be synchronized is received through the port indicated by the file transfer port information.
[0053] In a fourth aspect, an embodiment of the present application provides a file synchronization device, including:
[0054] An acquisition unit, used to acquire subnet information of the device to be synchronized and file information to be synchronized;
[0055] A processing unit, configured to obtain the record information of the synchronization file, and determine whether there is subnet information of the second device and the file information that has been synchronized according to the subnet information of the device to be synchronized and the file information to be synchronized in the record information of the synchronization file; wherein the subnet information and the file information that have been synchronized of the second device are the same as the subnet information and the file information to be synchronized of the device to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized;
[0056] The processing unit is further configured to, if present, send a synchronization control instruction to the second device; the synchronization control instruction is configured to instruct the second device to transmit the file to be synchronized to the device to be synchronized.
[0057] In a possible implementation of the fourth aspect, the file synchronization device further includes:
[0058] A receiving unit, configured to receive a synchronization completion response message returned by the second device;
[0059] The processing unit is further configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0060] In a possible implementation of the fourth aspect, the receiving unit is further configured to receive a synchronization file request message sent by the device to be synchronized; the synchronization file request message carries subnet information and file information to be synchronized;
[0061] The processing unit is further configured to send a synchronization file response message to the device to be synchronized;
[0062] The acquisition unit is specifically configured to acquire the subnet information of the device to be synchronized and the file information to be synchronized from the file synchronization request message.
[0063] In a possible implementation of the fourth aspect, the processing unit is further configured to send a synchronization file notification message to the device to be synchronized;
[0064] The receiving unit is further configured to receive a file synchronization response message sent by the device to be synchronized; the file synchronization response message carries the file transmission port information of the device to be synchronized.
[0065] In a possible implementation of the fourth aspect, the processing unit is specifically configured to obtain the load information of the at least two second devices if there are at least two second devices whose subnet information and synchronized file information are the same as the subnet information and the file information to be synchronized of the device to be synchronized;
[0066] A target second device is determined according to the load information of the at least two second devices, and a synchronization control instruction is sent to the target second device.
[0067] In a possible implementation manner of the fourth aspect, the processing unit is specifically configured to determine, for each of the at least two devices to be synchronized, a target second device corresponding to each device to be synchronized according to load information of the at least two second devices.
[0068] In a possible implementation of the fourth aspect, the processing unit is further configured to obtain the file to be synchronized according to the file information to be synchronized if the file does not exist, and send the file to be synchronized to the device to be synchronized;
[0069] The processing unit is further configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0070] In a fifth aspect, an embodiment of the present application provides a file synchronization device, including:
[0071] A receiving unit, configured to receive a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit a file to be synchronized to the device to be synchronized;
[0072] A processing unit, configured to determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction;
[0073] The processing unit is further configured to obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.
[0074] The processing unit is further configured to send a synchronization completion response message to the first device.
[0075] In a possible implementation manner of the fifth aspect, the processing unit is specifically configured to send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information.
[0076] In a sixth aspect, an embodiment of the present application provides a file synchronization device, including:
[0077] A receiving unit, used for receiving files to be synchronized;
[0078] The processing unit is used to update the corresponding file according to the file to be synchronized.
[0079] In a possible implementation of the sixth aspect, the processing unit is further configured to send a file synchronization request message to the first device; the file synchronization request message carries subnet information and file information to be synchronized;
[0080] The receiving unit is further configured to receive a synchronization file response message sent by the first device.
[0081] In a possible implementation manner of the sixth aspect, the receiving unit is further used to receive a synchronization file notification message sent by the first device;
[0082] The processing unit is further configured to send a file synchronization response message to the first device, wherein the file synchronization response message carries file transfer port information of the device to be synchronized.
[0083] In a possible implementation manner of the sixth aspect, the processing unit is specifically configured to receive the file to be synchronized through the port indicated by the file transfer port information.
[0084] In a seventh aspect, an embodiment of the present application provides an electronic device, including:
[0085] A processor and a memory, wherein the memory stores a computer program, and when the computer program is executed, the electronic device executes the method described in any one of the first aspect, any one of the second aspect, or any one of the third aspect.
[0086] In an eighth aspect, an embodiment of the present application provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method described in any one of the first aspect, any one of the second aspect, or any one of the third aspect.
[0087] By adopting the scheme provided by the embodiment of the present application, when the first device needs to synchronize files with the device to be synchronized, the first device obtains the subnet information of the device to be synchronized and the file information to be synchronized; obtains the record information of the synchronization file, and determines whether the subnet information of the second device and the file information that has been synchronized exist in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized; wherein the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized. If it exists, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. That is to say, the record information of the synchronization file records the subnet information of the device that has completed file synchronization and the file information that has been synchronized. When it is necessary to synchronize files with the device to be synchronized, the first device can obtain the subnet information of the device to be synchronized and the file information to be synchronized, and obtain the record information of the synchronization file. Then, according to the subnet information of the device to be synchronized and the file information to be synchronized, in the record information of the synchronization file, it is detected whether the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized. If they exist, it means that the second device and the device to be synchronized are in the same subnet, and the second device stores the files that need to be synchronized by the device to be synchronized. Therefore, the first device can send a synchronization control instruction to the second device so that the second device transmits the files to be synchronized to the device to be synchronized. In this way, when the first device needs to synchronize files with the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the files that need to be synchronized by the device to be synchronized, then the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared with the first device directly transmitting the files to be synchronized across subnets to the device to be synchronized, the speed of transmitting the files to be synchronized from the second device to the device to be synchronized is faster and more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0089] Figure 1 A schematic diagram of a file synchronization scenario provided in an embodiment of the present application;
[0090] Figure 2 A flowchart of another file synchronization method provided in an embodiment of the present application;
[0091] Figure 3 A flowchart of another file synchronization method provided in an embodiment of the present application;
[0092] Figure 4 A flowchart of another file synchronization method provided in an embodiment of the present application;
[0093] Figure 5 A flowchart of another file synchronization method provided in an embodiment of the present application;
[0094] Figure 6 A schematic diagram of another file synchronization scenario provided in an embodiment of the present application;
[0095] Figure 7 A flowchart of another file synchronization method provided in an embodiment of the present application;
[0096] Figure 8 A schematic diagram of the structure of a file synchronization device provided in an embodiment of the present application;
[0097] Fig. 9 A schematic diagram of the structure of another file synchronization device provided in an embodiment of the present application;
[0098] Fig.10 A schematic diagram of the structure of another file synchronization device provided in an embodiment of the present application;
[0099] Fig.11 A schematic diagram of the structure of another file synchronization device provided in an embodiment of the present application;
[0100] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0101] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0102] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0103] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0104] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0105] Before a detailed introduction to the embodiments of the present application, the terms that are applied or may be applied to the embodiments of the present application are first explained.
[0106] Peer-to-Peer (P2P): also known as peer-to-peer Internet technology, is a new network technology that relies on the computing power and bandwidth of participants in the network, rather than focusing all the reliance on a few servers. P2P network is a peer-to-peer network without a central server, relying on user group nodes to exchange information. Different from the traditional central server structure, each user node in the P2P network is both a client and a server, and can also serve as a server to provide services to other nodes. Any two devices in the P2P network can share data.
[0107] Network Address Translation (NAT): When some hosts in a private network have been assigned local IP (Internet Protocol) addresses (i.e., private addresses used only in this private network), but want to communicate with hosts on the Internet (without encryption), the NAT method can be used. This method requires the installation of NAT software on the router that connects the private network (private IP) to the Internet (public IP). A router with NAT software is called a NAT router, and it has at least one valid external global IP address (public IP address). In this way, all hosts using local addresses (private IP addresses) must convert their local addresses into global IP addresses on the NAT router when communicating with the outside world before they can connect to the Internet.
[0108] NAT traversal: NAT traversal involves a common problem in TCP / IP networks, namely the problem of establishing connections between hosts in a private TCP / IP network that uses a NAT device.
[0109] Router: It is a hardware device that connects two or more networks. It acts as a gateway between networks. It is a network device that reads the address in each data packet and then decides how to transmit it. It can understand different protocols, such as the Ethernet protocol used by a local area network and the TCP (Transmission Control Protocol) / IP protocol used by the Internet. In this way, the router can analyze the destination address of data packets from various types of networks, convert the address of non-TCP / IP network into TCP / IP address, or vice versa; and then transmit each data packet to the designated location according to the best route based on the selected routing algorithm. Therefore, the router can connect non-TCP / IP networks to the Internet.
[0110] Switch: A switch means "switch" and is a network device used to forward electrical (optical) signals. It can provide an exclusive electrical signal path for any two network nodes connected to the switch. The most common switch is the Ethernet switch.
[0111] In the related technology, in the field of coal mining industry, the equipment required for various coal mining is managed through the centralized control center equipment. Taking hydraulic support equipment as an example, hydraulic support equipment is a device that uses hydraulic power to achieve lifting, forward movement and other movements to support the roof. It is a key equipment for comprehensive mechanized mining of coal mines and is of great significance to modern coal mine production. During the use of hydraulic support equipment, the centralized control center equipment can synchronize files to multiple hydraulic support equipment. For example, when a software upgrade package for hydraulic support equipment is developed or the model configuration of hydraulic support equipment is required, the centralized control center equipment needs to send software upgrade packages or model configuration files to multiple hydraulic support equipment to achieve the upgrade and configuration of multiple hydraulic support equipment. Of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. For multiple hydraulic support equipment of the same model, the files to be synchronized are the same.
[0112] In the prior art, the coal mine industry network contains multiple subnets, such as Figure 1 As shown in the figure, usually the centralized control center equipment and multiple hydraulic support equipment are in different subnets, for example, the centralized control center equipment is in subnet 1, and multiple hydraulic support equipment are in subnet 2. Therefore, when the centralized control center equipment synchronizes files with the hydraulic support equipment, it needs to transmit the files to be synchronized to multiple hydraulic support equipment across subnets. In the process of transmitting files to be synchronized across subnets, the transmitted data packets (files to be synchronized) need to pass through multiple routing nodes. Each time a routing node is passed, the routing node needs to process the transmitted data packets, such as addressing, data encapsulation, and data decapsulation, etc. Figure 1As shown, when the centralized control center equipment synchronizes files to hydraulic support equipment 1, the data packet will reach the switch in subnet 1 from the centralized control center equipment, and then reach the router, and then the router will forward the data packet to the switch in subnet 2, and the switch in subnet 2 will transmit the data packet to hydraulic support equipment 1. Therefore, cross-subnet file synchronization takes a long time and is inefficient. In addition, when the centralized control center equipment needs to synchronize the same file to hydraulic support equipment 1, hydraulic support equipment 2...hydraulic support equipment n, the centralized control center equipment needs to send the files to be synchronized to each hydraulic support equipment separately, resulting in a large load on the centralized control center equipment, further increasing the time consumption of file synchronization and reducing the efficiency of file synchronization.
[0113] In some technologies, file synchronization is achieved through peer-to-peer (P2P) technology. P2P technology allows computers to directly share content and distribute data without going through a server, making it possible for any two machines on the Internet to share data. In the coal mining industry scenario, assuming that the equipment in the centralized control center and the equipment required for coal mining are all devices in the P2P network, P2P is usually used for communication between two devices across subnets. Since there is usually NAT isolation between devices across subnets, it is necessary to obtain the NAT type through NAT detection, and then implement NAT traversal based on the results of NAT detection to establish a connection path between devices for file transfer. However, the process of NAT traversal is complicated and time-consuming, resulting in low efficiency in establishing a connection path between devices, thereby making file transfer inefficient. In addition, NAT detection may fail, resulting in the inability to implement NAT traversal, which in turn results in the inability to establish a connection path between devices, making file transfer impossible. Moreover, in a P2P network, if two devices that need to transfer files are in the same subnet, then the P2P technology cannot achieve the Layer 2 transmission of the two devices in the same subnet, and the NAT gateway still needs to intervene, resulting in reduced transmission efficiency. Therefore, for the method of using P2P technology to achieve file synchronization, NAT traversal between devices will affect the efficiency of file synchronization, and even cause file transfer failure when NAT detection fails. In addition, for two devices in the same subnet, NAT traversal is also required, and they cannot communicate directly, thereby affecting the efficiency of file transfer between devices in the same subnet.
[0114] In view of the above problems, an embodiment of the present application provides a file synchronization method, which is applied to a first device, and the method includes: obtaining subnet information of a device to be synchronized and file information to be synchronized; obtaining record information of a synchronization file, and determining whether there is subnet information of a second device and file information that has been synchronized in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized; wherein the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized. If it exists, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. That is, the record information of the synchronization file records the subnet information of the device that has completed file synchronization and the file information that has been synchronized. When it is necessary to synchronize files to the device to be synchronized, the first device can obtain the subnet information of the device to be synchronized and the file information to be synchronized, and obtain the record information of the synchronization file. Then, according to the subnet information of the device to be synchronized and the file information to be synchronized, in the record information of the synchronization file, it is detected whether the subnet information and the file information of the second device that have been synchronized exist, and the subnet information and the file information of the second device that have been synchronized are the same as the subnet information and the file information to be synchronized of the device to be synchronized. If they exist, it means that the second device and the first device are in the same subnet, and the files that the device to be synchronized needs to be synchronized are stored in the second device, so the first device can send a synchronization control instruction to the second device, so that the second device transmits the files to be synchronized to the device to be synchronized.
[0115] In this way, when the first device needs to synchronize files with the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the files that the device to be synchronized needs to synchronize, then the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared with the first device directly transmitting the files to be synchronized across subnets to the device to be synchronized, the speed of transmitting the files to be synchronized from the second device to the device to be synchronized is faster and more efficient. The following is a detailed description.
[0116] See also Figure 2 , is a flowchart of a file synchronization method provided in an embodiment of the present application. The method is applied to a first device and includes the following steps:
[0117] Step S201: Obtain subnet information of the device to be synchronized and file information to be synchronized.
[0118] In an embodiment of the present application, the first device manages the devices in each subnet. For example, the first device manages the files configured in each device in each subnet, and is responsible for upgrading and updating the files configured in each device. When the technician develops update files such as software upgrade packages and device model configuration files, it is necessary to synchronize these update files to the corresponding devices so that the corresponding devices can update the files stored therein. However, the technician cannot directly synchronize the update files to the corresponding devices, and the first device that manages the devices in each subnet needs to synchronize them. In an embodiment of the present application, the files that need to be updated by the device can be called files to be synchronized, and the devices that need to perform file updates are called devices to be synchronized. When the first device obtains the update files of the devices to be synchronized, it can actively synchronize the update files to each device configured with the update files. It is also possible for each device configured with the update files to request the first device to synchronize the update files. That is, when the first device obtains the files to be synchronized, it can actively send the files to be synchronized to each device configured with the files to be synchronized. It is also possible for each device configured with the files to be synchronized to request the first device to synchronize the files to be synchronized.
[0119] When the first device determines that it needs to synchronize the file to be synchronized with the device to be synchronized, in order to improve the synchronization efficiency, the device to be synchronized can be synchronized by a device that is located in the same subnet as the device to be synchronized and has synchronized the file to be synchronized. Based on this, the first device needs to obtain the subnet information of the device to be synchronized and the file information to be synchronized. That is, it is necessary to first obtain which subnet the device to be synchronized is located in and which file the device to be synchronized needs to synchronize.
[0120] In some embodiments, when other devices are connected to the first device, the other devices need to report to the first device the files configured in the other devices, the identification information of the other devices, and the subnet information to which the other devices belong, and other device-related information, so that the first device can manage the other devices. At this time, the first device can store the device-related information reported by other devices. When the first device actively synchronizes the files to be synchronized to other devices, first, the first device can obtain the files to be synchronized from other devices or can receive the files to be synchronized sent by the technician. Based on the files to be synchronized, its file information can be determined, such as the file name, file size and other information of the files to be synchronized. Secondly, the first device can determine the devices to be synchronized corresponding to the files to be synchronized based on the configuration files in other devices recorded in the stored device-related information, and determine the subnet information of the devices to be synchronized based on the device-related information. That is, the first device obtains the subnet information of the devices to be synchronized and the file information of the files to be synchronized.
[0121] When other devices request the first device to synchronize files to be synchronized, the other devices may carry their subnet information and file information of the files to be synchronized in the request message, and the first device may obtain the subnet information and file information of the devices to be synchronized from the request message of the other devices.
[0122] Of course, the subnet information of the device to be synchronized and the file information to be synchronized can also be obtained in other ways, and this application does not limit this. For example, the first device can obtain the subnet information of the device to be synchronized through the third device based on the obtained file information to be synchronized. The third device can store the subnet information of each device, or the third device can obtain the subnet information from the device to be synchronized and return it to the first device.
[0123] Exemplarily, taking the example of the first device actively synchronizing a file to the device to be synchronized, it is assumed that the file to be synchronized is a configuration file of a hydraulic support device. When the first device obtains the file of the software configuration upgrade package of the hydraulic support device, for example, the first device can receive the file of the software configuration upgrade package of the hydraulic support device sent by other devices, and the first device can determine that the file to be synchronized is the configuration file of the hydraulic support device. At this time, the first device can determine from the stored device-related information that the device to be synchronized corresponding to the file to be synchronized (software upgrade package of the hydraulic support device) is hydraulic support device 1, and can also determine the subnet information of hydraulic support device 1, for example, the subnet information of hydraulic support device 1 can be that the subnet to which the hydraulic support device belongs is subnet 2. In this way, the first device can obtain the subnet information of the device to be synchronized and the file information to be synchronized.
[0124] As a possible implementation manner, the first device and the device to be synchronized belong to different subnets.
[0125] Specifically, a network can be divided into multiple subnets. The first device is a device that centrally manages other devices in each subnet. When the subnet to which the first device belongs is different from the subnet to which the device managed by the first device belongs, the first device needs to transmit the files to be synchronized across subnets to the devices to be synchronized, resulting in low file synchronization efficiency. For example, the subnet to which the first device belongs is subnet 1, the subnet to which device A belongs is subnet 2, and the subnet to which device B belongs is subnet 3. If the first device directly synchronizes files with device A or device B, cross-subnet file transmission is required, but the process of cross-subnet file transmission is more complicated and the transmission efficiency is low.
[0126] Step S202: Acquire the record information of the synchronization file, and determine whether the subnet information of the second device and the file information that has been synchronized exist in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0127] The subnet information and synchronized file information of the second device are the same as the subnet information and synchronized file information of the device to be synchronized. The synchronization file record information is used to record the subnet information and synchronized file information of the device that has completed file synchronization.
[0128] In an embodiment of the present application, each time the first device completes file synchronization, it will record the subnet information of the device that has completed synchronization and the file information that has completed synchronization into the record information of the synchronization file, that is, the record information of the synchronization file includes the subnet information of the device that has completed file synchronization and the file information that has completed synchronization. When the first device needs to synchronize files with the device to be synchronized, since the first device and the device to be synchronized belong to different subnets, if the first device directly sends the file to be synchronized to the device to be synchronized, it is necessary to perform cross-subnet file transmission. The cross-subnet transmission process is relatively complicated and inefficient. In an embodiment of the present application, the first device can find out the second device that is in the same subnet as the device to be synchronized and has completed the file synchronization with the same file to be synchronized, and the second device synchronizes the file to be synchronized for the device to be synchronized, so as to achieve file synchronization in the same subnet and improve the efficiency of file synchronization. Based on this, the first device can obtain the record information of the recorded synchronization file. Among them, the record information of the synchronization file includes the subnet information of the device that has completed file synchronization and the file information that has completed synchronization. That is, the first device can obtain the record information of the synchronization file that records the subnet information of the device that has completed file synchronization and the file information of the file that the device has completed synchronization. The first device determines whether the subnet information of the second device and the file information that has completed synchronization exist in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized. In other words, the first device can determine whether the subnet information of the second device is the same as the subnet information of the device to be synchronized, and the file information that has completed synchronization is the same as the file information of the file to be synchronized of the device to be synchronized, based on the subnet information of the device to be synchronized and the file information to be synchronized. Among them, the subnet information of the second device is the same as the subnet information of the device to be synchronized, which means that the second device and the device to be synchronized are in the same subnet.
[0129] Step S203: If yes, send a synchronization control instruction to the second device.
[0130] The synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.
[0131] In an embodiment of the present application, if the first device determines that there is subnet information of the second device and file information that has been synchronized in the record information of the synchronization file, it means that the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, that is, the second device and the first device are in the same subnet, and the second device has synchronized the file to be synchronized of the device to be synchronized. At this time, the first device can send a synchronization control instruction to the second device. For example, the synchronization control instruction can include the identification information of the device to be synchronized and the file information to be synchronized, so that when the second device receives the synchronization control instruction, it transmits the file to be synchronized to the device to be synchronized according to the synchronization control instruction. That is to say, when the first device needs to synchronize the file to be synchronized with the device to be synchronized, if the first device determines through the record information of the synchronization file that the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the file to be synchronized, then the first device can send a synchronization control instruction to the second device. Since the file to be synchronized is already stored in the second device, the second device can directly transmit the file to be synchronized to the device to be synchronized when it receives the synchronization control instruction. In this way, after the first device determines that the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the file to be synchronized, a synchronization control instruction is sent to the second device, so that the second device transmits the file to be synchronized to the device to be synchronized, thereby completing the file synchronization. Since the subnet information of the second device is the same as the subnet information of the device to be synchronized, that is, the second device and the device to be synchronized are in the same subnet, the devices in the same subnet can directly transfer files without going through multiple routes, and the transmission speed is faster. However, the first device and the device to be synchronized belong to different subnets, and the process of cross-subnet file transmission is more complicated. Therefore, the transmission of the file to be synchronized from the second device to the device to be synchronized can improve the efficiency of file synchronization.
[0132] Exemplarily, assume that in a coal mine industry scenario, the first device is a centralized control center device, and the subnet to which the first device belongs is subnet 1. At this time, the first device obtains the software upgrade package of the hydraulic support device, and the software upgrade package of the hydraulic support device is the file to be synchronized. Assume that the file information of the file to be synchronized is file B. Since the device-related information stored in the first device includes the identification information of each device, the subnet information of the device, the identification information of the file in the device, etc., for example, the file configured in hydraulic support device C is file B, and the subnet to which it belongs is subnet 2; the file configured in conveyor D is file E, and the subnet to which it belongs is subnet 3. Therefore, the first device can determine that the device to be synchronized corresponding to the file information to be synchronized is hydraulic support device C, and the subnet information of hydraulic support device C is subnet 2, based on the stored device-related information and the file information to be synchronized. In this way, the first device can obtain the subnet information of the device to be synchronized as subnet 2, and the file information to be synchronized is file B. Then, the first device can obtain the record information of the synchronization file. Assume that the record information of the synchronization file records: hydraulic support device F, belonging to subnet 2, and the file that has completed synchronization is file B; conveyor G, belonging to subnet 3, and the file that has completed synchronization is file E. According to the subnet information of the device to be synchronized and the file information to be synchronized, it is determined whether the subnet information and the file information that has completed synchronization of the second device exist in the record information of the synchronization file. Since the record information of the synchronization file records the hydraulic support device F, belonging to subnet 2, and the file that has completed synchronization is file B, then at this time, the first device can determine that the subnet information and the file information that have completed synchronization of the second device exist, and the second device is the hydraulic support device F. The first device sends a synchronization control instruction to the second device, so that the second device transmits the file to be synchronized to the device to be synchronized after receiving the synchronization control instruction.
[0133] As a possible implementation manner, if the above exists, sending the synchronization control instruction to the second device includes:
[0134] If so, and the subnet information and synchronized file information of at least two second devices are the same as the subnet information and the file information to be synchronized of the device to be synchronized, then the load information of at least two second devices is obtained;
[0135] A target second device is determined according to load information of at least two second devices, and a synchronization control instruction is sent to the target second device.
[0136] In the embodiment of the present application, since the record information of the synchronization file records the subnet information of the device on which the first device has completed the file and the file information that has been synchronized. Therefore, when the first device searches the record information of the synchronization query for the subnet information of the device to be synchronized and the file information to be synchronized to see whether there is the subnet information of the second device that is the same as the subnet information of the device to be synchronized and the file information to be synchronized, there may be at least two second devices whose subnet information and file information that have been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized. At this time, when there is the subnet information of the second device and the file information that has been synchronized, and there are at least two of them, that is, there are at least two second devices whose subnet information is the same as the subnet information of the device to be synchronized, and the file information of the synchronized file that has been completed by at least two second devices is the same as the file information of the file to be synchronized of the device to be synchronized, then the first device can obtain the load information of at least two second devices. At this time, the first device can send a request message to obtain its load information to the at least two second devices respectively, and the at least two second devices inform the first device of the load information of the at least two second devices respectively. The first device may also record the number of synchronization tasks assigned to each other device each time it controls other devices to synchronize files with the device to be synchronized, and obtain the load information of at least two second devices by obtaining the number of synchronization tasks assigned to each second device. After obtaining the load information of each second device, the first device may determine the target second device corresponding to the device to be synchronized according to the load information of each second device and the load balancing principle. That is, after obtaining the load information of each second device, the first device may determine the second device with a smaller number of loads recorded in the load information as the target second device corresponding to the device to be synchronized, so as to achieve load balancing for each second device and improve synchronization efficiency. After determining the target second device, the first device may send a synchronization control instruction to the target second device to control the target second device to synchronize the files to be synchronized for the device to be synchronized.
[0137] It should be understood that the load information of the second device may be information about the number of synchronization tasks that the second device needs to perform for other devices to synchronize files.
[0138] In a possible implementation, the devices to be synchronized include at least two. In this case, determining the target second device according to the load information of the at least two second devices includes:
[0139] For each of the at least two devices to be synchronized, a target second device corresponding to each device to be synchronized is determined according to load information of the at least two second devices.
[0140] In an embodiment of the present application, when the first device needs to synchronize files for at least two devices to be synchronized, and determines that at least two second devices can synchronize files for at least two devices to be synchronized, the first device can determine the target second device corresponding to each file to be synchronized. That is, for each of the at least two devices to be synchronized, the first device determines the target second device corresponding to each device to be synchronized based on the load information of the at least two second devices, so that the load of the at least two second devices can be balanced to synchronize files for at least two synchronization devices.
[0141] In this way, when the first device needs to synchronize files with the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the files that the device to be synchronized needs to synchronize, then the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the second device and the device to be synchronized belong to the same subnet, compared with the first device directly transmitting the files to be synchronized to the device to be synchronized across subnets, the speed of transmitting the files to be synchronized from the second device to the device to be synchronized is faster and more efficient.
[0142] As a possible implementation method, when the subnet information of the first device and the device to be synchronized is the same, the file synchronization between the first device and the device to be synchronized can also be achieved through the above method. Although when the subnet information of the first device and the device to be synchronized is the same, there will be no problem of low file synchronization efficiency caused by cross-subnet file transmission when the first device directly sends the file to be synchronized to the device to be synchronized, but when there are multiple devices to be synchronized, the first device sends the file to be synchronized to multiple devices to be synchronized, which will cause the operating load of the first device to increase sharply, resulting in slower file synchronization, and will also reduce the file synchronization efficiency to a certain extent. At this time, the above file synchronization method can reduce the operating load of the first device, thereby improving the efficiency of file synchronization.
[0143] Figure 3 A flowchart of another file synchronization method provided in an embodiment of the present application. The method is applied to a second device and specifically includes the following steps:
[0144] Step S301: Receive a synchronization control instruction.
[0145] The synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.
[0146] Specifically, when the first device determines that the subnet information and the synchronized file information of the second device are the same as the subnet information and the file information to be synchronized of the device to be synchronized, the first device will send a synchronization control instruction to the second device, and the synchronization control instruction may include the identification information of the device to be synchronized and the file information to be synchronized. The second device receives the synchronization control instruction and learns that the file to be synchronized needs to be transmitted to the device to be synchronized.
[0147] Step S302: Determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
[0148] In the embodiment of the present application, the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. The second device can obtain the file information to be synchronized and the device to be synchronized by parsing the synchronization control instruction.
[0149] Step S303: Obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.
[0150] In an embodiment of the present application, after the second device parses the synchronization control instruction and obtains the file information to be synchronized, it can search for its own files based on the file information to be synchronized, determine the file whose file information is the same as the file information to be synchronized, and use it as the file to be synchronized. After obtaining the file to be synchronized, the second device can send the file to be synchronized to the determined device to be synchronized.
[0151] It should be understood that the second device is a device that has completed the file identified by the file information of the file to be synchronized, and the subnet information of the second device is the same as the subnet information of the device to be synchronized, so the second device and the device to be synchronized are in the same subnet. Therefore, when the second device transmits the file to be synchronized to the device to be synchronized, the file synchronization is performed in the same subnet, and the file synchronization efficiency is high.
[0152] Figure 4 A flowchart of another file synchronization method provided in an embodiment of the present application. The method is applied to a device to be synchronized and specifically includes the following steps:
[0153] Step S401: Receive files to be synchronized.
[0154] Specifically, when the device to be synchronized needs to synchronize a file, the first device may send the file to be synchronized directly to the device to be synchronized, or a second device that is in the same subnet as the device to be synchronized and has synchronized the file to be synchronized may send the file to be synchronized to the device to be synchronized. At this time, the device to be synchronized can receive the file to be synchronized sent by the first device or the second device.
[0155] Step S402: Update the corresponding files according to the files to be synchronized.
[0156] Specifically, after receiving the file to be synchronized, the device to be synchronized may update the corresponding file in the device to be synchronized according to the file to be synchronized to complete the file synchronization.
[0157] In the embodiment of the present application, there are two modes: the first device actively sends the file to be synchronized to the device to be synchronized, and the device to be synchronized actively requests the first device to synchronize the file. In order to more clearly illustrate the information interaction between the first device, the second device and the device to be synchronized, in this embodiment, the first device actively sends the file to be synchronized to the device to be synchronized as an example. Figure 5 A flowchart of another file synchronization method provided in an embodiment of the present application. Specifically, the following steps are included:
[0158] Step S501: The first device obtains subnet information of the device to be synchronized and file information to be synchronized.
[0159] Please refer to step S201 for details, which will not be described again here.
[0160] As a possible implementation, since there may be at least two devices to be synchronized for file synchronization, the devices to be synchronized need to determine the subnet information of at least two devices to be synchronized and the file information of the files to be synchronized. When at least two devices to be synchronized are of the same type, their files to be synchronized are the same.
[0161] Taking the hydraulic support equipment in the coal mine industry scenario as an example, multiple hydraulic support equipment need to upgrade file 1. When the types of multiple hydraulic support equipment are the same, the multiple hydraulic support equipment need to upgrade the same file 1, that is, the same file 1 needs to be updated. Therefore, assuming that the first device obtains the software upgrade package file of file 1 of the hydraulic support equipment, the first device can determine that file 1 needs to be upgraded to multiple hydraulic support equipment. At this time, the first device can determine the hydraulic support equipment that needs to upgrade file 1 as the device to be synchronized, and determine the software upgrade package file of file 1 as the file to be synchronized. The first device can determine multiple devices to be synchronized at this time. By detecting the recorded device-related information, the subnet information of the devices to be synchronized can be determined respectively. Assume that the subnet information of multiple hydraulic support equipment is the same, and all belong to subnet 1. At this time, the first device can determine that the subnet information of multiple devices to be synchronized belongs to subnet 1, and assume that the file letter of the file to be synchronized is the file name of the file to be synchronized. At this time, the first device can determine that the file information of the files to be synchronized of multiple devices to be synchronized is file 1.
[0162] Step S502: The first device sends a synchronization file notification message to the device to be synchronized, and the device to be synchronized receives the synchronization file notification message.
[0163] Specifically, before performing file synchronization, the first device needs to inform the device to be synchronized of file 1. At this time, the first device sends a synchronization file notification message to the device to be synchronized to inform the device to be synchronized that it needs to synchronize its files. In a possible implementation, the synchronization file notification message carries file information of the files to be synchronized, so as to inform the device to be synchronized which files need to be synchronized. The device to be synchronized receives the synchronization file notification message sent by the first device, thereby knowing that the first device needs to synchronize its files, and through the file information of the files to be synchronized carried in the synchronization file notification message, it can know which files the first device needs to synchronize.
[0164] As a possible implementation manner, if there are at least two devices to be synchronized, the first device needs to send synchronization file notification messages to the at least two devices to be synchronized respectively.
[0165] Step S503: the device to be synchronized sends a synchronization file response message to the first device, and the first device receives the synchronization file response message sent by the device to be synchronized.
[0166] The file synchronization response message carries the file transfer port information of the device to be synchronized.
[0167] In an embodiment of the present application, after receiving the synchronization file notification message, the device to be synchronized learns that it needs to synchronize files. Since the device to be synchronized needs to transfer files through a specific port, the device to be synchronized adds the file transfer port information of the device to be synchronized to the synchronization file response message and sends the synchronization file response message to the first device. The first device receives the synchronization file response message sent by the device to be synchronized, and learns the file transfer port information used by the device to be synchronized when transferring files by parsing the synchronization file response message.
[0168] As a possible implementation method, when there are at least two devices to be synchronized, each device to be synchronized will return a synchronization file response message to the first device, the first device receives the synchronization file response messages sent by at least two devices to be synchronized, and obtains the file transfer port information of each device to be synchronized by respectively parsing the synchronization file response messages sent by at least two devices to be synchronized.
[0169] Step S504: The first device obtains the record information of the synchronization file, and determines whether the subnet information of the second device and the synchronized file information exist in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0170] Please refer to step S202 for details, which will not be described again here.
[0171] It should be noted that when the first device determines whether the subnet information of the second device and the file information that has been synchronized exist in the record information of the synchronization file, the following steps are different according to the result of the determination. When it is determined that the subnet information of the second device and the file information that has been synchronized exist, steps S505a to S507a, step S508, step S509a and step S510 are executed; when it is determined that the subnet information of the second device and the file information that has been synchronized do not exist, steps S505b, step S508 and step S510 are executed.
[0172] Step S505a: If so, the first device sends a synchronization control instruction to the second device, and the second device receives the synchronization control instruction.
[0173] The synchronization control instruction carries the file transfer port information of the device to be synchronized.
[0174] Specifically, if it is determined that there is subnet information and file information that has been synchronized of the second device, it means that the subnet information and file information that have been synchronized of the second device are the same as the subnet information and file information to be synchronized of the device to be synchronized, that is, the second device has synchronized the device to be synchronized, and the second device and the device to be synchronized belong to the same subnet. At this time, the second device can transmit the synchronization file to the device to be synchronized. After the first device receives the synchronization file response message sent by the device to be synchronized, the file transfer port information of the device to be synchronized can be obtained by parsing the synchronization file response message, and the file transfer port information of the device to be synchronized is added to the synchronization control instruction. The first device sends a synchronization control instruction to the second device, and the second device receives the synchronization control instruction. The second device can obtain the file transfer port information of the device to be synchronized by parsing the synchronization control instruction.
[0175] As a possible implementation method, if there are at least two second devices whose subnet information and synchronized file information are the same as the subnet information and file information to be synchronized of the device to be synchronized, then the load information of at least two second devices is obtained; based on the load information of at least two second devices, the target second device is determined, and a synchronization control instruction is sent to the target second device.
[0176] Specifically, since there may be at least two second devices that have the same subnet as the device to be synchronized and have completed synchronization of the files to be synchronized, the subnet information of at least two second devices and the file information that has been synchronized will be recorded in the record information of the synchronization file. Therefore, the first device will determine the subnet information and the file information that has been synchronized of at least two second devices in the record information of the synchronization file. When the subnet information and the file information that have been synchronized of at least two second devices are the same as the subnet information and the file information to be synchronized of the device to be synchronized, it is necessary to select a target second device from the at least two second devices for synchronizing the files to be synchronized with the device to be synchronized.
[0177] At this time, the first device can obtain the load information of at least two second devices, wherein the load information of the second device can be the number of file synchronization tasks that the second device needs to execute. For example, the first device can obtain the identification information of at least two second devices in the record information of the synchronization file, and send a load information acquisition request message to at least two second devices respectively according to the identification information of at least two second devices. After receiving the load information acquisition request message, each of the at least two second devices sends its own load information to the first device. It can also be that the devices in each subnet can periodically send their own load information to the first device actively. When the first device receives the device load information, it can record the identification information of each device and the load information corresponding to each device. The first device can determine the load information corresponding to each of the at least two second devices in the recorded device load information according to the identification information of at least two second devices. It can also be that the first device can record the load information of each device, and the initial value of the load information of each device is zero. Since the file synchronization tasks of the devices are all sent to them by the first device, the first device updates the load information of the device corresponding to the file synchronization task every time it sends a file synchronization task. The first device can obtain the load information corresponding to each of the at least two second devices in the recorded device load information. Of course, the load information corresponding to the second device may also be obtained in other ways, and this application does not limit this.
[0178] After the load information of at least two second devices is obtained, the target second device can be determined based on the load information of the at least two second devices. At this time, the first device can obtain the number of file synchronization tasks that each second device needs to perform based on the load information of the at least two second devices. In order to achieve load balancing between the at least two second devices, the second device with a smaller number of file synchronizations to be performed can be determined as the target second device, thereby achieving load balancing between the at least two second devices. When the load information of at least two second devices is the same, a second device can be randomly selected from the at least two second devices with the same load information as the target second device. After the target second device is determined, a synchronization control instruction is sent to the target second device.
[0179] As a possible implementation method, when there are at least two devices to be synchronized, the above-mentioned determining the target second device based on the load information of at least two second devices includes: for each of the at least two devices to be synchronized, determining the target second device corresponding to each device to be synchronized based on the load information of the at least two second devices.
[0180] In the embodiment of the present application, since there may be multiple devices of the same type in each subnet, for example, subnet 2 includes multiple hydraulic support devices, and multiple devices of the same type need to synchronize the same files, after the first device obtains the file to be synchronized, there will be multiple devices that need to synchronize the file to be synchronized. The first device will determine at least two devices to be synchronized based on the stored device-related information. And if the first device determines at least two second devices, for each of the at least two devices to be synchronized, the first device can determine the target second device corresponding to each device to be synchronized based on the load information of the at least two second devices and load balancing as the criterion. That is, if there are at least two devices to be synchronized and at least two second devices, for each of the at least two devices to be synchronized, the number of file synchronization tasks to be executed by each second device can be determined based on the load information of the at least two second devices, and the target second device corresponding to each device to be synchronized is determined based on the principle of achieving load balancing of at least two second devices. Among them, the load balancing of at least two second devices means that the number of file synchronization tasks to be executed by at least two second devices is relatively balanced.
[0181] For example, assuming that the subnet to which the first device belongs is subnet 1, and there are two devices to be synchronized: device 1 and device 2, the first device determines two second devices: device 3 and device 4 according to the subnet information of the devices to be synchronized and the file information to be synchronized, and the subnets to which devices 1, 2, 3 and 4 belong are all subnet 2. The load information of device 3 obtained by the first device includes that the number of file synchronization tasks to be executed is 2, and the load information of device 4 includes that the number of file synchronization tasks to be executed is 4. When determining the target second devices corresponding to the two devices to be synchronized: device 1 and device 2, in order to achieve load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) can be determined as device 3, and the target second device corresponding to the second device to be synchronized (device 2) can also be determined as device 3. In this way, the number of file synchronization tasks to be executed by device 3 and the number of file synchronization tasks to be executed by device 4 are both 4, so that load balancing between device 3 and device 4 can be achieved. Assuming that the load information of device 3 includes that the number of file synchronization tasks to be executed is 2, and the load information of device 4 includes that the number of file synchronization tasks to be executed is 3, in order to achieve load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) can be determined as device 3. At this time, the number of file synchronization tasks to be executed by device 3 and the number of file synchronization tasks to be executed by device 4 will both be 3. When determining the target second device corresponding to the second device to be synchronized (device 2), one of device 3 and device 4 can be randomly selected as the target second device of the second device to be synchronized.
[0182] Step S505b: If the file does not exist, the first device obtains the file to be synchronized according to the file information to be synchronized, and sends the file to be synchronized to the device to be synchronized, and the device to be synchronized receives the file to be synchronized.
[0183] Specifically, if the subnet information of the second device and the file information that has been synchronized do not exist in the record information of the synchronization file, it means that the first device has not synchronized the file to be synchronized with other devices with the same subnet information as the device to be synchronized, and the first device cannot synchronize the file to be synchronized with the device to be synchronized through a device in the same subnet as the device to be synchronized. At this time, the first device needs to synchronize the file to be synchronized directly with the device to be synchronized. The first device can obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.
[0184] For example, the first device may obtain and store multiple files to be synchronized from other devices or in other ways. The first device may determine the file to be synchronized from the multiple files to be synchronized according to the file information to be synchronized.
[0185] As a possible implementation method, since the synchronization file response message returned by the device to be synchronized to the first device carries the file transfer port information of the device to be synchronized, when it is determined that the subnet information of the second device and the file information that has been synchronized do not exist in the record information of the synchronization file, the first device can send the file to be synchronized to the device to be synchronized through the file transfer port indicated by the acquired file transfer port information of the device to be synchronized, and the device to be synchronized receives the file to be synchronized through the file transfer port.
[0186] Step S506a: The second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
[0187] Please refer to step S302 for details, which will not be described again here.
[0188] Step S507a: The second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transfer port information.
[0189] Specifically, the synchronization control instruction sent by the first device to the second device will carry the file transfer port information of the device to be synchronized. The second device can obtain the port used by the device to be synchronized for file transfer carried in the synchronization control instruction by parsing the synchronization control instruction. When the second device sends the file to be synchronized to the device to be synchronized, it can send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file to be synchronized sent by the second device through the port indicated by the file transfer port information.
[0190] Assume that Figure 6 As shown, the subnet to which the first device belongs is subnet 1, and the first device obtains a file to be synchronized, for example, the file to be synchronized is file 1. According to the file information to be synchronized (file 1), it is determined in the device-related information stored therein that two devices to be synchronized (device 1 and device 2) are configured with file 1, wherein the subnet information of device 1 and device 2 are both subnet 2. In other words, the first device can determine that both devices to be synchronized need to synchronize the file to be synchronized. The first device sends a synchronization file notification message to the two devices to be synchronized (device 1 and device 2) respectively to inform device 1 and device 2 that the file to be synchronized needs to be transmitted thereto. Then device 1 returns a synchronization file response message to the first device, and the synchronization file response message returned by device 1 carries the file transfer port information of device 1. At the same time, device 2 returns a synchronization file response message to the first device, and the synchronization file response message returned by device 2 carries the file transfer port information of device 2. By parsing the synchronization file response messages received and returned by the two devices to be synchronized, the first device can learn the ports used by the two devices to be synchronized for file transfer.
[0191] Then, the first device determines that there are two second devices (device 3 and device 4) in the record information of the synchronization file according to the subnet information (subnet 2) of the device to be synchronized and the file information (file 1) to be synchronized. That is, both device 3 and device 4 have completed the synchronization of file 1, and the subnets they belong to are both subnet 2, which is the same as the subnet to which the device to be synchronized belongs. Since there are two second devices, the first device can send request messages to device 3 and device 4 to obtain their load information respectively, and receive the load information returned by device 3 and device 4. Assume that the load information of device 3 includes the number of file synchronization tasks to be executed as 3, and the load information of device 4 includes the number of file synchronization tasks to be executed as 3. Therefore, in order to achieve load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) can be determined as device 3, and the target second device corresponding to the second device to be synchronized (device 2) can be determined as device 4. In this way, the number of file synchronization tasks to be executed by device 3 and the number of file synchronization tasks to be executed by device 4 are both 4, so that load balancing between device 3 and device 4 can be achieved. Then, the first device sends a synchronization control instruction to device 3, wherein the synchronization control instruction includes that the device to be synchronized is device 1, the file transfer port information of device 1, and the file information to be synchronized is file 1; at the same time, the first device sends a synchronization control instruction to device 4, wherein the synchronization control instruction includes that the device to be synchronized is device 2, the file transfer port information of device 2, and the file information to be synchronized is file 1. After receiving the synchronization control instruction, device 3 obtains the stored file to be synchronized according to the file information to be synchronized carried in the synchronization control instruction, and transmits the file to be synchronized to the device to be synchronized (device 1) through the file transfer port of device 1 carried in the synchronization control instruction, and device 1 receives the file to be synchronized through the port indicated by the file transfer port information. Similarly, after receiving the synchronization control instruction, device 4 obtains the stored file to be synchronized according to the file information to be synchronized carried in the synchronization control instruction, and transmits the file to be synchronized to the device to be synchronized (device 2) through the file transfer port of device 2 carried in the synchronization control instruction, and device 2 receives the file to be synchronized through the port indicated by the file transfer port information.
[0192] Step S508: The device to be synchronized updates the corresponding file according to the file to be synchronized.
[0193] Please refer to step S402 for details, which will not be described again here.
[0194] Step S509a: The second device sends a synchronization completion response message to the first device, and the first device receives the synchronization completion response message returned by the second device.
[0195] Specifically, after the second device has completed transmitting the file to be synchronized to the device to be synchronized, it can return a synchronization completion response message to the first device to inform the first device to complete synchronization of the file to be synchronized with the device to be synchronized. The first device receives the synchronization completion response message and can learn from the synchronization completion response message that the second device has completed transmitting the file to be synchronized to the device to be synchronized and file synchronization is completed.
[0196] Step S510: The first device updates the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0197] In an embodiment of the present application, the first device records the subnet information of the device and the file information that has been synchronized each time the file synchronization is completed, that is, the record information of the synchronized file can be updated each time the subnet information of the device and the file information that has been synchronized are completed. After receiving the synchronization completion response message returned by the second device, the first device determines that the file synchronization has been completed. At this time, according to the subnet information of the device to be synchronized and the file information to be synchronized, the record information of the synchronized file is updated. For example, the identification information of the device to be synchronized, the subnet information of the device to be synchronized, and the file information to be synchronized can be added to the record information of the synchronized file.
[0198] In the embodiment of the present application, the example is taken as follows: the device to be synchronized actively requests the first device to perform file synchronization. Figure 7 FIG. 1 is a flowchart of another file synchronization method provided by an embodiment of the present application. Specifically, the following steps are included:
[0199] Step S701: The device to be synchronized sends a synchronization file request message to the first device, and the first device receives the synchronization file request message.
[0200] The file synchronization request message carries subnet information and file information to be synchronized.
[0201] In an embodiment of the present application, the device to be synchronized may actively request a synchronization file from the first device. At this time, the device to be synchronized may send a synchronization file request message to the first device, and the first device receives the synchronization file request message sent by the device to be synchronized.
[0202] As a possible implementation manner, the file synchronization request message also carries the file transfer port information of the device to be synchronized.
[0203] The file transfer port information is used to indicate the port used by the device to be synchronized for file transfer.
[0204] In some embodiments, since the device to be synchronized needs to transfer files through a specified port, the device to be synchronized can add the file transfer port information to the synchronization file request message and send a synchronization file request message to the first device to inform the first device of the file transfer port of the device to be synchronized.
[0205] Step S702: The first device sends a synchronization file response message to the device to be synchronized, and the device to be synchronized receives the synchronization file response message.
[0206] In an embodiment of the present application, after receiving the synchronization file response message sent by the device to be synchronized, if the first device can perform file synchronization for the device to be synchronized, it can send a synchronization file response message to the device to be synchronized. The device to be synchronized receives the synchronization file response message, thereby knowing that the first device agrees to perform file synchronization for it.
[0207] Step S703: The first device obtains the subnet information of the device to be synchronized and the file information to be synchronized from the file synchronization request message.
[0208] In an embodiment of the present application, the file synchronization request message carries subnet information and file information to be synchronized. By parsing the file synchronization request message, the first device can obtain the subnet information of the device to be synchronized and the file information to be synchronized carried in the file synchronization request message.
[0209] As a possible implementation method, when the synchronization file request message sent by the device to be synchronized also carries the file transfer port information of the device to be synchronized, the first device can obtain the port used by the device to be synchronized for file transfer by parsing the synchronization file request message sent by the device to be synchronized.
[0210] Step S704: The first device obtains the record information of the synchronization file, and determines whether the subnet information of the second device and the synchronized file information exist in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0211] For details, please refer to step S202, which will not be repeated here. When it is determined that the subnet information of the second device and the file information that has been synchronized exist, execute steps S705a to S707a, step S708, step S709a and step S710; when it is determined that the subnet information of the second device and the file information that has been synchronized do not exist, execute steps S705b, step S708 and step S710.
[0212] Step S705a: If yes, send a synchronization control instruction to the second device, and the second device receives the synchronization control instruction.
[0213] For details, please refer to step S505a, which will not be described again here.
[0214] It should be noted that when the device to be synchronized actively requests the first device to synchronize files, there may be at least two second devices. When there are at least two second devices, the specific execution steps may refer to step S505a.
[0215] Step S705b: If the file does not exist, the first device obtains the file to be synchronized according to the file information to be synchronized, and sends the file to be synchronized to the device to be synchronized, and the device to be synchronized receives the file to be synchronized.
[0216] For details, please refer to step S505b, which will not be described again here.
[0217] Step S706a: The second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
[0218] Please refer to step S302 for details, which will not be described again here.
[0219] Step S707a: The second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transfer port information.
[0220] For details, please refer to step S507a, which will not be described in detail here.
[0221] Step S708: The device to be synchronized updates the corresponding file according to the file to be synchronized.
[0222] Please refer to step S402 for details, which will not be described again here.
[0223] Step S709a: The second device sends a synchronization completion response message to the first device, and the first device receives the synchronization completion response message returned by the second device.
[0224] Please refer to step S509a for details, which will not be described again here.
[0225] Step S710: The first device updates the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0226] For details, please refer to step S510, which will not be described again here.
[0227] In this way, according to the above Figure 5 or Figure 7According to the method described, when the first device needs to synchronize files with the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the files that the device to be synchronized needs to synchronize, then the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared with the first device directly transmitting the files to be synchronized across subnets to the device to be synchronized, the speed of transmitting the files to be synchronized from the second device to the device to be synchronized is faster and more efficient. Moreover, compared with the P2P technology, the method described in the above embodiment does not require NAT detection and NAT traversal, which can reduce the complexity of file synchronization. At the same time, for the second device and the device to be synchronized in the same subnet, the second device can directly send the files to be synchronized to the device to be synchronized, and file transfer between devices in the same subnet can be achieved without NAT traversal.
[0228] Figure 8 A schematic diagram of the structure of a file synchronization device provided in an embodiment of the present application. Figure 8 As shown, the device comprises:
[0229] The acquisition unit 801 is used to acquire the subnet information of the device to be synchronized and the file information to be synchronized.
[0230] The processing unit 802 is used to obtain the record information of the synchronization file, and determine whether the subnet information of the second device and the synchronized file information exist in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0231] The subnet information and synchronized file information of the second device are the same as those of the device to be synchronized, and the record information of the synchronization file is used to record the subnet information and synchronized file information of the device that has completed file synchronization.
[0232] The processing unit 802 is further configured to send a synchronization control instruction to the second device if the synchronization control instruction exists. The synchronization control instruction is used to instruct the second device to transmit the to-be-synchronized file to the to-be-synchronized device.
[0233] As a possible implementation, Fig. 9 As shown, the file synchronization device also includes:
[0234] The receiving unit 803 is configured to receive a synchronization completion response message returned by the second device.
[0235] The processing unit 802 is further configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0236] As a possible implementation, the receiving unit 803 is further configured to receive a file synchronization request message sent by the device to be synchronized; the file synchronization request message carries subnet information and file information to be synchronized;
[0237] The processing unit 802 is further configured to send a synchronization file response message to the device to be synchronized.
[0238] The acquisition unit 801 is specifically configured to acquire the subnet information of the device to be synchronized and the file information to be synchronized from the file synchronization request message.
[0239] As a possible implementation, the processing unit 802 is further configured to send a synchronization file notification message to the device to be synchronized;
[0240] The receiving unit 803 is further configured to receive a file synchronization response message sent by the device to be synchronized; the file synchronization response message carries the file transmission port information of the device to be synchronized.
[0241] As a possible implementation method, the processing unit 802 is specifically used to obtain the load information of at least two second devices if there are at least two second devices whose subnet information and synchronized file information are the same as the subnet information and file information to be synchronized of the device to be synchronized.
[0242] A target second device is determined according to the load information of the at least two second devices, and a synchronization control instruction is sent to the target second device.
[0243] As a possible implementation manner, the processing unit 802 is specifically configured to determine, for each of the at least two devices to be synchronized, a target second device corresponding to each device to be synchronized according to load information of at least two second devices.
[0244] As a possible implementation manner, the processing unit 802 is further configured to obtain the file to be synchronized according to the file information to be synchronized if the file does not exist, and send the file to be synchronized to the device to be synchronized.
[0245] The processing unit 802 is further configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.
[0246] Fig.10 This is a schematic diagram of the structure of another file synchronization device provided in an embodiment of the present application. Fig.10 As shown, the device comprises:
[0247] The receiving unit 1001 is configured to receive a synchronization control instruction. The synchronization control instruction is used to instruct the second device to transmit a file to be synchronized to the device to be synchronized.
[0248] The processing unit 1002 is used to determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
[0249] The processing unit 1002 is further configured to obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.
[0250] The processing unit 1002 is further configured to send a synchronization completion response message to the first device.
[0251] As a possible implementation manner, the processing unit 1002 is specifically configured to send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information.
[0252] Fig.11 This is a schematic diagram of the structure of another file synchronization device provided in an embodiment of the present application. Fig.11 As shown, the device comprises:
[0253] The receiving unit 1101 is used to receive files to be synchronized.
[0254] The processing unit 1102 is used to update the corresponding file according to the file to be synchronized.
[0255] As a possible implementation, the processing unit 1102 is further configured to send a file synchronization request message to the first device. The file synchronization request message carries subnet information and file information to be synchronized.
[0256] The receiving unit 1101 is further configured to receive a synchronization file response message sent by the first device.
[0257] As a possible implementation manner, the receiving unit 1101 is further configured to receive a synchronization file notification message sent by the first device.
[0258] The processing unit 1102 is further configured to send a file synchronization response message to the first device, where the file synchronization response message carries file transmission port information of the device to be synchronized.
[0259] As a possible implementation manner, the processing unit 1102 is specifically configured to receive the file to be synchronized through the port indicated by the file transfer port information.
[0260] Corresponding to the above embodiments, the present application also provides an electronic device. Fig.12A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, the electronic device 1200 may include: a processor 1201, a memory 1202 and a communication unit 1703. These components communicate through one or more buses, and those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the embodiment of the present invention, it can be a bus structure or a star structure, and can also include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0261] The communication unit 1203 is used to establish a communication channel so that the electronic device can communicate with other devices, receive user data sent by other devices or send user data to other devices.
[0262] The processor 1201 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory 1202, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 1201 can include only a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0263] The memory 1202 is used to store the execution instructions of the processor 1201. The memory 1202 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0264] When the execution instructions in the memory 1202 are executed by the processor 1201, the electronic device 1200 can execute Figure 2 or Figure 3 or Figure 4 Some or all of the steps in the illustrated embodiments.
[0265] In a specific implementation, the present invention further provides a storage medium, wherein the storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment of the file synchronization method provided by the present invention. The storage medium may be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0266] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.
[0267] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
Claims
1. A file synchronization method, It is characterized in that Applied to a first device, the method includes: Obtain the subnet information of the device to be synchronized and the file information to be synchronized; Obtaining the record information of the synchronization file, and determining whether there is the subnet information of the second device and the file information that has been synchronized in the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized; wherein the subnet information and the file information that have been synchronized of the second device are the same as the subnet information and the file information to be synchronized of the device to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized; If so, sending a synchronization control instruction to the second device; the synchronization control instruction is used to instruct the second device to transmit the to-be-synchronized file to the to-be-synchronized device; wherein, if so, sending a synchronization control instruction to the second device includes: If there are, and the subnet information and synchronized file information of at least two second devices are the same as the subnet information and the file information to be synchronized of the device to be synchronized, then the load information of the at least two second devices is obtained; A target second device is determined according to the load information of the at least two second devices, and a synchronization control instruction is sent to the target second device.
2. The method according to claim 1, It is characterized in that Also includes: Receiving a synchronization completion response message returned by the second device; The record information of the synchronization file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.
3. The method according to claim 1, It is characterized in that Before obtaining the subnet information of the device to be synchronized and the file information to be synchronized, the method further includes: Receiving a file synchronization request message sent by the device to be synchronized; the file synchronization request message carries subnet information and file information to be synchronized; Sending a synchronization file response message to the device to be synchronized; The obtaining of subnet information of the device to be synchronized and file information to be synchronized includes: The subnet information of the device to be synchronized and the file information to be synchronized are obtained from the file synchronization request message.
4. The method according to claim 3, It is characterized in that The file synchronization request message also carries the file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized when performing file transfer.
5. The method according to claim 1, It is characterized in that Before sending the synchronization control instruction to the second device, the method further includes: Sending a synchronization file notification message to the device to be synchronized; A file synchronization response message sent by the device to be synchronized is received; the file synchronization response message carries the file transmission port information of the device to be synchronized.
6. The method according to claim 3 or 4, It is characterized in that The synchronization control instruction carries the file transfer port information of the device to be synchronized.
7. The method according to claim 1, It is characterized in that The devices to be synchronized include at least two; The determining the target second device according to the load information of the at least two second devices comprises: For each of the at least two devices to be synchronized, a target second device corresponding to each of the devices to be synchronized is determined according to the load information of the at least two second devices.
8. The method according to claim 1, It is characterized in that The first device and the device to be synchronized belong to different subnets.
9. The method according to claim 1, It is characterized in that Also includes: If it does not exist, obtaining the file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the device to be synchronized; The record information of the synchronization file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.
10. A file synchronization method, It is characterized in that Applied to the second device, the method includes: Receiving a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit the to-be-synchronized file to the to-be-synchronized device; Determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction; The file to be synchronized is obtained according to the file information to be synchronized, and the file to be synchronized is sent to the device to be synchronized; wherein the second device is a device that is determined by the first device based on load information to transmit the file to be synchronized to the device to be synchronized, among the devices whose subnet information and file information that has been synchronized are the same as the subnet information and file information to be synchronized of the device to be synchronized.
11. The method according to claim 10, It is characterized in that Also includes: A synchronization completion response message is sent to the first device.
12. The method according to claim 10, It is characterized in that The synchronization control instruction carries the file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized when performing file transfer; The sending the to-be-synchronized file to the to-be-synchronized device comprises: The file to be synchronized is sent to the device to be synchronized via the port indicated by the file transfer port information.
13. A file synchronization device, It is characterized in that include: An acquisition unit, used to acquire subnet information of the device to be synchronized and file information to be synchronized; A processing unit, configured to obtain the record information of the synchronization file, and determine whether there is subnet information of the second device and the file information that has been synchronized according to the subnet information of the device to be synchronized and the file information to be synchronized in the record information of the synchronization file; wherein the subnet information and the file information that have been synchronized of the second device are the same as the subnet information and the file information to be synchronized of the device to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization and the file information that has been synchronized; The processing unit is further configured to, if present, send a synchronization control instruction to the second device; the synchronization control instruction is configured to instruct the second device to transmit the file to be synchronized to the device to be synchronized; The processing unit is specifically used to obtain the load information of the at least two second devices if there are at least two second devices whose subnet information and synchronized file information are the same as the subnet information and the file information to be synchronized of the device to be synchronized; A target second device is determined according to the load information of the at least two second devices, and a synchronization control instruction is sent to the target second device.
14. A file synchronization device, It is characterized in that include: A receiving unit, configured to receive a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit a file to be synchronized to the device to be synchronized; A processing unit, configured to determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction; The processing unit is also used to obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized; wherein the second device is a device that the first device determines based on load information to transmit the file to be synchronized to the device to be synchronized, among the devices whose subnet information and file information that has been synchronized are the same as the subnet information and file information to be synchronized of the device to be synchronized.
15. An electronic device, It is characterized in that include: A processor and a memory, wherein the memory stores a computer program, and when the computer program is executed, the electronic device executes the method according to any one of claims 1 to 9 or any one of claims 10 to 12.
16. A storage medium, It is characterized in that The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 9 or any one of claims 10 to 12.
