CN117201510A - File synchronization method, device, equipment and storage medium - Google Patents

File synchronization method, device, equipment and storage medium Download PDF

Info

Publication number
CN117201510A
CN117201510A CN202210605613.2A CN202210605613A CN117201510A CN 117201510 A CN117201510 A CN 117201510A CN 202210605613 A CN202210605613 A CN 202210605613A CN 117201510 A CN117201510 A CN 117201510A
Authority
CN
China
Prior art keywords
synchronized
file
information
equipment
synchronization
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210605613.2A
Other languages
Chinese (zh)
Inventor
罗杰
石帅
郑文文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202210605613.2A priority Critical patent/CN117201510A/en
Priority to PCT/CN2023/095772 priority patent/WO2023231836A1/en
Publication of CN117201510A publication Critical patent/CN117201510A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a file synchronization method, a device, equipment and a storage medium, wherein the method is applied to first equipment and comprises the following steps: acquiring subnet information of equipment to be synchronized and file information to be synchronized; and acquiring the record information of the synchronous file, and determining whether the subnet information of the second equipment and the file information which is synchronized exist according to the subnet information of the equipment to be synchronized and the record information of the file information to be synchronized in the synchronous file. The subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the record information of the synchronous file is used for recording the subnet information of the equipment which has completed the file synchronization and the file information which has completed the synchronization. If yes, sending a synchronous control instruction to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized. In this way, the efficiency of file synchronization can be improved.

Description

File synchronization method, device, equipment and storage medium
Technical Field
The present application relates to the field of data synchronization technologies, and in particular, to a method, an apparatus, a device, and a storage medium for file synchronization.
Background
Currently, in the field of coal industry, various devices required for coal mining are managed by a centralized control center device. Taking hydraulic support equipment as an example, the hydraulic support equipment is equipment for realizing movements such as lifting, forward moving and the like by taking hydraulic pressure as power and carrying out roof support, is key equipment for comprehensive mechanical mining of coal mines, and has great significance for modern coal mine production. In the use process of the hydraulic support equipment, the centralized control center equipment can synchronize files to the plurality of hydraulic support equipment, for example, when a software upgrade package of the hydraulic support equipment is developed or model configuration is needed to be carried out on the hydraulic support equipment, the centralized control center equipment needs to send the software upgrade package or the model configuration file to the plurality of hydraulic support equipment so as to realize upgrade and configuration of the plurality of hydraulic support equipment, and of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. For a plurality of hydraulic support devices with the same model, files to be synchronized are the same.
In the prior art, the coal mine industrial network comprises a plurality of subnets, and in general, the centralized control center equipment and the plurality of hydraulic support equipment are located in different subnets, for example, the centralized control center equipment is located in a subnet 1, and the plurality of hydraulic support equipment is located in a subnet 2. Therefore, when the centralized control center equipment synchronizes files to the hydraulic support equipment, the files to be synchronized need to be transmitted to the plurality of hydraulic support equipment in a cross-subnet mode. In the process of transmitting the files to be synchronized across the sub-network, the transmitted data packets (the files to be synchronized) need to pass through a plurality of routing nodes, and each time a routing node passes through, the routing node needs to process the transmitted data packets, such as addressing, data encapsulation, data decapsulation and the like, so that the time consumed for transmitting the files to be synchronized across the sub-network is longer and the efficiency is lower. And when the centralized control center equipment needs to synchronize the same file to a plurality of hydraulic support equipment, the centralized control center equipment needs to send the file to be synchronized to each hydraulic support equipment respectively, so that the load of the centralized control center equipment is larger, the time consumption of file synchronization is further increased, and the efficiency of file synchronization is reduced.
Disclosure of Invention
In view of the above, the present application provides a method, apparatus, device and storage medium for file synchronization, so as to solve the problem of low file synchronization efficiency in the prior art.
In a first aspect, an embodiment of the present application provides a file synchronization method, applied to a first device, where the method includes:
acquiring subnet information of equipment to be synchronized and file information to be synchronized;
acquiring record information of a synchronous file, and determining whether subnet information of a second device and file information which is synchronized exist according to the subnet information of the device to be synchronized and the record information of the file information to be synchronized in the synchronous file; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
if yes, a synchronous control instruction is sent to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
A possible implementation manner of the first aspect further includes:
Receiving a synchronization completion response message returned by the second equipment;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
In a possible implementation manner of the first aspect, before the acquiring the subnet information of the device to be synchronized and the file information to be synchronized, the method further includes:
receiving a synchronous file request message sent by the equipment to be synchronized; the synchronous file request message carries subnet information and file information to be synchronized;
sending a synchronous file response message to the equipment to be synchronized;
the acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized comprises the following steps:
and acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized from the synchronous file request message.
Preferably, the synchronous file request message also carries file transmission port information of the equipment to be synchronized; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
A possible implementation manner of the first aspect, before the sending a synchronization control instruction to the second device, further includes:
sending a synchronous file notification message to the equipment to be synchronized;
And receiving a synchronous file response message sent by the equipment to be synchronized, wherein the synchronous file response message carries the file transmission port information of the equipment to be synchronized.
In one possible implementation manner of the first aspect, the synchronization control instruction carries file transfer port information of the device to be synchronized.
In one possible implementation manner of the first aspect, if the synchronization control instruction exists, sending the synchronization control instruction to the second device includes:
if the information exists, and the subnet information and the file information which are synchronized are the same as the subnet information and the file information to be synchronized of the equipment to be synchronized, the load information of the at least two second equipment is obtained;
and determining a target second device according to the load information of the at least two second devices, and sending a synchronous control instruction to the target second device.
A possible implementation manner of the first aspect, the device to be synchronized includes at least two devices;
the determining the target second device according to the load information of the at least two second devices comprises:
and determining a target second device corresponding to each device to be synchronized according to the load information of the at least two second devices aiming at each device to be synchronized in the at least two devices to be synchronized.
In one possible implementation manner of the first aspect, the first device is different from a subnet to which the device to be synchronized belongs.
A possible implementation manner of the first aspect further includes:
if the file information to be synchronized does not exist, acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
In a second aspect, an embodiment of the present application provides a file synchronization method, applied to a second device, where the method includes:
receiving a synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
and acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized.
A possible implementation manner of the second aspect further includes:
and sending a synchronization completion response message to the first device.
In a possible implementation manner of the second aspect, the synchronization control instruction carries file transmission port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the equipment to be synchronized performs file transmission;
The sending the file to be synchronized to the device to be synchronized includes:
and sending the file to be synchronized to the equipment to be synchronized through the port indicated by the file transmission port information.
In a third aspect, an embodiment of the present application provides a file synchronization method, including:
receiving a file to be synchronized;
and updating the corresponding file according to the file to be synchronized.
A possible implementation manner of the third aspect, before the receiving a file to be synchronized, further includes:
sending a synchronous file request message to a first device; the synchronous file request message carries subnet information and file information to be synchronized;
and receiving a synchronous file response message sent by the first equipment.
In a possible implementation manner of the third aspect, the file transmission port information of the device to be synchronized is further carried in the synchronization file request message; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
A possible implementation manner of the third aspect, before the receiving a file to be synchronized, further includes:
receiving a synchronous file notification message sent by the first equipment;
and sending a synchronous file response message to the first device, wherein the synchronous file response message carries the file transmission port information of the device to be synchronized.
In a possible implementation manner of the third aspect, the receiving a file to be synchronized includes:
and receiving the file to be synchronized through the port indicated by the file transmission port information.
In a fourth aspect, an embodiment of the present application provides a file synchronization device, including:
the acquisition unit is used for acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized;
the processing unit is used for acquiring the record information of the synchronous file, and determining whether the subnet information of the second equipment and the file information which is synchronized exist according to the subnet information of the equipment to be synchronized and the record information of the file information to be synchronized in the synchronous file; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
the processing unit 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 for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
In a possible implementation manner of the fourth aspect, the file synchronization device further includes:
the receiving unit is used for receiving a synchronous completion response message returned by the second equipment;
the processing unit is further configured to update record information of the synchronization file according to subnet information of the device to be synchronized and file information to be synchronized.
A fourth possible implementation manner 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 synchronous file request message carries subnet information and file information to be synchronized;
the processing unit is further used for sending a synchronous file response message to the equipment to be synchronized;
the acquiring unit is specifically configured to acquire subnet information of the device to be synchronized and file information to be synchronized from the synchronization file request message.
A fourth possible implementation manner of the fourth aspect, the processing unit is further configured to send a synchronization file notification message to the device to be synchronized;
the receiving unit is further configured to receive a synchronization file response message sent by the device to be synchronized; and the synchronous file response message carries the file transmission port information of the equipment to be synchronized.
In a fourth aspect, the processing unit is specifically configured to obtain load information of at least two second devices if there are subnet information of the at least two second devices and the synchronized file information are the same as the subnet information of the device to be synchronized and the file information to be synchronized;
and determining a target second device according to the load information of the at least two second devices, and sending a synchronous control instruction to the target second device.
In a fourth possible implementation manner, the processing unit is specifically configured to determine, for each device to be synchronized of 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.
In a possible implementation manner of the fourth aspect, the processing unit is further configured to obtain a 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 if the file to be synchronized does not exist;
the processing unit is further configured to update record information of the synchronization file according to subnet information of the device to be synchronized and file information to be synchronized.
In a fifth aspect, an embodiment of the present application provides a file synchronization device, including:
the receiving unit is used for receiving the synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
the processing unit is used for determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
the processing unit is further configured to obtain a 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.
The processing unit is further configured to send a synchronization completion response message to the first device.
In a fifth possible implementation manner, the processing unit is specifically configured to send the file to be synchronized to the device to be synchronized through a port indicated by the file transfer port information.
In a sixth aspect, an embodiment of the present application provides a file synchronization device, including:
the receiving unit is used for receiving the file to be synchronized;
and the processing unit is used for updating the corresponding file according to the file to be synchronized.
A possible implementation manner of the sixth aspect, the processing unit is further configured to send a synchronization file request message to the first device; the synchronous file request message carries subnet information and file information to be synchronized;
The receiving unit is further configured to receive a synchronous file response message sent by the first device.
A possible implementation manner of the sixth aspect, the receiving unit is further configured to receive a synchronous file notification message sent by the first device;
the processing unit is further configured to send a synchronization file response message to the first device, where the synchronization file response message carries file transmission port information of the device to be synchronized.
In a possible implementation manner of the sixth aspect, the processing unit is specifically configured to receive a file to be synchronized through a port indicated by the file transfer port information.
In a seventh aspect, an embodiment of the present application provides an electronic device, including:
a processor and a memory storing a computer program which, when executed, causes the electronic device to perform the method of any of the first aspect or the second aspect or any of the third aspect described above.
In an eighth aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, where the program when executed controls a device in which the storage medium is located to perform the method of any one of the first aspect or the second aspect or any one of the third aspect.
By adopting the scheme provided by the embodiment of the application, when the first equipment needs to synchronize the file to the equipment to be synchronized, the first equipment acquires the subnet information of the equipment to be synchronized and the file information to be synchronized; acquiring record information of a synchronous file, and determining whether subnet information of a second device and file information which is synchronized exist in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the record information of the synchronous file is used for recording the subnet information of the equipment which has completed the file synchronization and the file information which has completed the synchronization. If yes, sending a synchronous control instruction to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized. That is, the subnet information of the device that has completed file synchronization and the file information that has completed synchronization are recorded in the record information of the synchronization file, and when the file needs to be synchronized with the device to be synchronized, the first device may acquire the subnet information of the device to be synchronized and the file information to be synchronized, and acquire the record information of the synchronization file. And then detecting whether the subnet information of the second equipment and the file information which are synchronized exist in the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information which are synchronized, wherein the subnet information of the second equipment and the file information which are synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized. If the file to be synchronized exists, the second device and the device to be synchronized are in the same subnet, and the file to be synchronized of the device to be synchronized is stored in the second device, so that the first device can send a synchronization control instruction to the second device, and the second device can transmit the file to be synchronized to the device to be synchronized. Thus, when the first device needs to synchronize the file 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 second device is the same as the subnet to which the device to be synchronized belongs, and the second device has already synchronized the file to be synchronized by the device to be synchronized, the first device can schedule the second device to send the file to be synchronized to the device to be synchronized. Because the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, the speed of transmitting the file to be synchronized from the second device to the device to be synchronized is faster and the efficiency is higher compared with the speed of directly transmitting the file to be synchronized to the device to be synchronized by the first device through the subnet.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of a file synchronization scenario provided in an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for file synchronization according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another method for file synchronization according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating another method for file synchronization according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating another method for synchronizing files according to an embodiment of the present application;
FIG. 6 is a schematic diagram of another scenario for file synchronization according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating another method for file synchronization according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a file synchronization device according to an embodiment of the present application;
FIG. 9 is a schematic diagram of another file synchronization device according to an embodiment of the present application;
FIG. 10 is a schematic diagram of another file synchronization device according to an embodiment of the present application;
FIG. 11 is a schematic diagram of another file synchronization device according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For a better understanding of the technical solution of the present application, the following detailed description of the embodiments of the present application refers to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one way of describing an association of associated objects, meaning that there may be three relationships, e.g., a and/or b, which may represent: the first and second cases exist separately, and the first and second cases exist separately. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Before describing embodiments of the present application in detail, terms applied or likely to be applied to the embodiments of the present application will be explained first.
Point-to-point technology (P2P): also known as peer-to-peer internetworking, is a new technology for networks that relies on the computing power and bandwidth of the participants in the network rather than aggregating dependencies on fewer servers. The P2P network is a peer-to-peer network without a central server that relies on user group nodes for information exchange. Unlike the traditional central server architecture, each user node in the P2P network is both a client and a server, and can serve as a server to provide services for other nodes at the same time. Data can be shared between any two devices in the P2P network.
Network address translation (Network Address Translation, NAT): NAT methods can be used when some hosts inside the private network have been assigned local IP (Internet Protocol ) addresses (i.e., private addresses used only in the private network) but want to communicate with hosts on the internet (without encryption). This method requires the installation of NAT software on a router that is connected to the internet (public IP) in a private network (private IP). The router equipped with NAT software is called NAT router and has at least one valid external global IP address (public network IP address). Thus, all hosts using local addresses (private IP addresses) can connect to the internet by converting their local addresses to global IP addresses on the NAT router when communicating with the outside world.
NAT traversal: NAT traversal involves a common problem in TCP/IP networks, namely the problem of establishing a connection between hosts in a private TCP/IP network that uses NAT devices.
Router (Router): is a hardware device that connects two or more networks, acting as a gateway between networks, is a network device that reads the address in each packet and then decides how to transmit. It is able to understand different protocols such as the ethernet protocol used by a certain local area network, the TCP (Transmission Control Protocol )/IP protocol used by the internet. Thus, the router can analyze the destination address of the data packet transmitted by various different types of networks, and convert the address of the non-TCP/IP network into a TCP/IP address, or vice versa; and then transmitting each data packet to a designated position according to the optimal route according to the selected routing algorithm. The router may connect a non-TCP/IP network to the internet.
Switch (Switch): a switch means a "switch" is a network device used for electrical (optical) signal forwarding. It can provide an unshared electrical signal path for any two network nodes of the access switch. The most common switch is an ethernet switch.
In the related art, in the field of coal mine industry, various devices required for coal mining are managed by a centralized control center device. Taking hydraulic support equipment as an example, the hydraulic support equipment is equipment for realizing movements such as lifting, forward moving and the like by taking hydraulic pressure as power and carrying out roof support, is key equipment for comprehensive mechanical mining of coal mines, and has great significance for modern coal mine production. In the use process of the hydraulic support equipment, the centralized control center equipment can synchronize files to the plurality of hydraulic support equipment, for example, when a software upgrade package of the hydraulic support equipment is developed or model configuration is needed to be carried out on the hydraulic support equipment, the centralized control center equipment needs to send the software upgrade package or the model configuration file to the plurality of hydraulic support equipment so as to realize upgrade and configuration of the plurality of hydraulic support equipment, and of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. For a plurality of hydraulic support devices with the same model, files to be synchronized are the same.
In the prior art, the coal mine industry network comprises a plurality of subnets, as shown in fig. 1, in general, a centralized control center device and a plurality of hydraulic support devices are located in different subnets, for example, the centralized control center device is located in a subnet 1, and the plurality of hydraulic support devices are located in a subnet 2. Therefore, when the centralized control center equipment synchronizes files to the hydraulic support equipment, the files to be synchronized need to be transmitted to the plurality of hydraulic support equipment in a cross-subnet mode. In the process of transmitting the file to be synchronized across the subnetworks, the transmitted data packet (the file to be synchronized) needs to pass through a plurality of routing nodes, and each routing node needs to process the transmitted data packet, such as addressing, data encapsulation, data decapsulation, and the like, as shown in fig. 1, when the centralized control center device synchronizes the file to the hydraulic support device 1, the data packet arrives at the switch in the subnetwork 1 from the centralized control center device and then arrives at the router, and then the router forwards the data packet to the switch of the subnetwork 2, and the switch of the subnetwork 2 transmits the data packet to the hydraulic support device 1, so that the time consumed for synchronizing the file across the subnetwork is long and the efficiency is low. And when the centralized control center equipment needs to synchronize the same file to the hydraulic support equipment 1 and the hydraulic support equipment 2 and … hydraulic support equipment n, the centralized control center equipment needs to send the files to be synchronized to each hydraulic support equipment respectively, so that the load of the centralized control center equipment is larger, the time consumption of file synchronization is further increased, and the efficiency of file synchronization is reduced.
In some technologies, file synchronization is implemented through Peer-to-Peer (P2P), and the P2P technology can enable the computers to directly share content and distribute data without a server, so that sharing data between any two machines on the internet is possible. Under the coal mine industry scene, assuming that centralized control center equipment and equipment required for coal mining are equipment in a P2P network, P2P is usually used for communication between two pieces of equipment crossing subnets, because NAT isolation usually exists between the equipment crossing subnets, the type of NAT needs to be obtained through NAT detection, then NAT traversal is realized according to the NAT detection result, and a connecting channel between the equipment can be established for file transmission. However, the NAT traversal process is complex and time-consuming, resulting in a low efficiency of establishing a connection path between devices, and thus a low efficiency of file transfer. And the NAT detection may fail, so that NAT traversal cannot be realized, and further, a connection path between devices cannot be established, so that file transmission cannot be performed. In addition, in the P2P network, if two devices that need to perform file transmission are in the same subnet, two-layer transmission of two devices that are in the same subnet cannot be achieved by adopting the P2P technology, and NAT gateway intervention is still required, which results in a reduction in transmission efficiency. Therefore, for the method for implementing file synchronization by adopting the P2P technology, NAT traversal among devices affects the efficiency of file synchronization, even when NAT detection fails, file transmission fails, and for two devices in the same subnet, NAT traversal is required, and direct communication cannot be performed, thereby affecting the efficiency of file transmission among devices in the same subnet.
In view of the above problems, an embodiment of the present application provides a file synchronization method, applied to a first device, where the method includes: acquiring subnet information of equipment to be synchronized and file information to be synchronized; acquiring record information of a synchronous file, and determining whether subnet information of a second device and file information which is synchronized are present according to subnet information of the device to be synchronized and record information of the file information to be synchronized in the synchronous file; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the record information of the synchronous file is used for recording the subnet information of the equipment which has completed the file synchronization and the file information which has completed the synchronization. If yes, sending a synchronous control instruction to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized. That is, the subnet information of the device that has completed file synchronization and the file information that has completed synchronization are recorded in the record information of the synchronization file, and when the file needs to be synchronized with the device to be synchronized, the first device may acquire the subnet information of the device to be synchronized and the file information to be synchronized, and acquire the record information of the synchronization file. And then detecting whether the subnet information of the second equipment and the file information which are synchronized exist in the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information which are synchronized, wherein the subnet information of the second equipment and the file information which are synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized. If so, the second device and the first device are in the same subnet, and the second device stores the file to be synchronized by the device to be synchronized, so that the first device can send 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.
Thus, when the first device needs to synchronize the file 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 second device is the same as the subnet to which the device to be synchronized belongs, and the second device has already synchronized the file to be synchronized by the device to be synchronized, the first device can schedule the second device to send the file to be synchronized to the device to be synchronized. Because the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, the speed of transmitting the file to be synchronized from the second device to the device to be synchronized is faster and the efficiency is higher compared with the speed of directly transmitting the file to be synchronized to the device to be synchronized by the first device through the subnet. The following is a detailed description.
Referring to fig. 2, a flow chart of a file synchronization method according to an embodiment of the present application is shown. The method is applied to a first device and comprises the following steps:
step 201, acquiring subnet information of a device to be synchronized and file information to be synchronized.
In the embodiment of the 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 technicians develop update files such as software upgrade packages, model configuration files of devices, etc., these update files need to be synchronized into the corresponding devices in order for the corresponding devices to update the files stored therein. The technician cannot directly synchronize the update file to the corresponding device, and the first device of the devices managing each subnet is required to synchronize. In the embodiment of the application, the file which needs to be updated by the device is called a file to be synchronized, and the device which needs to be updated is called a device to be synchronized. When the first device acquires the update file of the device to be synchronized, the first device can actively synchronize the update file with each device configured with the update file. The first device may also be requested by each device configured with the update file to synchronize the update file. That is, when the first device obtains the file to be synchronized, the file to be synchronized may be actively sent to each device to be synchronized configured with the file to be synchronized. The first device may also be requested to synchronize the file to be synchronized by each device configured with the file to be synchronized.
When the first device determines that the to-be-synchronized file needs to be synchronized to the to-be-synchronized device, in order to improve the synchronization efficiency, the to-be-synchronized device can be synchronized by the device which is located in the same subnet as the to-be-synchronized device and has completed the synchronization of the to-be-synchronized file. Based on the above, the first device needs to acquire subnet information of the device to be synchronized and file information to be synchronized. That is, it is necessary to acquire which subnet the device to be synchronized is located on and which file the device to be synchronized needs to synchronize.
In some embodiments, when the other device is connected to the first device, the other device needs to report, to the first device, a file configured in the other device, identification information of the other device, and related information of devices such as subnet information to which the other device belongs, so as to manage the other device by the first device. At this time, the first device may store device-related information reported by other devices. When the first device actively synchronizes the file to be synchronized with other devices, the first device may acquire the file to be synchronized from the other devices or may receive the file to be synchronized sent by the technician. According to the file to be synchronized, file information, such as file name, file size and the like, of the file to be synchronized can be determined. And secondly, the first device can determine the device to be synchronized corresponding to the file to be synchronized according to the configuration files in other devices recorded in the stored device related information, and determine the subnet information of the device to be synchronized according to the device related information. The first device obtains subnet information of the device to be synchronized and file information of the file to be synchronized.
When the other devices request the first device to synchronize the file to be synchronized, the other devices can carry the subnet information and the file information of the file to be synchronized in the request message, and the first device can acquire the subnet information and the file information of the device to be synchronized from the request message of the other devices.
Of course, the subnet information of the device to be synchronized and the file information to be synchronized may also be obtained in other manners, which is not limited in the present application. For example, the first device may obtain, according to the obtained file information to be synchronized, subnet information of the device to be synchronized through the third device. The third device may store the subnet information of each device, or the third device may acquire the subnet information from the device to be synchronized and return the subnet information to the first device.
For example, taking an example that the first device actively synchronizes the file to the device to be synchronized, it is assumed that the file to be synchronized is a configuration file of the 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 may receive the file of the software configuration upgrade package of the hydraulic support device sent by other devices, and the first device may determine that the file to be synchronized is a configuration file of the hydraulic support device. At this time, the first device may determine that the device to be synchronized corresponding to the file to be synchronized (the software upgrade package of the hydraulic support device) is the hydraulic support device 1 from the stored device related information, and may also determine the subnet information of the hydraulic support device 1, for example, the subnet information of the hydraulic support device 1 may be that the subnet to which the hydraulic support device belongs is the subnet 2. In this way, the first device can acquire the subnet information of the device to be synchronized and the file information to be synchronized.
As a possible implementation, the first device is different from the subnet to which the device to be synchronized belongs.
Specifically, a network may be divided into multiple subnets, where a first device is a device that centrally manages other devices in each subnet, and when a subnet to which the first device belongs is different from a subnet to which the device managed by the first device belongs, the first device needs to transmit a file to be synchronized to the device to be synchronized across subnets, which results in lower file synchronization efficiency. For example, the subnet to which the first device belongs is subnet 1, the subnet to which the device a belongs is subnet 2, and the subnet to which the device B belongs is subnet 3, if the first device directly performs file synchronization to the device a or the device B, file transmission across subnets is required, but the process of file transmission across subnets is complex, and the transmission efficiency is low.
Step S202, acquiring record information of the synchronous file, and determining whether subnet information of the second device and file information which is synchronized exist in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized.
The subnet information of the second device and the file information which is 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 synchronous file is used for recording the subnet information of the equipment which has completed the file synchronization and the file information which has completed the synchronization.
In the embodiment of the application, when the first device completes the file synchronization, the subnet information of the device completing the synchronization and the file information after completing the synchronization are recorded in the record information of the synchronization file, namely the record information of the synchronization file comprises the subnet information of the device after completing the file synchronization and the file information after completing the synchronization. When the first device needs to synchronize the file with the device to be synchronized, because the first device and the sub-network to which the device to be synchronized belong are different, if the first device directly sends the file to be synchronized to the device to be synchronized, the transmission of the file across the sub-network is needed, the transmission process across the sub-network is complex, and the efficiency is low. In the embodiment of the application, the first equipment can find out the second equipment which is in the same subnet with the equipment to be synchronized and completes the file synchronization same as the file to be synchronized, and the second equipment synchronizes the file to be synchronized for the equipment to be synchronized, thereby realizing the file synchronization in the same subnet and improving the file synchronization efficiency. Based on this, the first device can acquire the recorded information of the recorded synchronization file. The record information of the synchronous file comprises subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization. That is, the first device may acquire the subnet information of the device that has completed the file synchronization and the record information of the synchronization file of the file information of the file that the device completed the synchronization. The first device determines whether the subnet information of the second device and the file information which is synchronized are present in the record information of the synchronized file according to the subnet information of the device to be synchronized and the file information which is synchronized. That is, the first device may determine, according to the subnet information of the device to be synchronized and the file information to be synchronized, whether there is subnet information of the second device and subnet information of the file information to be synchronized, which are the same as the subnet information of the device to be synchronized and the file information to be synchronized, in the record information of the synchronized file. 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.
Step S203, if yes, sending a synchronization control instruction to the second device.
The synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
In the embodiment of the application, if the first device determines that the subnet information of the second device and the file information which has completed synchronization exist in the record information of the synchronization file, it is indicated 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 already synchronized the file to be synchronized of the device to be synchronized. At this time, the first device may send a synchronization control instruction to the second device, for example, the synchronization control instruction may include identification information of the device to be synchronized and file information to be synchronized, so that when the second device receives the synchronization control instruction, the second device transmits the file to be synchronized to the device to be synchronized according to the synchronization control instruction. That is, 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 already synchronized the file to be synchronized, the first device may send a synchronization control instruction to the second device, and since the file to be synchronized is already stored in the second device, the second device may directly transmit the file to be synchronized to the device to be synchronized when receiving 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, and file synchronization is completed. Because 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, file transmission can be directly carried out between devices in the same subnet without multiple routes, the transmission speed is higher, and the process of transmitting files across the subnet is complex as the first device and the device to be synchronized belong to different subnets, so that the efficiency of file synchronization can be improved by transmitting the files to be synchronized to the device to be synchronized by the second device.
For example, 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 acquires a software upgrade package of the hydraulic support device, and the software upgrade package of the hydraulic support device is a file to be synchronized, and the file information of the file to be synchronized is assumed to be a file B. Because 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 hydraulic support device C has the configured file as the file B, and the subnet is the subnet 2; and the conveyor D is provided with a file E, and the subnet to which the file E belongs is a subnet 3. Therefore, the first device can determine, according to the stored device related information and the file information to be synchronized, that the device to be synchronized corresponding to the file information to be synchronized is the hydraulic support device C, and that the subnet information of the hydraulic support device C is the subnet 2. In this way, the first device may acquire that the subnet information of the device to be synchronized is subnet 2, and the file information to be synchronized is file B. Then, the first device may acquire the record information of the synchronization file, assuming that the record information of the synchronization file is recorded with: the hydraulic support device F belongs to a subnet 2, and the files after synchronization are files B; and the conveyor G belongs to a subnet 3, and the file which is synchronized is a file E. According to the subnet information of the equipment to be synchronized and the file information to be synchronized, determining whether the subnet information of the second equipment and the file information which is completed to be synchronized exist in the record information of the synchronous file, wherein the subnet is the subnet 2, the file which is completed to be synchronized is the file B, at the moment, the first equipment can determine that the subnet information of the second equipment and the file information which is completed to be synchronized exist, and the second equipment is the hydraulic support equipment F. The first device sends a synchronization control instruction to the second device, so that the second device transmits a file to be synchronized to the device to be synchronized after receiving the synchronization control instruction.
As a possible implementation manner, the sending, if any, the synchronization control instruction to the second device includes:
if the sub-network information of at least two second devices and the file information which is synchronized are the same as the sub-network information of the device to be synchronized and the file information to be synchronized, load information of the at least two second devices is obtained;
and determining the target second equipment according to the load information of the at least two second equipment, and sending a synchronous control instruction to the target second equipment.
In the embodiment of the application, the subnet information of the device with the file completed by the first device and the file information with the synchronization completed are recorded in the record information of the synchronization file. Therefore, when the first device searches whether the subnet information of the second device and the file information which are the same as the subnet information of the device to be synchronized and the file information to be synchronized exist in the record information of the synchronous asking price according to the subnet information of the device to be synchronized and the file information to be synchronized, the subnet information of at least two second devices and the file information which are the same as the subnet information of the device to be synchronized and the file information to be synchronized may exist. At this time, when the subnet information of the second devices and the file information which is already synchronized exist, and at least two pieces of subnet information exist, that is, when the subnet information of the at least two pieces of subnet information are the same as the subnet information of the device to be synchronized, and the synchronizing file information which is already completed by the at least two pieces of subnet information is the same as the file information of the file to be synchronized of the device to be synchronized, the first device may acquire the load information of the at least two pieces of subnet information. At this time, the first device may send request messages for obtaining the load information to the at least two second devices, respectively, and the at least two second devices inform the first device of the respective load information of the at least two second devices. The first device may record the number of synchronization tasks allocated to each other device when controlling the other devices to perform file synchronization on the device to be synchronized, and acquire load information of at least two second devices by acquiring the number of synchronization tasks allocated to each second device. After the first device obtains the load information of each second device, the first device may determine, according to the load information of each second device, a target second device corresponding to the device to be synchronized according to a load balancing principle. That is, after the first device obtains the load information of each second device, the second devices with fewer loads recorded in the load information can be determined as target second devices corresponding to the devices to be synchronized, so that load balancing of each second device is achieved, and synchronization efficiency is improved. After the first device determines the target second device, the first device may send a synchronization control instruction to the target second device, so as to control the target second device to perform synchronization of the file to be synchronized for the device to be synchronized.
It should be understood that the load information of the second device may be information of the number of synchronization tasks that the second device needs to perform file synchronization for other devices.
In one possible implementation, the device to be synchronized comprises at least two. At this time, the determining the target second device according to the load information of the at least two second devices includes:
and determining a target second device corresponding to each device to be synchronized according to the load information of at least two second devices aiming at each device to be synchronized in at least two devices to be synchronized.
In the embodiment of the application, when the first device needs to synchronize the files to be synchronized for at least two devices to be synchronized, and it is determined that at least two second devices can synchronize the files to be synchronized for at least two devices to be synchronized, the first device can determine the corresponding target second devices for each file to be synchronized. That is, for each device to be synchronized in the at least two devices to be synchronized, the first device determines the target second device corresponding to each device to be synchronized according to the load information of the at least two second devices, so that the at least two second devices can be load-balanced to synchronize the files to be synchronized for the at least two synchronization devices.
Thus, when the first device needs to synchronize the file 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 second device is the same as the subnet to which the device to be synchronized belongs, and the second device has already synchronized the file to be synchronized by the device to be synchronized, the first device can schedule the second device to send the file to be synchronized to the device to be synchronized. Because the second equipment and the sub-network to which the equipment to be synchronized belongs are the same, the speed of transmitting the file to be synchronized from the second equipment to the equipment to be synchronized is faster and the efficiency is higher by directly transmitting the file to be synchronized across the sub-network relative to the first equipment to be synchronized.
As a possible implementation manner, when the subnet information of the first device and the subnet information of the device to be synchronized are the same, file synchronization between the first device and the device to be synchronized can also be achieved through the method. Although the problem of low file synchronization efficiency caused by cross-subnet file transmission does not exist when the first device and the subnet information of the to-be-synchronized devices are the same, when a plurality of to-be-synchronized devices exist, the first device sends the to-be-synchronized files to the to-be-synchronized devices, which causes rapid increase of the operation load of the first device and slower file synchronization, and the file synchronization efficiency is reduced to a certain extent.
Fig. 3 is a flowchart of another file synchronization method according to an embodiment of the present application. The method is applied to the second equipment and specifically comprises the following steps of:
step S301, a synchronization control instruction is received.
The synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
Specifically, when the first device determines that the subnet information and the file information after synchronization 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 sends a synchronization control instruction to the second device, wherein the synchronization control instruction can include identification information and the file information to be synchronized of the device to be synchronized, and the second device receives the synchronization control instruction to acquire that the file to be synchronized needs to be transmitted to the device to be synchronized.
Step S302, determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction.
In the embodiment of the application, the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized, and the second equipment can acquire the file information to be synchronized and the equipment to be synchronized by analyzing the synchronization control instruction.
Step S303, acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized.
In the embodiment of the application, after the second device analyzes the synchronization control instruction to obtain the file information to be synchronized, the second device can search the file according to the file information to be synchronized, determine the file with the same file information as the file information to be synchronized, take the file as the file to be synchronized, and after the second device obtains the file to be synchronized, can send the file to be synchronized to the determined device to be synchronized.
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 is within the same subnet as the device to be synchronized. 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 higher.
Fig. 4 is a flowchart of another file synchronization method according to an embodiment of the present application. The method is applied to the equipment to be synchronized, and specifically comprises the following steps:
step S401, receiving a file to be synchronized.
Specifically, when the device to be synchronized needs to synchronize the file, the first device may directly send the file to be synchronized to the device to be synchronized, or may be the same as the subnet to which the device to be synchronized belongs, and the second device synchronized with the file to be synchronized sends the file to be synchronized to the device to be synchronized, where the device to be synchronized may receive the file to be synchronized sent by the first device or the second device.
Step S402, updating the corresponding file according to the file to be synchronized.
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, so as to complete file synchronization.
In the embodiment of the present application, there are two ways that 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 perform file synchronization, so as to more clearly illustrate information interaction among the first device, the second device and the device to be synchronized. The method specifically comprises the following steps:
in step S501, the first device obtains subnet information of the device to be synchronized and file information to be synchronized.
Specific reference may be made to step S201, and details are not described herein.
As a possible implementation, there may be a case where at least two devices to be synchronized perform file synchronization. The equipment to be synchronized needs to determine the subnet information of at least two pieces of equipment to be synchronized and the file information of the file to be synchronized. When at least two devices to be synchronized are the same in type, the files to be synchronized are the same.
Taking hydraulic support equipment in a coal mine industrial scene as an example, a plurality of hydraulic support equipment needs to update the file 1, and when the types of the hydraulic support equipment are the same, the file 1 which needs to be updated of the hydraulic support equipment is the same, namely the file 1 which needs to be updated is the same. Thus, assuming that the first device acquires the software upgrade package file of file 1 of the hydraulic mount device, the first device may determine that an upgrade of file 1 to a plurality of hydraulic mount devices is required. At this time, the first device may determine the hydraulic support device that needs to upgrade the file 1 as the device to be synchronized, and determine the software upgrade package file of the file 1 as the file to be synchronized. The first device may then determine a plurality of devices to be synchronized. By detecting the recorded equipment related information, the subnet information of the equipment to be synchronized can be determined respectively. It is assumed that the subnet information of the plurality of hydraulic support devices is the same and belongs to the subnet 1. At this time, the first device may determine that the subnet information of the plurality of devices to be synchronized belongs to the subnet 1, and assume that the file information of the file to be synchronized is the file name of the file to be synchronized. At this time, the first device may determine that file information of files to be synchronized of the plurality of devices to be synchronized is file 1.
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.
Specifically, before file synchronization is performed, the first device needs to inform the device to be synchronized that file 1 is to be performed. At this time, the first device sends a synchronization file notification message to the device to be synchronized, so as to inform the device to be synchronized that file synchronization is needed. In one possible implementation, the file information of the files to be synchronized is carried in the synchronization file notification message, so as to inform the devices to be synchronized which files need to be synchronized. The device to be synchronized receives the synchronous file notification message sent by the first device, so that the first device needs to synchronize the files, and the first device can know which files need to be synchronized through the file information of the files to be synchronized carried in the synchronous file notification message.
As a possible implementation manner, if there are at least two devices to be synchronized, the first device needs to send a synchronization file notification message to the at least two devices to be synchronized respectively.
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.
The synchronous file response message carries the file transmission port information of the equipment to be synchronized.
In the embodiment of the application, after receiving the synchronous file notification message, the device to be synchronized knows that the file needs to be synchronized, and because the device to be synchronized needs to transmit the file through a specific port, the device to be synchronized adds the file transmission port information of the device to be synchronized into the synchronous file response message and sends the synchronous file response message to the first device. The first device receives the synchronous file response message sent by the device to be synchronized, and obtains the file transmission port information used when the device to be synchronized performs file transmission by analyzing the synchronous file response message.
As a possible implementation manner, when at least two devices to be synchronized exist, each device to be synchronized returns a synchronous file response message to the first device, and the first device receives the synchronous file response messages sent by the at least two devices to be synchronized and obtains the file transmission port information of each device to be synchronized by respectively analyzing the synchronous file response messages sent by the at least two devices to be synchronized.
Step S504, the first device acquires the record information of the synchronous file, and determines whether the subnet information of the second device and the file information which is synchronized are present in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized.
In particular, reference may be made to step S202, which is not described herein.
When 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, the following steps are different according to different determination results. When determining that the subnet information of the second device and the file information which has completed synchronization exist, executing step S505a to step S507a, step S508, step S509a and step S510; when it is determined that the subnet information of the second device and the file information for which synchronization has been completed do not exist, step S505b, step S508 and step S510 are performed.
In step S505a, if the synchronization control command exists, the first device sends the synchronization control command to the second device, and the second device receives the synchronization control command.
The synchronous control instruction carries file transmission port information of the equipment to be synchronized.
Specifically, if it is determined that the subnet information and the file information of the second device that have completed synchronization exist, it is indicated that the subnet information and the file information of the second device that have completed synchronization are the same as the subnet information and the file information of the device to be synchronized, that is, the second device has completed synchronization of the device to be synchronized, and the second device and the device to be synchronized belong to the same subnet. The synchronization file may then be transmitted by the second device to the device to be synchronized. After the first device receives the synchronous file response message sent by the device to be synchronized, the first device can acquire the file transmission port information of the device to be synchronized by analyzing the synchronous file response message, and the file transmission port information of the device to be synchronized is added into the synchronous control instruction. The first equipment sends a synchronous control instruction to the second equipment, the second equipment receives the synchronous control instruction, and the second equipment can acquire file transmission port information of equipment to be synchronized by analyzing the synchronous control instruction.
As a possible implementation manner, if the subnet information and the file information that have completed synchronization of the 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, load information of the at least two second devices is obtained; and determining the target second equipment according to the load information of the at least two second equipment, and sending a synchronous control instruction to the target second equipment.
Specifically, because there may be at least two second devices that are the same as the subnet to which the device to be synchronized belongs and that have completed synchronizing the file to be synchronized, the subnet information of the at least two second devices and the file information that has completed synchronizing are recorded in the record information of the synchronizing file, so that the first device determines the subnet information of the at least two second devices and the file information that has completed synchronizing in the record information of the synchronizing file. When the subnet information and the file information which are synchronized are the same as the subnet information and the file information of the equipment to be synchronized, one target second equipment is needed to be selected from the at least two second equipment and used for synchronizing the file to be synchronized with the equipment to be synchronized.
At this time, the first device may acquire load information of at least two second devices, where the load information of the second devices may be the number of file synchronization tasks that the second devices need to perform. For example, the first device may acquire the identification information of the at least two second devices in the record information of the synchronization file, and respectively send load information acquisition request messages to the at least two second devices according to the identification information of the at least two second devices, where each of the at least two second devices sends its own load information to the first device after receiving the load information acquisition request message. The device in each subnet may actively send its own load information to the first device periodically, where the first device may record identification information of each device and load information corresponding to each device when receiving the device load information, and the first device may determine, according to the identification information of at least two second devices, load information corresponding to each second device in the at least two second devices in the recorded device load information. The first device may record load information of each device, and the initial value of the load information of each device is zero, and since the file synchronization task of the device is sent to the first device by the first device, the first device updates the load information of the device corresponding to the file synchronization task once every time the first device sends the file synchronization task, and the first device may obtain the load information corresponding to each of the at least two second devices from the recorded load information of the device. Of course, the load information corresponding to the second device may also be obtained in other manners, which is not limited in the present application.
After the load information of the at least two second devices is acquired, the target second device may be determined according to the load information of the at least two second devices. At this time, the first device may obtain, according to load information of at least two second devices, the number of file synchronization tasks to be executed by each second device, and to implement load balancing between at least two second devices, may determine, as the target second device, the second device having a smaller number of file synchronization to be executed, so as to implement load balancing between at least two second devices. When the load information of the at least two second devices is the same, one second device can be randomly selected from the at least two second devices with the same load information as the target second device. And after the target second equipment is determined, sending a synchronous control instruction to the target second equipment.
As a possible implementation manner, when there are at least two devices to be synchronized, determining the target second device according to the load information of the at least two second devices includes: and determining a target second device corresponding to each device to be synchronized according to the load information of at least two second devices aiming at each device to be synchronized in at least two devices to be synchronized.
In the embodiment of the present application, since there may be multiple devices of the same type in each subnet, for example, the subnet 2 includes multiple hydraulic support devices, and the files to be synchronized of the multiple devices of the same type are the same, after the first device acquires the file to be synchronized, there may be multiple devices that all need to synchronize the file to be synchronized. The first device determines at least two devices to be synchronized according to the stored device related information. And if the first device determines at least two second devices, the first device may determine, for each device to be synchronized in 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 and using load balancing as a criterion. That is, if at least two devices to be synchronized and at least two second devices exist, for each device to be synchronized in the at least two devices to be synchronized, according to load information of the at least two second devices, the number of file synchronization tasks to be executed by each second device can be determined, so that load balancing of the at least two second devices is achieved as a principle, and a target second device corresponding to each device to be synchronized is determined. The load balancing of the at least two second devices is that the number of file synchronization tasks to be executed by the at least two second devices is relatively balanced.
For example, assume that the subnet to which the first device belongs is subnet 1, and that there are two devices to be synchronized: the method comprises the steps that 1, 2, two second devices are determined by a first device according to subnet information of the devices to be synchronized and file information to be synchronized: device 3, device 4, device 1, device 2, device 3 and device 4 are all subnetworks 2. The load information of the device 3 acquired by the first device includes 2 number of file synchronization tasks to be executed, and the load information of the device 4 includes 4 number of file synchronization tasks to be executed. After determining two devices to be synchronized: in order to realize load balancing between the two second devices when the target second devices corresponding to the device 1 and the device 2 are the target second device corresponding to the first device to be synchronized (device 1) is determined to be the device 3, and the target second device corresponding to the second device to be synchronized (device 2) is also determined to be the device 3, so that the number of file synchronization tasks to be executed by the device 3 and the number of file synchronization tasks to be executed by the device 4 are both 4, and load balancing between the device 3 and the device 4 can be realized. Assuming that the load information of the device 3 includes 2 file synchronization tasks to be executed, the load information of the device 4 includes 3 file synchronization tasks to be executed, in order to implement load balancing between two second devices, the target second device corresponding to the first device to be synchronized (device 1) may be determined to be the device 3, at this time, the number of file synchronization tasks to be executed by the device 3 and the number of file synchronization tasks to be executed by the device 4 will be 3, and when determining the target second device corresponding to the second device to be synchronized (device 2), one device of the device 3 and the device 4 may be selected randomly as the target second device of the second device to be synchronized.
In step S505b, if not, 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.
Specifically, if the subnet information of the second device and the file information after synchronization do not exist in the record information of the synchronization file, it is indicated that the first device does not synchronize the file to be synchronized with other devices identical to the subnet information of the device to be synchronized, and the first device cannot synchronize the file to be synchronized with the device to be synchronized through the device in the same subnet with the device to be synchronized. At this time, the first device needs to directly synchronize the file to be synchronized with the device to be synchronized. The first device may acquire a 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.
For example, the first device may acquire and store a plurality of files to be synchronized from other devices or through other modes, and the first device may determine, according to the file information to be synchronized, the file to be synchronized from the plurality of files to be synchronized.
As a possible implementation manner, because the file transmission port information of the to-be-synchronized device is carried in the synchronization file response message returned by the to-be-synchronized device to the first device, when it is determined that the subnet information of the second device and the file information which has completed synchronization do not exist in the record information of the synchronization file, the first device may send the to-be-synchronized file to the to-be-synchronized device through the acquired file transmission port indicated by the file transmission port information of the to-be-synchronized device, and the to-be-synchronized device receives the to-be-synchronized file through the file transmission port.
In step S506a, the second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
Specific reference may be made to step S302, which is not described herein.
In step S507a, the second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transmission port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transmission port information.
Specifically, the synchronization control instruction sent by the first device to the second device carries information of a file transmission port of the device to be synchronized, and the second device can obtain the port used when the device to be synchronized carried in the synchronization control instruction performs file transmission by analyzing the synchronization control instruction. When the second device sends the file to be synchronized to the device to be synchronized, the file to be synchronized can be sent to the device to be synchronized through the port indicated by the file transmission 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 transmission port information.
Assume that, as shown in fig. 6, the subnet to which the first device belongs is subnet 1, the first device obtains a file to be synchronized, for example, the file to be synchronized is file 1, and according to the file information (file 1) to be synchronized, it is determined that file 1 is configured in two devices (device 1 and device 2) to be synchronized in the stored device related information, where the subnet information of the device 1 and the device 2 is subnet 2. That is, the first device may determine that both devices to be synchronized need to synchronize the files to be synchronized. The first device sends a synchronization file notification message to the two devices to be synchronized (device 1, device 2) respectively to inform the devices 1, 2 that the file to be synchronized needs to be transmitted to them. And then the device 1 returns a synchronous file response message to the first device, wherein the synchronous file response message returned by the device 1 carries the file transmission port information of the device 1. Meanwhile, the device 2 returns a synchronous file response message to the first device, and the synchronous file response message returned by the device 2 carries the file transmission port information of the device 2. The first device can acquire the ports used by the two devices to be synchronized for file transmission by analyzing the received synchronous file response messages returned by the two devices to be synchronized.
Then, the first device determines that two second devices (device 3 and device 4) exist in the record information of the synchronous 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, the device 3 and the device 4 have already completed the synchronization of the file 1, and the subnets are subnets 2 and the same as the subnets to which the device to be synchronized belongs. Since there are two second devices, the first device may send a request message for acquiring its load information to the device 3 and the device 4, respectively, and receive the respective load information returned by the device 3 and the device 4. Assuming that the load information of the device 3 includes the number of file synchronization tasks to be performed as 3, the load information of the device 4 includes the number of file synchronization tasks to be performed as 3. Therefore, in order to realize load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) may be determined as device 3, and the target second device corresponding to the second device to be synchronized (device 2) may be determined as device 4, so that 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, and load balancing between device 3 and device 4 may be realized. Then, the first device sends a synchronization control instruction to the device 3, wherein the synchronization control instruction comprises the device to be synchronized as the device 1, the file transmission port information of the device 1 and the file information to be synchronized as the file 1; meanwhile, the first device sends a synchronization control instruction to the device 4, wherein the synchronization control instruction comprises the device to be synchronized as the device 2, the file transmission port information of the device 2 and the file information to be synchronized as the file 1. After receiving the synchronization control instruction, the device 3 acquires 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 transmission port of the device 1 carried in the synchronization control instruction, wherein the device 1 receives the file to be synchronized through the port indicated by the file transmission port information. Similarly, after receiving the synchronization control instruction, the 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 transmission port of the device 2 carried in the synchronization control instruction, and the device 2 receives the file to be synchronized through the port indicated by the file transmission port information.
Step S508, the equipment to be synchronized updates the corresponding file according to the file to be synchronized.
Specific reference may be made to step S402, which is not described herein.
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.
Specifically, after the second device transmits the file to be synchronized to the device to be synchronized, a synchronization completion response message may be returned to the first device to inform the first device of completing the synchronization of the file to be synchronized to the device to be synchronized. The first device receives the synchronization completion response message, and can learn that the second device has transmitted the file to be synchronized to the device to be synchronized according to the synchronization completion response message, and the file synchronization is completed.
Step S510, the first device updates the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized.
In the embodiment of the application, the first device records the subnet information of the device and the synchronized file information when the synchronized file is completed each time, namely the subnet information of the device and the synchronized file information when the synchronized file is completed each time can update the record information of the synchronized file. After receiving the synchronization completion response message returned by the second device, the first device determines that the file synchronization is completed, and at this time, the record information of the synchronous file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized. For example, identification information of the device to be synchronized, subnet information of the device to be synchronized, and file information to be synchronized may be added to record information of the synchronization file.
In the embodiment of the present application, an example is described in which a device to be synchronized actively requests to a first device for file synchronization, as shown in fig. 7, which is a schematic flow chart of another file synchronization method provided in the embodiment of the present application. The method specifically comprises the following steps:
in 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.
The synchronous file request message carries subnet information and file information to be synchronized.
In the embodiment of the application, the device to be synchronized can actively request the first device for synchronizing the file, at this time, the device to be synchronized can send a synchronizing file request message to the first device, and the first device receives the synchronizing file request message sent by the device to be synchronized.
As a possible implementation manner, the synchronous file request message also carries the file transfer port information of the device to be synchronized.
The file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
In some embodiments, since the device to be synchronized needs to perform file transmission through the designated port, the device to be synchronized may add the file transmission port information to the synchronization file request message, and send the synchronization file request message to the first device to inform the first device of the file transmission port of the device to be synchronized.
In 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.
In the embodiment of the application, after receiving the synchronous file response message sent by the device to be synchronized, if the device to be synchronized can perform file synchronization, the first device to be synchronized can send the synchronous file response message to the device to be synchronized, and the device to be synchronized receives the synchronous file response message, so that the first device is informed to perform file synchronization for the device to be synchronized.
In step S703, the first device obtains subnet information of the device to be synchronized and file information to be synchronized from the synchronization file request message.
In the embodiment of the application, the subnet information and the file information to be synchronized are carried in the synchronous file request message, and the first device can acquire the subnet information and the file information to be synchronized of the device to be synchronized carried in the synchronous file request message by analyzing the synchronous file request message.
As a possible implementation manner, when the synchronous file request message sent by the device to be synchronized also carries the file transmission port information of the device to be synchronized, the first device may learn the port used when the device to be synchronized performs file transmission by analyzing the synchronous file request message sent by the device to be synchronized.
Step S704, the first device acquires the record information of the synchronous file, and determines whether the subnet information of the second device and the file information which is synchronized are present in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized.
In particular, reference may be made to step S202, which is not described herein. When it is determined that the subnet information of the second device and the file information for which synchronization has been completed exist, steps S705a to S707a, step S708, step S709a and step S710 are performed; when it is determined that the subnet information of the second device and the synchronized file information do not exist, step S705b, step S708, and step S710 are performed.
Step S705a, if yes, sending a synchronization control instruction to the second device, and receiving the synchronization control instruction by the second device.
Specific reference may be made to step S505a, which is not described herein.
It should be noted that, when the device to be synchronized actively requests the first device to perform file synchronization, there may also be at least two second devices, and when there are at least two second devices, the specific execution step may refer to step S505a.
Step 705b, if not, 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.
Specific reference may be made to step S505b, which is not described herein.
In step S706a, the second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.
Specific reference may be made to step S302, which is not described herein.
In step S707a, the second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transmission port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transmission port information.
The specific reference may be made to step S507a, which is not described herein.
Step S708, the device to be synchronized updates the corresponding file according to the file to be synchronized.
Specific reference may be made to step S402, which is not described herein.
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.
The specific reference to step S509a is omitted here.
In 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.
The specific reference may be made to step S510, which is not described herein.
Thus, according to the method described in fig. 5 or fig. 7, when the first device needs to synchronize the file 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 second device is the same as the subnet to which the device to be synchronized belongs, and the second device has already synchronized the file to be synchronized by the device to be synchronized, the first device may schedule the second device to send the file to be synchronized to the device to be synchronized. Because the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, the speed of transmitting the file to be synchronized from the second device to the device to be synchronized is faster and the efficiency is higher compared with the speed of directly transmitting the file to be synchronized to the device to be synchronized by the first device through the subnet. Compared with the P2P technology, the method of the embodiment does not need NAT detection and NAT traversal, and can reduce complexity of file synchronization. Meanwhile, for the second equipment and the equipment to be synchronized under the same subnet, the second equipment can directly send the file to be synchronized to the equipment to be synchronized, and file transmission among the equipment under the same subnet can be realized without NAT traversal.
Fig. 8 is a schematic structural diagram of a file synchronization device according to an embodiment of the present application. As shown in fig. 8, the apparatus includes:
an obtaining unit 801, configured to obtain subnet information of a device to be synchronized and file information to be synchronized.
The processing unit 802 is configured to obtain record information of the synchronization file, and determine whether there is subnet information of the second device and file information that has completed synchronization according to subnet information of the device to be synchronized and record information of the file information to be synchronized in the synchronization file.
The subnet information of the second device and the synchronized file information are the same as the subnet information of the device to be synchronized and the synchronized file information, and the record information of the synchronized file is used for recording the subnet information of the device which has completed file synchronization and the synchronized file information.
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 for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
As a possible implementation manner, as shown in fig. 9, the file synchronization device further includes:
and the receiving unit 803 is configured to receive a synchronization completion response message returned by the second device.
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.
As a possible implementation manner, the receiving unit 803 is further configured to receive a synchronization file request message sent by a device to be synchronized; the synchronous file request message carries subnet information and file information to be synchronized;
the processing unit 802 is further configured to send a synchronization file response message to the device to be synchronized.
The obtaining unit 801 is specifically configured to obtain subnet information of the device to be synchronized and file information to be synchronized from the synchronization file request message.
As a possible implementation manner, the processing unit 802 is further configured to send a synchronization file notification message to the device to be synchronized;
a receiving unit 803, configured to receive a synchronization file response message sent by a device to be synchronized; the synchronous file response message carries the file transmission port information of the equipment to be synchronized.
As a possible implementation manner, the processing unit 802 is specifically configured to obtain the load information of at least two second devices if the subnet information of the at least two second devices and the file information that has completed synchronization are the same as the subnet information of the device to be synchronized and the file information to be synchronized.
And determining a target second device according to the load information of the at least two second devices, and sending a synchronous control instruction to the target second device.
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 of the at least two devices to be synchronized according to load information of the at least two second devices.
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 and send the file to be synchronized to the device to be synchronized if the file to be synchronized does not exist.
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.
Fig. 10 is a schematic structural diagram of another file synchronization device according to an embodiment of the present application. As shown in fig. 10, the apparatus includes:
a receiving unit 1001, configured to receive a synchronization control instruction. The synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
The processing unit 1002 is configured to determine file information to be synchronized and a device to be synchronized according to the synchronization control instruction.
The processing unit 1002 is further configured to obtain a 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.
The processing unit 1002 is further configured to send a synchronization completion response message to the first device.
As a possible implementation manner, the processing unit 1002 is specifically configured to send, to a device to be synchronized, a file to be synchronized through a port indicated by the file transfer port information.
Fig. 11 is a schematic structural diagram of another file synchronization device according to an embodiment of the present application. As shown in fig. 11, the apparatus includes:
a receiving unit 1101, configured to receive a file to be synchronized.
The processing unit 1102 is configured to update a corresponding file according to the file to be synchronized.
As a possible implementation manner, the processing unit 1102 is further configured to send a synchronization file request message to the first device. The synchronous file request message carries subnet information and file information to be synchronized.
The receiving unit 1101 is further configured to receive a synchronous file response message sent by the first device.
As a possible implementation manner, the receiving unit 1101 is further configured to receive a synchronization file notification message sent by the first device.
The processing unit 1102 is further configured to send a synchronization file response message to the first device, where the synchronization file response message carries file transmission port information of the device to be synchronized.
As a possible implementation manner, the processing unit 1102 is specifically configured to receive a file to be synchronized through a port indicated by the file transfer port information.
Corresponding to the embodiment, the application also provides electronic equipment. Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 1200 may include: processor 1201, memory 1202, and communication unit 1703. The components may communicate via one or more buses, and it will be appreciated by those skilled in the art that the configuration of the server as shown in the drawings is not limiting of the embodiments of the application, and that it may be a bus-like structure, a star-like structure, or include more or fewer components than shown, or may be a combination of certain components or a different arrangement of components.
The communication unit 1203 is configured to establish a communication channel, so that the electronic device may communicate with other devices. Receiving user data sent by other devices or sending user data to other devices.
The processor 1201 is a control center for the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and/or processes data by running or executing software programs and/or modules stored in the memory 1202, and invoking data stored in the memory. The processor may be comprised of integrated circuits (integrated circuit, ICs), such as a single packaged IC, or may be comprised of packaged ICs that connect multiple identical or different functions. For example, the processor 1201 may include only a central processing unit (central processing unit, CPU). In the embodiment of the application, the CPU can be a single operation core or can comprise multiple operation cores.
The memory 1202, for storing instructions for execution by the processor 1201, the memory 1202 may be implemented by any type of volatile or non-volatile memory device or 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 memory, flash memory, magnetic disk, or optical disk.
The execution of the instructions in memory 1202, when executed by processor 1201, enables electronic device 1200 to perform some or all of the steps of the embodiments illustrated in fig. 2 or 3 or 4.
In a specific implementation, the present invention further provides a storage medium, where the storage medium may store a program, where the program may include some or all of the steps in each embodiment of the file synchronization method provided by the present invention when the program is executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.

Claims (23)

1. A method of file synchronization, for use with a first device, the method comprising:
acquiring subnet information of equipment to be synchronized and file information to be synchronized;
acquiring record information of a synchronous file, and determining whether subnet information of a second device and file information which is synchronized are present in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
if yes, a synchronous control instruction is sent to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
2. The method as recited in claim 1, further comprising:
receiving a synchronization completion response message returned by the second equipment;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
3. The method according to claim 1, further comprising, before the acquiring the subnet information of the device to be synchronized and the file information to be synchronized:
receiving a synchronous file request message sent by the equipment to be synchronized; the synchronous file request message carries subnet information and file information to be synchronized;
sending a synchronous file response message to the equipment to be synchronized;
the acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized comprises the following steps:
and acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized from the synchronous file request message.
4. A method according to claim 3, wherein the synchronization file request message also carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
5. The method of claim 1, further comprising, prior to said sending the synchronization control instruction to the second device:
sending a synchronous file notification message to the equipment to be synchronized;
receiving a synchronous file response message sent by the equipment to be synchronized; and the synchronous file response message carries the file transmission port information of the equipment to be synchronized.
6. The method according to claim 3 or 4, wherein the synchronization control instruction carries file transfer port information of the device to be synchronized.
7. The method of claim 1, wherein the sending a synchronization control instruction to the second device, if any, comprises:
if the information exists, and the subnet information and the file information which are synchronized are the same as the subnet information and the file information to be synchronized of the equipment to be synchronized, the load information of the at least two second equipment is obtained;
and determining a target second device according to the load information of the at least two second devices, and sending a synchronous control instruction to the target second device.
8. The method according to claim 7, wherein the device to be synchronized comprises at least two;
The determining the target second device according to the load information of the at least two second devices comprises:
and determining a target second device corresponding to each device to be synchronized according to the load information of the at least two second devices aiming at each device to be synchronized in the at least two devices to be synchronized.
9. The method of claim 1, wherein the first device is different from a subnet to which the device to be synchronized belongs.
10. The method as recited in claim 1, further comprising:
if the file information to be synchronized does not exist, acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
11. A method of file synchronization, for use with a second device, the method comprising:
receiving a synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
and acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized.
12. The method as recited in claim 11, further comprising:
and sending a synchronization completion response message to the first device.
13. The method of claim 11, wherein the synchronization control instruction carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the equipment to be synchronized performs file transmission;
the sending the file to be synchronized to the device to be synchronized includes:
and sending the file to be synchronized to the equipment to be synchronized through the port indicated by the file transmission port information.
14. A method for synchronizing files, comprising:
receiving a file to be synchronized;
and updating the corresponding file according to the file to be synchronized.
15. The method of claim 14, further comprising, prior to said receiving the file to be synchronized:
sending a synchronous file request message to a first device; the synchronous file request message carries subnet information and file information to be synchronized;
and receiving a synchronous file response message sent by the first equipment.
16. The method according to claim 15, wherein the synchronization file request message further carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
17. The method of claim 14, further comprising, prior to said receiving the file to be synchronized:
receiving a synchronous file notification message sent by the first equipment;
and sending a synchronous file response message to the first device, wherein the synchronous file response message carries the file transmission port information of the device to be synchronized.
18. The method according to claim 16 or 17, wherein receiving the file to be synchronized comprises:
and receiving the file to be synchronized through the port indicated by the file transmission port information.
19. A document synchronization apparatus, comprising:
the acquisition unit is used for acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized;
the processing unit is used for acquiring the record information of the synchronous file, and determining whether the subnet information of the second equipment and the file information which is synchronized exist according to the subnet information of the equipment to be synchronized and the record information of the file information to be synchronized in the synchronous file; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
The processing unit 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 for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
20. A document synchronization apparatus, comprising:
the receiving unit is used for receiving the synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
the processing unit is used for determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
the processing unit is further configured to obtain a 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.
21. A document synchronization apparatus, comprising:
the acquisition unit is used for receiving the file to be synchronized;
and the processing unit is used for updating the corresponding file according to the file to be synchronized.
22. An electronic device, comprising: a processor and a memory storing a computer program that, when executed, causes the electronic device to perform the method of any one of claims 1-10 or 11-13 or 14-18.
23. A storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the method of any one of claims 1-10 or 11-13 or 14-18.
CN202210605613.2A 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium Pending CN117201510A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210605613.2A CN117201510A (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium
PCT/CN2023/095772 WO2023231836A1 (en) 2022-05-30 2023-05-23 File synchronization method, apparatus, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210605613.2A CN117201510A (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117201510A true CN117201510A (en) 2023-12-08

Family

ID=89002162

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210605613.2A Pending CN117201510A (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN117201510A (en)
WO (1) WO2023231836A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103986738B (en) * 2013-02-07 2018-10-16 百度在线网络技术(北京)有限公司 A kind of synchronous method between multiple terminals and system
US8959242B1 (en) * 2014-07-02 2015-02-17 Connected Data, Inc. Method of reducing bandwidth required for sharing of files on a server
CN105933393A (en) * 2016-04-12 2016-09-07 乐视控股(北京)有限公司 Intra-local area network data synchronization method, device and user terminal
CN109358876A (en) * 2018-09-28 2019-02-19 联想(北京)有限公司 A kind of version synchronization method and device, equipment, storage medium
CN112118322B (en) * 2020-09-24 2022-08-30 杭州海康威视数字技术股份有限公司 Data synchronization method of network equipment, network equipment and system

Also Published As

Publication number Publication date
WO2023231836A1 (en) 2023-12-07

Similar Documents

Publication Publication Date Title
US11283707B2 (en) Segment routing with fast reroute for container networking
US10348556B2 (en) Method and network infrastructure for a direct public traffic connection within a datacenter
CN109728962B (en) Method and equipment for sending message
CN108632145B (en) Message forwarding method and leaf node equipment
KR20100019420A (en) Peer-to-peer collaboration system with edge routing
KR20080050973A (en) Control tunnel and direct tunnel configuration method in ipv6 service provide system based ipv4 network
US10574570B2 (en) Communication processing method and apparatus
CN107094110B (en) DHCP message forwarding method and device
US20120117246A1 (en) Method And System For The Efficient And Automated Management of Virtual Networks
CN111182022B (en) Data transmission method and device, storage medium and electronic device
CN111526223A (en) Management method of edge service server, service data processing method and device
CN112491984B (en) Container editing engine cluster management system based on virtual network bridge
US9219616B2 (en) Supporting multiple IEC-101/IEC-104 masters on an IEC-101/IEC-104 translation gateway
CN117083843A (en) Discovering hosts using multicast listener discovery
CN114640556A (en) Cross-cluster network communication system and method
CN113794618B (en) Redundant network communication method and device based on virtual network card and terminal equipment
CN115225634B (en) Data forwarding method, device and computer program product under virtual network
US9197557B2 (en) Relay server and relay communication system
CN117201510A (en) File synchronization method, device, equipment and storage medium
JP5580766B2 (en) Server apparatus, packet transmission system, packet transmission method and program
JP2011019007A (en) Method, device, system and program for avoiding network address overlap
CN108259292B (en) Method and device for establishing tunnel
US12015544B1 (en) Backup route for network devices in multihoming configuration
CN112769698B (en) Method and device for realizing routing
CN113114565B (en) Data message forwarding method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination