CN112559469A - Data synchronization method and device - Google Patents

Data synchronization method and device Download PDF

Info

Publication number
CN112559469A
CN112559469A CN202011108963.5A CN202011108963A CN112559469A CN 112559469 A CN112559469 A CN 112559469A CN 202011108963 A CN202011108963 A CN 202011108963A CN 112559469 A CN112559469 A CN 112559469A
Authority
CN
China
Prior art keywords
data
synchronized
file
processed
folder
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
CN202011108963.5A
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.)
Wuhan Zhongke Tongda High New Technology Co Ltd
Original Assignee
Wuhan Zhongke Tongda High New Technology 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 Wuhan Zhongke Tongda High New Technology Co Ltd filed Critical Wuhan Zhongke Tongda High New Technology Co Ltd
Priority to CN202011108963.5A priority Critical patent/CN112559469A/en
Publication of CN112559469A publication Critical patent/CN112559469A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion

Abstract

The embodiment of the application provides a data synchronization method and a data synchronization device, which obtain files to be synchronized by processing data to be synchronized carrying different purpose identifiers, and by matching the file identification of the file to be synchronized with the purpose identification, the file content of the file to be synchronized is matched with the data to be synchronized, so that different data to be synchronized correspond to files to be synchronized in a uniform format, only one boundary equipment transfer strategy needs to be configured, the files to be synchronized with different file identifications can be transferred from a first folder of a first network to a second folder of a second network, and the data to be processed corresponding to each file to be processed is obtained by processing the files to be processed in the second folder, and storing the data to be processed into a service data folder corresponding to service usage according to the usage identifier of the data to be processed, so that different data to be processed can be distinguished and processed well.

Description

Data synchronization method and device
Technical Field
The application relates to the related technical field of security data processing, in particular to a data synchronization method and device.
Background
The existing network is developed, which also causes various insecure factors of hacking in the network, and the data is core content of enterprises and users, and in order to protect the security of the data, and not be attacked and leaked by various illegal steals, some network strategies, physical isolation and other ways are used to avoid external attacks. In the security system, an internal network of the security system is isolated from an external network such as the internet, and some related information data are collected through the external network and then transmitted to the internal network of the security system through the boundary equipment.
At present, boundary equipment transfer strategies need to be set for different types of information data for multiple times, the information data are transferred to an intranet of a security system to process files and corresponding service data, the service data of different service types need to be repeatedly executed, resource waste is caused, problems are difficult to eliminate, in addition, the boundary equipment and the boundary equipment transfer strategies are both developed and manufactured by an external manufacturer, when new service data of new service types are added, the boundary equipment transfer strategies need to be set by the external manufacturer, and the process is complex.
Disclosure of Invention
The embodiment of the application provides a data synchronization method and device, which are used for solving the technical problems that a transfer strategy of boundary equipment needs to be set for multiple times aiming at different types of information data, the process is complicated, and resource waste is caused.
An embodiment of the present application provides a data synchronization method, including:
acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifications, and the data to be synchronized of different service purposes correspond to different purpose identifications;
processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized;
copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed;
processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized;
and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
In the data synchronization method provided in this embodiment, before the step of acquiring data to be synchronized for at least two service purposes, the method further includes:
configuring a first folder located in the first network and a second folder located in the second network, and binding the first folder and the second folder.
In the data synchronization method provided in the embodiment of the present application, the step of processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized in a first folder located in a first network includes:
writing the data to be synchronized into the file to be synchronized according to a preset content format according to the purpose identification and the data content of the data to be synchronized;
generating a file identifier of the file to be synchronized according to the purpose identifier of the data to be synchronized;
and storing the file to be synchronized to a first folder located in a first network.
In the data synchronization method provided in the embodiment of the present application, the step of storing the file to be synchronized in a first folder located in the first network includes:
adding the file to be synchronized into a cache queue;
setting a first absolute time node and a first period, and judging whether the difference value between the first absolute time node and the current time node is an integral multiple of the first period;
when the difference value between the first absolute time node and the current time node is an integral multiple of the first period, copying the files to be synchronized in the cache queue to a first folder located in the first network, and deleting the files to be synchronized in the cache queue.
In the data synchronization method provided in the embodiment of the present application, before the step of determining whether the difference between the first absolute time node and the current time node is an integer multiple of the first period, the method further includes:
judging whether the file size of the file to be synchronized in the cache queue is larger than a set threshold value or not;
when the file size of the file to be synchronized in the cache queue is larger than the set threshold value, copying the file to be synchronized in the cache queue to a first folder located in the first network, and deleting the file to be synchronized in the cache queue.
In the data synchronization method provided in the embodiment of the present application, the step of adding the file to be synchronized to a cache queue includes:
and adding the files to be synchronized into a cache queue according to the time sequence generated by each file to be synchronized, wherein different files to be synchronized correspond to different file identifications.
In the data synchronization method provided in the embodiment of the present application, the step of copying the file to be synchronized in the first folder to a second folder located in a second network to obtain a file to be processed includes:
setting a second absolute time node and a second period, and judging whether the difference value between the second absolute time node and the current time node is an integral multiple of the second period;
when the difference value between the second absolute time node and the current time node is an integral multiple of the second period, copying the file to be synchronized in the first folder to a second folder located in a second network to obtain a file to be processed, and deleting the file to be synchronized in the first folder.
In the data synchronization method provided in the embodiment of the present application, the step of processing the files to be processed in the second folder to obtain the data to be processed corresponding to each file to be processed includes:
setting a third absolute time node and a third period, and judging whether the difference value between the third absolute time node and the current time node is an integral multiple of the third period;
when the difference value between the third absolute time node and the current time node is an integral multiple of the third period, analyzing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized.
The present application further provides a data synchronization apparatus, including:
the data acquisition unit is used for acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifiers, and the data to be synchronized of different service purposes correspond to different purpose identifiers;
the data preprocessing unit is used for processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized;
the boundary data transfer unit is used for copying the files to be synchronized in the first folder to a second folder located in a second network to obtain the files to be processed;
the data analysis unit is used for processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, and the data to be processed is matched with the purpose identification and the data content of the data to be synchronized;
and the service distribution unit is used for storing the data to be processed into service data folders corresponding to service purposes according to the purpose identifiers of the data to be processed, and different service data correspond to different service data folders.
In the data synchronization apparatus provided in the embodiment of the present application, the boundary data transfer unit is further configured to configure a first folder located in the first network and a second folder located in the second network, and bind the first folder and the second folder.
The application also provides an electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to execute the application program in the memory to perform any one of the operations in the front-end device control method.
Has the advantages that: the embodiment of the application provides a data synchronization method and a data synchronization device, wherein the data synchronization method firstly acquires data to be synchronized of at least two service purposes, the data to be synchronized carries purpose identifiers, and the data to be synchronized of different service purposes correspond to different purpose identifiers; then processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized; then copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed; then processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized; and finally, storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders. The embodiment of the application obtains the files to be synchronized by processing the data to be synchronized carrying different purpose identifiers, and by matching the file identification of the file to be synchronized with the purpose identification, the file content of the file to be synchronized is matched with the data to be synchronized, so that different data to be synchronized correspond to files to be synchronized in a uniform format, only one boundary equipment transfer strategy needs to be configured, the files to be synchronized with different file identifications can be transferred from a first folder of a first network to a second folder of a second network, and the data to be processed corresponding to each file to be processed is obtained by processing the files to be processed in the second folder, and storing the data to be processed into a service data folder corresponding to service usage according to the usage identifier of the data to be processed, so that different data to be processed can be distinguished and processed well.
Drawings
The technical solution and other advantages of the present application will become apparent from the detailed description of the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a networking schematic diagram of a security system provided in an embodiment of the present application.
Fig. 2 is a schematic flowchart of a data synchronization method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of mapping relationships corresponding to different identifiers carrying different uses for different data to be synchronized in the data synchronization method provided in the embodiment of the present application.
Fig. 4 is a schematic diagram of a mapping relationship between data to be synchronized and an identifier and content of a file to be synchronized in the data synchronization method provided in the embodiment of the present application.
Fig. 5 is a logic block diagram of copying a file to be synchronized in a cache queue to a first folder in the data synchronization method according to the embodiment of the present application.
Fig. 6 is a schematic diagram illustrating that, in the data synchronization method provided in the embodiment of the present application, data to be processed is stored in a service data folder corresponding to a service use according to a use identifier of the data to be processed.
Fig. 7 is another schematic flow chart of a data synchronization method according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of a data server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic networking diagram of a security system provided in an embodiment of the present application, where the system may include a device and a server, and the device and the server may be connected for communication through an internet formed by various gateways and the like, where the device includes a front-end device 11 and the like, the server includes a data server 12 and a communication server, and the communication server is not shown in fig. 1, where:
the front-end device 11 may be applied to a scene of an intelligent community, including but not limited to an embedded high-definition camera, an industrial personal computer, a high-definition camera, and the like, and is configured to perform data acquisition on vehicles and pedestrians passing through the front-end device, where the data acquisition includes but not limited to information on a license plate number (the number may be a fake plate or a fake plate), a license plate type (a blue-bottom license plate of a private car, a yellow-bottom license plate of a truck, and the like), face data of the pedestrian, community information, building information, device information, resident information, a network appointment, a rental car, and the like.
The server includes a local server and/or a remote server, etc. The data server 12 and the communication server may be deployed on local servers, or may be partially or wholly deployed on remote servers.
The data server 12 may obtain data to be synchronized for at least two service purposes, where the data to be synchronized carries a purpose identifier, and the data to be synchronized for different service purposes correspond to different purpose identifiers; processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized; copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed; processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized; and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
It should be noted that the system scenario diagram shown in fig. 1 is only an example, and the server and the scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation on the technical solution provided in the embodiment of the present application, and as a person having ordinary skill in the art knows, with the evolution of the system and the occurrence of a new service scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems. The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
Fig. 2 is a schematic flow chart of a data synchronization method according to an embodiment of the present application, please refer to fig. 2, in which the data synchronization method includes the following steps:
201: the method comprises the steps of obtaining data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifications, and the data to be synchronized of different service purposes correspond to different purpose identifications.
In an embodiment, the obtaining of the data to be synchronized for at least two service purposes includes that the data server receives data to be synchronized, which is uploaded by at least one front-end device and includes multiple service purposes, such as video streams or pictures, the mode of specifically obtaining the data to be synchronized may also be a mode of acquiring data through the internet, the data server provides an http interface, the front-end device may push the data for different service purposes to the http interface at regular time, the data server may obtain the data to be synchronized through an http active pull mode, and of course, the mode of specifically obtaining the data to be synchronized may also be a mode of interacting other information, which is not described herein again.
In an embodiment, different data to be synchronized adopt a uniformly set data format, and in the process of acquiring the data to be synchronized, the method further includes a step of processing original service data with different usages acquired by, for example, a front-end device, so as to acquire the data to be synchronized, where the original service data carries a usage identifier, the original service data with different service usages corresponds to different usage identifiers, and the usage identifier and the data content of the original service data and the data to be synchronized are matched, specifically, the step of processing the original service data so as to acquire the data to be synchronized includes: the original business data is encapsulated into a uniform format such as a json format to obtain data to be synchronized in the json format, a key value of the data to be synchronized in the json format at least includes a use identifier of the original business data, a value of the data to be synchronized in the json format may include data content of the original business data, the data to be synchronized may use the key value as the use identifier of the data to be synchronized, the data to be synchronized may use the value as the data content of the data to be synchronized, obviously, the use identifiers of different data to be synchronized are different, it is understood that json (JavaScript Object Notation, JS Object Notation) is a lightweight data exchange format, the step of processing the original business data to obtain the data to be synchronized may be completed in a front-end device or in a data server, and are not intended to be limiting herein.
In an embodiment, as shown in fig. 3, in a specific application scenario such as an intelligent cell, the data to be synchronized may be divided according to service usage, and the data to be synchronized may include at least functional service data and basic service data, and the usage identifier of the functional service data and the usage identifier of the basic service data may include different data classification codes to distinguish, for example: the functional service data may be information such as face information and motor vehicle information that can be further used for recognition or analysis, the corresponding data classification code may include face or vecile identifiers, the basic service data may be conventional information such as cell information, building information, device information, household information, and the like, the corresponding data classification code may include base identifiers, and further, the use identifiers of a plurality of the functional service data or a plurality of the basic service data may further include different unit codes for differentiation, for example, the use identifier of the functional service data and the use identifier of the basic service data may further include different unit features such as different manufacturers, devices, cells, communities, or time periods, and may have different unit codes; of course, other distinguishing forms are also possible, and are not described in detail herein.
It should be noted that, after the step of obtaining the data to be synchronized for at least two service purposes, the method further includes adding the obtained data to be synchronized into a data cache queue, specifically, the data cache queue is implemented by a ConcurrentHashMap, where the ConcurrentHashMap is a concurrent hash mapping table, which allows completely concurrent reading and supports a given number of concurrent updates, ensures the security and real-time performance of threads, and prevents asynchronous receiving data and consuming data when the data amount is excessive, and further, the method may also periodically traverse the data cache queue to process the data to be synchronized in the data cache queue to obtain the file to be synchronized.
The data acquisition mode and the data processing mode adopted in the embodiment of the application are used for explaining the implementation process of the scheme of the application, the setting mode is not used for limiting the specific implementation mode of the application, and the data acquisition and processing mode can be selected according to the actual use condition in the actual data acquisition and processing process.
202: and processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized.
In an embodiment, it can be understood that, the data to be synchronized is processed to obtain files to be synchronized, each of the data to be synchronized corresponds to a file to be synchronized, the file identifier of the file to be synchronized matches the application identifier, and the file content of the file to be synchronized matches the data to be synchronized, it can be understood that the file identifier of the file to be synchronized at least includes a data classification code in the application identifier, specifically, the data classification code may be a field such as face, vecile, base and the like in the foregoing embodiment, obviously, by matching the file identifier of the file to be synchronized with the application identifier, the file content of the file to be synchronized matches the data to be synchronized, so as to distinguish the service applications of different files through the file identifiers of the files to be synchronized, without considering the problem of distinguishing the data to be synchronized or the files to be synchronized for different service applications, so that different files to be synchronized can be uniformly stored in the first folder located in the first network.
In one embodiment, specifically, the data to be synchronized is processed to obtain a file to be synchronized and stored in a first folder located in a first network, a file identifier of the file to be synchronized is matched with the application identifier, and in the step of matching the file content of the file to be synchronized with the data to be synchronized, the data to be synchronized can be written into the file to be synchronized according to the application identifier and the data content of the data to be synchronized and according to a preset content format, and the file identifier of the file to be synchronized is generated according to the application identifier of the data to be synchronized, so that the file identifier of the file to be synchronized is matched with the application identifier, and the file content of the file to be synchronized is matched with the data to be synchronized; so that different files to be synchronized have uniform file identification and file content formats.
Based on the foregoing uniform packaging of the data to be synchronized into a json format, as shown in fig. 4, it should be noted that, first, a file identifier of the file to be synchronized is generated according to a use identifier of the data to be synchronized, that is, it can be understood that the file identifier of the file to be synchronized is generated according to a key value of the data to be synchronized, for example, a format of the file identifier of the file to be synchronized may be "key _ timestamp. txt", where a timestamp may be a time when the file to be synchronized is generated; then, the data to be synchronized is written into the file to be synchronized according to the purpose identifier and the data content of the data to be synchronized according to a preset content format, that is, the data to be synchronized is written into the file to be synchronized according to a key value and a value of the data to be synchronized according to a preset content format, where the preset content format may be a combination of the key value and the value, for example, the preset content format may be a first behavior of the key value and a second behavior of the value, and may specifically be other combination forms, which is not limited herein.
In an embodiment, as shown in fig. 5, the step of storing the file to be synchronized to a first folder located in the first network includes: adding the file to be synchronized into a cache queue; setting a first absolute time node and a first period, and judging whether the difference value between the first absolute time node and the current time node is an integral multiple of the first period; when the difference value between the first absolute time node and the current time node is an integral multiple of the first period, copying the files to be synchronized in the cache queue to a first folder located in the first network, and deleting the files to be synchronized in the cache queue; by adding the files to be synchronized into the buffer queue and then writing the files to be synchronized into the first folder of the first network at regular time, all the files to be synchronized generated in one first period can be written into the first folder of the first network at one time, the situation that the files to be synchronized are written into the first folder of the first network once every time one file to be synchronized is generated is avoided, and the repeated writing operation times can be greatly reduced.
It should be noted that the current time node is the local time of the server, for example, if the server is set in a place where the beijing time is adopted, the current time is the beijing time, and the server can periodically update the local time through the beijing system to ensure the time accuracy.
In an embodiment, the step of adding the files to be synchronized to a buffer queue includes adding the files to be synchronized to the buffer queue according to a time sequence generated by each file to be synchronized, where different files to be synchronized correspond to different file identifiers; it can be understood that, as described in the foregoing embodiment, the files to be synchronized for different service purposes may be classified and encoded into service purposes by the data in the file identifier, and the files to be synchronized for the same service purpose may also be further classified by the unit code in the file identifier.
In an embodiment, as shown in fig. 5, before the step of determining whether the difference between the first absolute time node and the current time node is an integer multiple of the first period, the method further includes determining whether the file size of the file to be synchronized in the cache queue is greater than a set threshold; when the file size of the file to be synchronized in the cache queue is larger than the set threshold value, copying the file to be synchronized in the cache queue to a first folder located in the first network, and deleting the file to be synchronized in the cache queue; it can be understood that, when the file size of the file to be synchronized in the cache queue is smaller than or equal to the set threshold, it is further determined whether the difference between the first absolute time node and the current time node is an integer multiple of the first period; when the size of the file to be synchronized in the cache queue is larger than the set threshold value, the file to be synchronized in the cache queue is directly copied to a first folder located in the first network, so that data jam or file loss caused by the fact that the file to be synchronized written into the first folder of the first network at one time is too large is avoided.
203: copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed;
in an embodiment, the first folder of the first network and the second folder of the second network are associated with each other through configuration of a boundary device transfer policy, in this embodiment, the first network may be the internet, and the second network may be a video network in a security system, and the file to be synchronized in the first folder is copied to the second folder in the second network to obtain a file to be processed, in this embodiment, the file to be synchronized is transferred from the internet to the video network.
In an embodiment, the step of copying the file to be synchronized in the first folder to a second folder located in a second network to obtain the file to be processed includes setting a second absolute time node and a second period, and determining whether a difference between the second absolute time node and a current time node is an integer multiple of the second period; when the difference value between the second absolute time node and the current time node is an integral multiple of the second period, copying the file to be synchronized in the first folder to a second folder located in a second network to obtain a file to be processed, and deleting the file to be synchronized in the first folder. Namely, the second period is used as a period time, the first folder of the first network is periodically traversed, the file to be synchronized in the first folder is copied to the second folder located in the second network, the file to be processed is obtained, and the file to be synchronized in the first folder is deleted.
204: processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized;
it should be noted that, in this embodiment, the files to be processed in the second folder may be processed in an analytic manner, so as to obtain the data to be processed corresponding to each file to be processed, where the data to be processed matches the purpose identifier and the data content of the data to be synchronized, it may be understood that the data to be processed obtained after the analysis may be in the aforementioned encapsulated json format, and the data to be processed in the json format matches the purpose identifier and the data content of the data to be synchronized in the json format, that is, the key value of the data to be synchronized and the key value of the data to be processed at least include the same purpose identifier, and the value of the data to be synchronized and the value of the data to be processed at least include the same data content.
In an embodiment, the step of processing the files to be processed in the second folder to obtain the data to be processed corresponding to each file to be processed includes setting a third absolute time node and a third period, and determining whether a difference between the third absolute time node and a current time node is an integral multiple of the third period; when the difference value between the third absolute time node and the current time node is an integral multiple of the third period, analyzing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized. It can be understood that, with the third period as a period, the files to be processed in the second folder are periodically processed, specifically, the files to be processed in the second folder may be periodically downloaded, and then each file to be processed is analyzed to obtain corresponding data to be processed.
205: and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
It can be understood that the data to be processed is stored in the service data folder corresponding to the service usage according to the usage identifier of the data to be processed, that is, the service usage of the data to be processed is identified according to the key value of the data to be processed, and the data to be processed is stored in the corresponding service data folder, it is worth mentioning that different service data correspond to different service data folders, so that the data to be processed with different service usages are stored in the service data folder corresponding to the service usage in a classified manner.
In an embodiment, as shown in fig. 6, when the key value of the to-be-processed data includes a data classification code of a field such as face or vecile, it may be determined that the to-be-processed data is functional service data, and the functional type of the to-be-processed data is human face data or vehicle data, such data may be used for further information identification or other functional purposes, at this time, the to-be-processed data may be stored in a functional service data folder, for example, the to-be-processed data may be packaged and then sent to a kafka message queue, so as to be conveniently provided for other service systems. In addition, when the key value of the to-be-processed data includes a data classification code of a field such as base, it may be determined that the to-be-processed data is basic service data, and at this time, the to-be-processed data may be stored in a basic service data folder.
The embodiment provides a data synchronization method, which obtains files to be synchronized by processing data to be synchronized carrying different purpose identifiers, and by matching the file identification of the file to be synchronized with the purpose identification, the file content of the file to be synchronized is matched with the data to be synchronized, so that different data to be synchronized correspond to files to be synchronized in a uniform format, only one boundary equipment transfer strategy needs to be configured, the files to be synchronized with different file identifications can be transferred from a first folder of a first network to a second folder of a second network, and the data to be processed corresponding to each file to be processed is obtained by processing the files to be processed in the second folder, and storing the data to be processed into a service data folder corresponding to service usage according to the usage identifier of the data to be processed, so that different data to be processed can be distinguished and processed well.
It should be noted that, as shown in fig. 7, in an embodiment, before the step of acquiring data to be synchronized for at least two service purposes, the method further includes:
200: configuring a first folder located in the first network and a second folder located in the second network, and binding the first folder and the second folder.
It should be noted that, specifically, the step of configuring the first folder of the first network and the second folder located in the second network to make the first folder and the second folder associated with each other, that is, configuring the border device transfer policy, may include: configuring an access port between a server and the first network, and then configuring a first folder located in the first network and a second folder located in the second network, wherein the first folder and the second folder are associated with each other, that is, the first network and the second network interact with each other only through the configured first folder and the second folder which are associated with each other; namely, physical isolation of a first network from a second network is realized, specifically, a first folder located in the first network and a second folder located in the second network are configured, and the step of binding the first folder and the second folder is located before acquiring the data to be synchronized for at least two service purposes, the method only needs to configure the boundary device transfer strategy once, does not need to repeatedly configure the boundary device transfer strategy for a plurality of times according to different service configurations of the data, when new data with different service purposes is added, the transfer strategy of the boundary equipment does not need to be repeatedly configured, the first network may be the internet, the second network may be a video network in a security system, and the file to be synchronized in the first folder is copied to the second folder located in the second network to obtain the file to be processed.
Correspondingly, the present application further provides a data synchronization apparatus, and fig. 8 is a schematic structural diagram of the data synchronization apparatus provided in the embodiment of the present application; referring to fig. 8, the data synchronization apparatus includes the following modules:
a data obtaining unit 801, configured to obtain data to be synchronized for at least two service purposes, where the data to be synchronized carries a purpose identifier, and the data to be synchronized for different service purposes correspond to different purpose identifiers;
a data preprocessing unit 802, configured to process the data to be synchronized to obtain a file to be synchronized, and store the file to be synchronized in a first folder in a first network, where a file identifier of the file to be synchronized matches the application identifier, and a file content of the file to be synchronized matches the data to be synchronized;
a boundary data transfer unit 803, configured to copy the file to be synchronized in the first folder to a second folder located in a second network, so as to obtain a file to be processed;
the data analysis unit 804 is configured to process the files to be processed in the second folder to obtain data to be processed corresponding to each file to be processed, where the data to be processed matches with the usage identifier and the data content of the data to be synchronized;
and a service allocation unit 805, configured to store the to-be-processed data in a service data folder corresponding to a service purpose according to the purpose identifier of the to-be-processed data, where different service data correspond to different service data folders.
In an embodiment, the boundary data transfer unit 803 is further configured to configure a first folder located in the first network and a second folder located in the second network, and bind the first folder and the second folder.
In an embodiment, the data preprocessing unit 802 includes a data converting unit, a caching unit, a first timing unit, and a detecting unit, where the data converting unit is configured to write the data to be synchronized into the file to be synchronized according to a preset content format according to the purpose identifier and the data content of the data to be synchronized, and generate the file identifier of the file to be synchronized according to the purpose identifier of the data to be synchronized, so that the file identifier of the file to be synchronized matches with the purpose identifier, and the file content of the file to be synchronized matches with the data to be synchronized; the cache unit is used for adding the file to be synchronized into a cache queue; the first timing unit is used for setting a first absolute time node and a first period and judging whether the difference value between the first absolute time node and the current time node is an integral multiple of the first period or not; when the difference value between the first absolute time node and the current time node is an integral multiple of the first period, copying the files to be synchronized in the cache queue to a first folder located in the first network, and deleting the files to be synchronized in the cache queue. The detection unit is used for judging whether the file size of the file to be synchronized in the cache queue is larger than a set threshold value or not; when the file size of the file to be synchronized in the cache queue is larger than the set threshold value, copying the file to be synchronized in the cache queue to a first folder located in the first network, and deleting the file to be synchronized in the cache queue.
In an embodiment, the cache unit is configured to add the files to be synchronized to a cache queue according to a time sequence generated by each file to be synchronized, where different files to be synchronized correspond to different file identifiers.
The data synchronization device further comprises a second timing unit and a third timing unit, wherein the second timing unit is used for setting a second absolute time node and a second period, and judging whether the difference value between the second absolute time node and the current time node is an integral multiple of the second period; when the difference value between the second absolute time node and the current time node is an integral multiple of the second period, copying the file to be synchronized in the first folder to a second folder located in a second network to obtain a file to be processed, and deleting the file to be synchronized in the first folder. The third timing unit is used for setting a third absolute time node and a third period, and judging whether the difference value between the third absolute time node and the current time node is an integral multiple of the third period; when the difference value between the third absolute time node and the current time node is an integral multiple of the third period, analyzing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized.
Accordingly, an embodiment of the present application further provides a data server, as shown in fig. 9, the data server may include Radio Frequency (RF) circuit 901, memory 902 including one or more computer-readable storage media, input unit 903, display unit 904, sensor 905, audio circuit 906, Wireless Fidelity (WiFi) module 907, processor 908 including one or more processing cores, and power supply 909. Those skilled in the art will appreciate that the data server architecture shown in FIG. 9 does not constitute a limitation of data servers and may include more or fewer components than shown, or some combination of components, or a different arrangement of components. Wherein:
RF circuit 901 may be used for receiving and transmitting signals during a message transmission or communication process, and in particular, for receiving downlink information from a base station and then processing the received downlink information by one or more processors 908; in addition, data relating to uplink is transmitted to the base station. The memory 902 may be used to store software programs and modules, and the processor 908 executes various functional applications and data processing by operating the software programs and modules stored in the memory 902. The input unit 903 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
The display unit 904 may be used to display information input by or provided to the user and various graphical user interfaces of the server, which may be made up of graphics, text, icons, video, and any combination thereof.
The data server may also include at least one sensor 905, such as light sensors, motion sensors, and other sensors. The audio circuitry 906 includes speakers that can provide an audio interface between the user and the data server.
WiFi belongs to short distance wireless transmission technology, and the data server can help the user send and receive e-mail, browse web page and access streaming media etc. through WiFi module 907, which provides wireless broadband internet access for the user. Although fig. 9 shows the WiFi module 907, it is understood that it does not belong to the essential constitution of the data server, and may be omitted entirely as needed within the scope of not changing the essence of the application.
The processor 908 is the control center of the data server, connects various parts of the entire handset using various interfaces and lines, and performs various functions of the data server and processes data by running or executing software programs and/or modules stored in the memory 902 and calling data stored in the memory 902, thereby performing overall monitoring of the handset.
The data server also includes a power supply 909 (such as a battery) that provides power to the various components, which may preferably be logically connected to the processor 908 via a power management system, such that the functions of managing charging, discharging, and power consumption are performed via the power management system.
Although not shown, the data server may further include a camera, a bluetooth module, and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 908 in the data server loads the executable file corresponding to the process of one or more application programs into the memory 902 according to the following instructions, and the processor 908 runs the application program stored in the memory 902, so as to implement the following functions:
acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifications, and the data to be synchronized of different service purposes correspond to different purpose identifications; processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized; copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed; processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized; and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed description, and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to implement the following functions:
acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifications, and the data to be synchronized of different service purposes correspond to different purpose identifications; processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized; copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed; processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized; and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any method provided in the embodiments of the present application, the beneficial effects that can be achieved by any method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The data synchronization method and apparatus, the data server, and the computer-readable storage medium provided in the embodiments of the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation manner of the present application, and the description of the embodiments is only used to help understand the technical solution and the core idea of the present application; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (10)

1. A method of data synchronization, comprising:
acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifications, and the data to be synchronized of different service purposes correspond to different purpose identifications;
processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized;
copying the files to be synchronized in the first folder to a second folder located in a second network to obtain files to be processed;
processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized;
and storing the data to be processed into service data folders corresponding to service purposes according to the purpose identification of the data to be processed, wherein different service data correspond to different service data folders.
2. The data synchronization method of claim 1, wherein the step of obtaining the data to be synchronized for at least two service purposes is preceded by the steps of:
configuring a first folder located in the first network and a second folder located in the second network, and binding the first folder and the second folder.
3. The data synchronization method of claim 1, wherein the step of processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized in a first folder located in a first network comprises:
writing the data to be synchronized into the file to be synchronized according to a preset content format according to the purpose identification and the data content of the data to be synchronized;
generating a file identifier of the file to be synchronized according to the purpose identifier of the data to be synchronized;
and storing the file to be synchronized to a first folder located in a first network.
4. The data synchronization method of claim 3, wherein the step of storing the file to be synchronized to a first folder located in the first network comprises:
adding the file to be synchronized into a cache queue;
setting a first absolute time node and a first period, and judging whether the difference value between the first absolute time node and the current time node is an integral multiple of the first period;
when the difference value between the first absolute time node and the current time node is an integral multiple of the first period, copying the files to be synchronized in the cache queue to a first folder located in the first network, and deleting the files to be synchronized in the cache queue.
5. The data synchronization method according to claim 4, wherein before the step of determining whether the difference between the first absolute time node and the current time node is an integer multiple of the first period, further comprising:
judging whether the file size of the file to be synchronized in the cache queue is larger than a set threshold value or not;
when the file size of the file to be synchronized in the cache queue is larger than the set threshold value, copying the file to be synchronized in the cache queue to a first folder located in the first network, and deleting the file to be synchronized in the cache queue.
6. The data synchronization method of claim 4, wherein the step of adding the file to be synchronized to a buffer queue comprises:
and adding the files to be synchronized into a cache queue according to the time sequence generated by each file to be synchronized, wherein different files to be synchronized correspond to different file identifications.
7. The data synchronization method of claim 1, wherein the step of copying the file to be synchronized in the first folder to a second folder located in a second network to obtain the file to be processed comprises:
setting a second absolute time node and a second period, and judging whether the difference value between the second absolute time node and the current time node is an integral multiple of the second period;
when the difference value between the second absolute time node and the current time node is an integral multiple of the second period, copying the file to be synchronized in the first folder to a second folder located in a second network to obtain a file to be processed, and deleting the file to be synchronized in the first folder.
8. The data synchronization method according to claim 1, wherein the step of processing the files to be processed in the second folder to obtain the data to be processed corresponding to each file to be processed comprises:
setting a third absolute time node and a third period, and judging whether the difference value between the third absolute time node and the current time node is an integral multiple of the third period;
when the difference value between the third absolute time node and the current time node is an integral multiple of the third period, analyzing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, wherein the data to be processed is matched with the purpose identification and the data content of the data to be synchronized.
9. A data synchronization apparatus, comprising:
the data acquisition unit is used for acquiring data to be synchronized of at least two service purposes, wherein the data to be synchronized carries purpose identifiers, and the data to be synchronized of different service purposes correspond to different purpose identifiers;
the data preprocessing unit is used for processing the data to be synchronized to obtain a file to be synchronized and storing the file to be synchronized to a first folder located in a first network, wherein the file identification of the file to be synchronized is matched with the application identification, and the file content of the file to be synchronized is matched with the data to be synchronized;
the boundary data transfer unit is used for copying the files to be synchronized in the first folder to a second folder located in a second network to obtain the files to be processed;
the data analysis unit is used for processing the files to be processed in the second folder to obtain data to be processed corresponding to the files to be processed, and the data to be processed is matched with the purpose identification and the data content of the data to be synchronized;
and the service distribution unit is used for storing the data to be processed into service data folders corresponding to service purposes according to the purpose identifiers of the data to be processed, and different service data correspond to different service data folders.
10. The data synchronization apparatus of claim 9, wherein the boundary data transfer unit is further configured to configure a first folder located in the first network and a second folder located in the second network, and bind the first folder and the second folder.
CN202011108963.5A 2020-10-16 2020-10-16 Data synchronization method and device Pending CN112559469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011108963.5A CN112559469A (en) 2020-10-16 2020-10-16 Data synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011108963.5A CN112559469A (en) 2020-10-16 2020-10-16 Data synchronization method and device

Publications (1)

Publication Number Publication Date
CN112559469A true CN112559469A (en) 2021-03-26

Family

ID=75042817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011108963.5A Pending CN112559469A (en) 2020-10-16 2020-10-16 Data synchronization method and device

Country Status (1)

Country Link
CN (1) CN112559469A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114040403A (en) * 2021-10-26 2022-02-11 青岛海尔科技有限公司 Equipment synchronization method, device and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080082555A1 (en) * 2006-10-02 2008-04-03 Salesforce.Com, Inc. Method and system for synchronizing a server and an on-demand database service
CN104750808A (en) * 2015-03-27 2015-07-01 安徽四创电子股份有限公司 Crossroad data border-crossing implementation method based on Hadoop big data platform
CN106973073A (en) * 2016-01-13 2017-07-21 杭州海康威视系统技术有限公司 The transmission method and equipment of multi-medium data
CN109542860A (en) * 2018-10-25 2019-03-29 平安科技(深圳)有限公司 Service data management method, terminal device based on HDFS
CN111010366A (en) * 2019-11-05 2020-04-14 珠海许继芝电网自动化有限公司 Data transmission method and system based on reverse isolation technology

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080082555A1 (en) * 2006-10-02 2008-04-03 Salesforce.Com, Inc. Method and system for synchronizing a server and an on-demand database service
CN104750808A (en) * 2015-03-27 2015-07-01 安徽四创电子股份有限公司 Crossroad data border-crossing implementation method based on Hadoop big data platform
CN106973073A (en) * 2016-01-13 2017-07-21 杭州海康威视系统技术有限公司 The transmission method and equipment of multi-medium data
CN109542860A (en) * 2018-10-25 2019-03-29 平安科技(深圳)有限公司 Service data management method, terminal device based on HDFS
CN111010366A (en) * 2019-11-05 2020-04-14 珠海许继芝电网自动化有限公司 Data transmission method and system based on reverse isolation technology

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114040403A (en) * 2021-10-26 2022-02-11 青岛海尔科技有限公司 Equipment synchronization method, device and system

Similar Documents

Publication Publication Date Title
CN113568884B (en) File management method and device, electronic equipment and storage medium
CN110958218A (en) Data transmission method based on multi-network communication and related equipment
CN112261094B (en) Message processing method and proxy server
CN103457973A (en) Image uploading method and system, image uploading client terminal and network server
CN113114707B (en) Rule filtering method for power chip Ethernet controller
CN111711801B (en) Video data transmission method, device, server and computer readable storage medium
CN111163130A (en) Network service system and data transmission method thereof
CN103986788A (en) Data fetching method and device of OTT (over the top) application
US10938773B2 (en) Method and apparatus for synchronizing contact information and medium
AU2022204335A1 (en) Data communication method, communication system and computer-readable storage medium
CN112559469A (en) Data synchronization method and device
CN108520401B (en) User list management method, device, platform and storage medium
WO2023217086A1 (en) Resource file updating method and apparatus, and device and readable storage medium
US20230280997A1 (en) Automated process and system update scheduling in a computer network
CN109766347B (en) Data updating method, device, system, computer equipment and storage medium
CN110858846A (en) Resource allocation method, device and storage medium
WO2019024643A1 (en) Data synchronization control method, device and electronic equipment
CN111901561B (en) Video data processing method, device and system in monitoring system and storage medium
CN111813529B (en) Data processing method, device, electronic equipment and storage medium
CN110493216B (en) Method, system and storage medium for data transparent transmission interception based on embedded serial port
CN104516883A (en) Webpage sharing method, device and system
CN113965915A (en) Data processing method and electronic equipment
CN104346228A (en) Application program sharing method and terminal
CN111400630A (en) Resource preloading method and related equipment
CN111935313B (en) Connection pool management method and device

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210326

WD01 Invention patent application deemed withdrawn after publication