Method and apparatus for synchronizing files

By monitoring and synchronizing the replica files of container groups, the file preemption problem is solved, enabling efficient and secure file synchronization of container groups and reducing configuration and maintenance costs.

CN115756760BActive Publication Date: 2026-06-26CHINA TELECOM CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2022-11-30
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

When multiple container groups share files, file contention issues arise, leading to reduced container group performance and security, and increased configuration difficulty and maintenance costs for shared or distributed systems.

Method used

By monitoring copies of the same file stored locally in each of multiple container groups, synchronization is performed using a preset strategy. The monitoring directory and read/write locks are configured using CRD resources to prevent file contention, and file synchronization is performed in asynchronous or synchronous modes.

Benefits of technology

It achieves consistency of local storage files across multiple container groups, reducing development and maintenance difficulty and improving container group performance and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756760B_ABST
    Figure CN115756760B_ABST
Patent Text Reader

Abstract

The present disclosure provides a file synchronization method and device, and relates to the technical field of information. The method comprises the following steps: monitoring a copy file of a same file stored locally by each container group in a plurality of container groups, wherein each container group needs to operate on the same file during running; and if the copy file stored locally by any container group is changed, synchronizing the copy file stored locally by the plurality of container groups according to a preset strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of information technology, and in particular to a method and apparatus for synchronizing files. Background Technology

[0002] During the operation of a container group, some files need to be modified. These files are numerous, lack a unified storage structure, and are not all plaintext readable. Therefore, when multiple container groups share these files, a shared or distributed system is generally used to store and modify these files. Summary of the Invention

[0003] The inventors noted that when using shared or distributed systems to store and modify files shared by multiple container groups, contention for files exists among multiple replicas. This necessitates code to ensure normal storage and modification, and the shared or distributed system requires code to configure the mapping relationships between each file, increasing development difficulty and maintenance costs. Contention for the same file by multiple container groups degrades the performance and security of the container groups.

[0004] To address the aforementioned problems, the present disclosure proposes the following solutions.

[0005] According to one aspect of the present disclosure, a file synchronization method is provided, comprising: monitoring copies of the same file locally stored in each of a plurality of container groups, wherein each container group needs to operate on the same file during operation; if any copy of the file locally stored in any container group is changed, then synchronizing the copies of the file locally stored in the plurality of container groups according to a preset strategy.

[0006] In some embodiments, the method further includes: customizing CRD resources based on first user resources obtained when the plurality of container groups are created, determining the monitoring directory corresponding to the replica file; and registering the container identifiers of the plurality of container groups and the monitoring directory to a monitoring list.

[0007] In some embodiments, monitoring the copy files of the same file stored locally in each of the multiple container groups includes: monitoring the asynchronous wake-up events and application programming interfaces of the monitoring directory corresponding to the copy file, so as to monitor the operations performed by each container group on the locally stored copy file during operation.

[0008] In some embodiments, the method further includes: if the copy file stored locally in any container group is deleted, then the copy file in other container groups is deleted.

[0009] In some embodiments, the method further includes: in response to the destruction of any container group, deregistering the container identifier of the destroyed container group from the monitoring list.

[0010] In some embodiments, each container group operates on the locally stored copy file based on a read-write lock configured with a second CRD resource.

[0011] In some embodiments, when a process acquires a read lock on the replica file of each container group, other processes are prohibited from writing to the replica file; when a process acquires a write lock on the replica file of each container group, other processes are prohibited from reading and writing to the replica file.

[0012] In some embodiments, if the copy file stored locally in any container group changes, synchronizing the copy files stored locally in the plurality of container groups according to a preset strategy includes: if the copy file stored locally in the first container group undergoes a first change, then the synchronization is temporarily suspended; if the copy file stored locally in the second container group undergoes a second change after the first change, then the synchronization is performed.

[0013] In some embodiments, the first container group and the second container group are the same, and the synchronization is performed after a preset time following the second change.

[0014] In some embodiments, if a second change occurs to the copy file locally stored in the second container group after the first change, then performing the synchronization includes: after the first change, adding the synchronization event corresponding to the first change to a message notification queue; wherein, if the second change occurs, the synchronization event in the message notification queue is executed to achieve the synchronization.

[0015] In some embodiments, the same file is a temporary file.

[0016] According to another aspect of the present disclosure, a file synchronization apparatus is provided, comprising: a monitoring module configured to monitor copies of the same file locally stored in each of a plurality of container groups, wherein each container group needs to operate on the same file during operation; and a synchronization module configured to synchronize the copies of the same file locally stored in the plurality of container groups according to a preset strategy if any copy of the file locally stored in any container group is changed.

[0017] According to another aspect of the present disclosure, a file synchronization apparatus is provided, comprising: a memory; and a processor coupled to the memory, the processor being configured to execute the method described in any of the above embodiments based on instructions stored in the memory.

[0018] According to another aspect of the present disclosure, a computer-readable storage medium is provided, including computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method described in any of the above embodiments.

[0019] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program, when executed by a processor, implements the method described in any of the above embodiments.

[0020] In this embodiment, multiple container groups locally store copies of the same file, and synchronize these copies according to a preset strategy. During operation, each container group only needs to operate on its locally stored copies; there is no file contention between the copies, and no need to configure mapping relationships between files. This reduces development difficulty and maintenance costs, and improves the performance and security of the container groups.

[0021] The technical solutions of this disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating a file synchronization method according to some embodiments of the present disclosure;

[0024] Figure 2 This is a system logical architecture diagram of nodes including multiple container groups according to some embodiments of this disclosure;

[0025] Figure 3 This is a flowchart illustrating a method for synchronizing files according to other embodiments of this disclosure;

[0026] Figure 4 This is a schematic diagram of the structure of a document synchronization device according to some embodiments of the present disclosure;

[0027] Figure 5 This is a schematic diagram of the structure of a document synchronization device according to other embodiments of this disclosure. Detailed Implementation

[0028] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0029] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of this disclosure.

[0030] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0031] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0032] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0033] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0034] Figure 1 This is a flowchart illustrating a file synchronization method according to some embodiments of the present disclosure.

[0035] like Figure 1 As shown, the file synchronization method includes steps 102 and 104.

[0036] In step 102, the copy of the same file stored locally in each of the multiple container groups is monitored, wherein each container group needs to operate on the same file during operation.

[0037] In some embodiments, the same file is a temporary file. For example, temporary files include business-related files and intermediate files, such as statistical information, logs, temporary reports, business lists, hot update configurations, etc. Temporary files are characterized by their large number, lack of a common storage structure, and the fact that not all of them are plaintext readable, making them unsuitable for storage in databases or caches.

[0038] In step 104, if any copy file stored locally in any container group changes, the copy files stored locally in multiple container groups are synchronized according to a preset strategy.

[0039] It should be understood that after each synchronization, the copies of the files stored locally by multiple container groups are identical.

[0040] In the above embodiments, each container group only needs to operate on the locally stored copy files during operation. There is no file contention between multiple copies, and there is no need to configure the mapping relationship between each file, which reduces the difficulty of development and the cost of maintenance, and improves the performance and security of the container group.

[0041] Figure 2 This is a system logical architecture diagram of nodes including multiple container groups according to some embodiments of this disclosure.

[0042] like Figure 2 As shown, node 200 has multiple container groups that need to operate on the same file, namely container group 201, container group 202, and container group 203. Each container group has a corresponding local storage space, where container group 201 corresponds to local storage space 1, container group 202 corresponds to local storage space 2, and container group 203 corresponds to local storage space 3. Each local storage space stores a copy of the same file. Node 200 also includes host 204, on which service backend 205 is deployed.

[0043] In some implementations, the service backend executes the following: Figure 1 The file synchronization method shown.

[0044] In some embodiments, such as Figure 2 As shown, the address of each container's local storage space is mapped to a mapped storage space on host 204. For example, local storage space 1 is mapped to mapped storage space 1 on host 204, local storage space 2 is mapped to mapped storage space 2 on host 204, and local storage space 3 is mapped to mapped storage space 3 on host 204. This method allows the service backend 205 to monitor the copy files stored in the local storage space of each container group through the mapped storage space.

[0045] Figure 3 This is a flowchart illustrating a method for synchronizing files according to other embodiments of this disclosure.

[0046] In some embodiments, the file synchronization method described above further includes, for example, Figure 3 Steps 302 and 304 are shown.

[0047] In step 302, the monitoring directory corresponding to the replica file is determined based on the first CRD (Custom Resource Definition) resource obtained when multiple container groups are created.

[0048] In step 304, the container identifiers and monitoring directories of multiple container groups are registered to the monitoring list.

[0049] In Kubernetes systems, when creating a container group, users configure the monitoring directory for the replica files that need to be synchronized within the container group through CRD resources. This method eliminates the need for code implementation, making the configuration of the monitoring directory simpler and more convenient. Furthermore, when creating multiple container groups, each group has the same directory structure for the files that need to be synchronized. The same CRD declaration template can be applied to multiple CRD resources simultaneously, allowing users to configure multiple CRD resources in batches using a single template, thus improving the efficiency of monitoring directory configuration. By registering the container group's container identifier and monitoring directory to the monitoring list and granting monitoring permissions to containers in the monitoring list, the security of replica files can be improved, preventing other containers not in the monitoring list from obtaining monitoring permissions for replica files and affecting the normal operation of the containers.

[0050] In some embodiments, the file synchronization method further includes: in response to the destruction of any container group, removing the container identifier of the destroyed container group from the monitoring list. This approach further enhances the security of the copied files.

[0051] In some implementations, the destruction of any container group is detected by a plugin embedded in the container group. The plugin notifies the service backend of the node where the container group is located of the destruction of the container group, and the service backend responds to the destruction notification by deregistering the container group's container identifier from the monitoring list.

[0052] In other implementations, the service backend checks whether the container group corresponding to each container identifier in the monitoring list still exists according to a preset query cycle.

[0053] In some embodiments, step 102 includes monitoring asynchronous wake-up events of the I / O (Input / Output) of the replica files and the API (Application Programming Interface) to monitor the operations performed by each container group on the locally stored replica files during operation.

[0054] When a container group performs operations on the locally stored replica files in the monitoring directory during runtime (e.g., read operations, write operations, and creation), it triggers an asynchronous IO wake-up event. When the container group writes to the locally stored replica files, it also needs to be implemented through the API. By monitoring the asynchronous IO wake-up events of the replica files and the API, the operations performed by each container group on the locally stored replica files during runtime can be monitored without omission.

[0055] In some embodiments, the replica files in the monitoring directory are created by the container groups during runtime. When a new replica file is created locally in any container group, that replica file is synchronized to the local machines of other container groups on the same node. This method ensures the consistency of all replica files in the monitoring directory across all container groups, saves time for other container groups to create replica files themselves, and improves the efficiency of the container groups.

[0056] In other embodiments, if a copy of a file stored locally in any container group is deleted, then the copy files in other container groups are also deleted. This method allows for the quick deletion of unwanted copy files, saving local storage space within the container groups.

[0057] In some embodiments, each container group operates on a locally stored copy of the file based on a read-write lock configured by a second CRD resource. During the operation of a container group, processes within each container group may operate on the same copy of the file simultaneously. By having each container group operate on the locally stored copy of the file based on a read-write lock configured by the user through the second CRD resource, conflicts can be avoided when different processes within the same container group operate on the same copy of the file simultaneously. Using a read-write lock configured by the second CRD resource instead of implementing read-write locks in code can reduce the difficulty of configuration and the cost of maintenance.

[0058] In some embodiments, when a process acquires a read lock on a replica file of each container group, other processes are prohibited from writing to the file; when a process acquires a write lock on a replica file of each container group, other processes are prohibited from reading and writing to the replica file.

[0059] During container group operation, multiple concurrent read operations may occur on the same copy file. Read operations only retrieve data from the copy file and do not modify it. Therefore, while one process is reading from the copy file, other processes can also concurrently perform read operations on the copy file. This approach improves the data processing efficiency of the container group. Furthermore, prohibiting other processes from writing to the copy file while one process is reading from it ensures the stability of the read data. Conversely, prohibiting other processes from reading from the copy file while one process is writing to it ensures the stability of the read data, and prohibiting other processes from writing to the copy file avoids write conflicts between processes.

[0060] In some embodiments, in step 104, if any copy file stored locally in any container group changes, synchronizing the copy files stored locally in multiple container groups according to a preset strategy includes: immediately performing synchronization after any copy file stored locally in any container group changes, without waiting for other changes. This strategy is also known as synchronization mode or strong synchronization. Strong synchronization is suitable for application scenarios that require real-time synchronization of data stored in each container group. For example, if the service provided by the container group is a lottery service, using a strong synchronization strategy can quickly achieve synchronization of each copy file, ensuring the normal operation of the lottery service.

[0061] In other embodiments, if the copy file stored locally in the first container group changes in step 104, synchronization is not performed immediately; instead, it waits for the triggering condition to be met before performing synchronization. This strategy is referred to as asynchronous mode. In some embodiments, in asynchronous mode, after the first change, the synchronization event corresponding to the first change is added to the message notification queue; if a second change occurs, the synchronization event in the message notification queue is executed to achieve synchronization.

[0062] After the first change occurs, wait for the second change to occur via a message notification queue.

[0063] For example, if the copy file stored locally in the first container group undergoes a first change, synchronization will not be performed temporarily; if the copy file stored locally in the second container group undergoes a second change after the first change, synchronization will be performed.

[0064] In some embodiments, the first container group and the second container group are different. In this case, the trigger condition for synchronization is that the copy file of the second container group, which is different from the first container group, undergoes a second change. For example, according to the chronological order, if the copy file of container group 1 undergoes change 1, synchronization is not performed temporarily. Synchronization is performed when the copy file of container group 2 undergoes change 2.

[0065] For example, the first and second container groups are similar; after a second change, synchronization is performed after a preset time. For instance, in chronological order, if the copy file of container group 3 undergoes change 3, synchronization is not performed immediately, but waits for the preset time. Within this preset time, the copy file of container group 3 undergoes further changes 4 and 5, and then synchronization is performed after the preset time has elapsed.

[0066] For example, after a copy of the first container group is modified, if copies of other container groups besides the first container group are modified within a preset time, synchronization is performed; if copies of other container groups besides the first container group are not modified, synchronization is performed after the preset time. For instance, if, in chronological order, the copy file of container group 4 is modified (6), and the copy file of container group 5 is modified (7), synchronization is performed; if copies of other container groups besides container group 4 are not modified, synchronization is performed after the preset time.

[0067] Asynchronous mode is suitable for application scenarios where real-time synchronization of data stored in various container groups is not required. Examples include food ordering services and consulting services.

[0068] In some embodiments, users can select different strategies based on different application scenarios and configure preset strategies through a third-party CRD resource to achieve synchronization of replica files in multiple container groups. Configuring strategies through a third-party CRD resource simplifies the process, eliminating the need for code implementation and reducing configuration difficulty and maintenance costs.

[0069] In some implementations, the strategy is configured through a synchronization lock, which prevents other synchronization processes from synchronizing the copy file when one synchronization process acquires the synchronization lock for the copy file.

[0070] In some embodiments, in asynchronous mode, after any container group completes the modification operation on the locally stored replica file, the update time and data signature of the replica file are recorded. In asynchronous mode, the replica file is not immediately synchronized to each container group after being modified. Therefore, recording the update time and data signature of the replica file helps to identify the replica file that needs to be synchronized during synchronization, avoiding errors in replica file synchronization.

[0071] In some embodiments, a data signature refers to a set of characteristic characters or values ​​that changes when the copy file is modified. In some embodiments, the data signature includes a hash value, such as a hash value determined using hash algorithms like MD4, MD5, or SHA. The data signature allows for quick determination of whether a copy file has been modified.

[0072] In some embodiments, after each synchronization is completed, in order to facilitate comparison of each copy file during the next synchronization, the latest data feature code is generated for the synchronized copy file as the version information of the copy file, which is used to characterize the status of the copy file.

[0073] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus embodiments, since they largely correspond to the method embodiments, the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0074] Figure 4 This is a schematic diagram of the structure of a document synchronization device according to some embodiments of the present disclosure.

[0075] like Figure 4 As shown, the file synchronization device includes a monitoring module 401 and a synchronization module 402.

[0076] The monitoring module 401 is configured to monitor copies of the same file stored locally in each of multiple container groups, wherein each container group needs to operate on the same file during operation;

[0077] The synchronization module 402 is configured to synchronize the copy files stored locally in the multiple container groups according to a preset strategy if any copy file stored locally in any container group changes.

[0078] In some embodiments, the file synchronization apparatus may further include other modules to perform the file synchronization methods described in the other embodiments above.

[0079] Figure 5 This is a schematic diagram of the structure of a document synchronization device according to some embodiments of the present disclosure.

[0080] like Figure 5 As shown, the file synchronization device 500 includes a memory 501 and a processor 502 coupled to the memory 501. The processor 502 is configured to execute the method of any of the foregoing embodiments based on instructions stored in the memory 501.

[0081] The memory 501 may include, for example, system memory, fixed non-volatile storage media, etc. The system memory may store, for example, an operating system, application programs, a boot loader, and other programs.

[0082] The file synchronization device 500 may also include an input / output interface 503, a network interface 504, and a storage interface 505. These interfaces 503, 504, and 505, as well as the memory 501 and processor 502, can be connected via, for example, a bus 506. The input / output interface 503 provides a connection interface for input / output devices such as monitors, mice, keyboards, and touchscreens. The network interface 504 provides a connection interface for various networked devices. The storage interface 505 provides a connection interface for external storage devices such as SD cards and USB flash drives.

[0083] This disclosure also provides a computer-readable storage medium including computer program instructions that, when executed by a processor, implement the method of any of the above embodiments.

[0084] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the above embodiments.

[0085] The embodiments of this disclosure have now been described in detail. To avoid obscuring the concept of this disclosure, some details known in the art have not been described. Those skilled in the art can fully understand how to implement the technical solutions disclosed herein based on the above description.

[0086] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0087] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that the functions specified in one or more flowchart illustrations and / or one or more blocks in a block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate functions for implementing the functions in the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0088] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0089] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0090] While specific embodiments of this disclosure have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments or equivalent substitutions can be made to some technical features without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.

Claims

1. A file synchronization method, comprising: Based on the first user resources obtained when multiple container groups are created, customize the CRD resources and determine the monitoring directory corresponding to the copy file of the same file stored locally in each of the multiple container groups; Register the container identifiers of the multiple container groups and the monitoring directory to the monitoring list; Monitor copies of the same file stored locally in each of multiple container groups, where each container group needs to operate on the same file during operation; If any of the replica files stored locally in any container group changes, the replica files stored locally in all the container groups will be synchronized according to a preset strategy. The monitoring of copies of the same file stored locally in each of multiple container groups includes: monitoring asynchronous wake-up events and application programming interfaces (APIs) of the input / output of the monitoring directory corresponding to the copy file, in order to monitor the operations performed by each container group on the locally stored copy file during operation. Specifically, if any of the replica files stored locally in any container group changes, then synchronizing the replica files stored locally in the multiple container groups according to a preset strategy includes: if the replica file stored locally in the first container group undergoes a first change, then the synchronization is temporarily suspended; if the replica file stored locally in the second container group undergoes a second change after the first change, then the synchronization is performed.

2. The method according to claim 1, further comprising: If the copy file stored locally in any container group is deleted, then the copy files in the other container groups are deleted.

3. The method according to claim 1, further comprising: In response to the destruction of any container group, the container identifier of the destroyed container group is removed from the monitoring list.

4. The method according to claim 1, wherein, Each container group operates on the locally stored copy of the file based on the read-write lock configured in the second CRD resource.

5. The method according to claim 4, wherein: When a process acquires a read lock on the replica file of each container group, other processes are prohibited from writing to the replica file. When a process acquires a write lock on the copy file of each container group, other processes are prohibited from reading or writing to the copy file.

6. The method according to claim 1, wherein, The first container group and the second container group are the same, and the synchronization is performed after a preset time following the second change.

7. The method according to claim 1, wherein, If the copy file stored locally in the second container group undergoes a second change after the first change, then performing the synchronization includes: After the first change, the synchronization event corresponding to the first change is added to the message notification queue; If the second change occurs, the synchronization event in the message notification queue is executed to achieve the synchronization.

8. The method according to any one of claims 1-7, wherein, The same file mentioned is a temporary file.

9. A file synchronization device, comprising: The monitoring module is configured to monitor copies of the same file stored locally in each of multiple container groups, wherein each container group needs to operate on the same file during operation; The synchronization module is configured to synchronize the replica files stored locally in the multiple container groups according to a preset strategy if any replica file stored locally in any container group changes. The synchronization device is configured to: customize CRD resources based on first user resources obtained when multiple container groups are created; determine the monitoring directory corresponding to the copy file of the same file stored locally in each of the multiple container groups; and register the container identifiers of the multiple container groups and the monitoring directory to the monitoring list. The monitoring of copies of the same file stored locally in each of multiple container groups includes: monitoring asynchronous wake-up events and application programming interfaces (APIs) of the input / output of the monitoring directory corresponding to the copy file, in order to monitor the operations performed by each container group on the locally stored copy file during operation. If any of the copy files stored locally in any container group changes, then synchronizing the copy files stored locally in the multiple container groups according to a preset strategy includes: if the copy file stored locally in the first container group undergoes a first change, then the synchronization is temporarily suspended; if the copy file stored locally in the second container group undergoes a second change after the first change, then the synchronization is performed.

10. A file synchronization device, comprising: Memory; as well as A processor coupled to the memory is configured to execute the method of any one of claims 1-8 based on instructions stored in the memory.

11. A computer-readable storage medium comprising computer program instructions, wherein, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1-8.

12. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method described in any one of claims 1-8.