Cloud edge data synchronization method, system, device and computer storage medium
Device configuration information is generated through the cloud platform and sent to the target edge node for data synchronization, which solves the problem of low transmission efficiency in cloud-edge collaboration and realizes intelligent control of edge devices and efficient data transmission.
Patent Information
- Application Number
- CN202211639578.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-12-20
AI Technical Summary
In existing cloud-edge collaboration technologies, there is a problem of low transmission efficiency when the cloud platform transmits business data to the edge side, especially when the network is unstable, it is difficult to achieve efficient data synchronization.
The cloud platform receives data synchronization requests, generates device configuration information, and sends the data to be synchronized to the target edge node. The target edge node communicates with the edge device based on the device configuration information to achieve intelligent control and improve data transmission efficiency.
It realizes intelligent control of each target edge device, improves control efficiency and reliability, and thus improves data transmission efficiency during cloud-edge data synchronization.
Smart Images

Figure CN116233148B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data synchronization, in particular to a cloud-edge data synchronization method, system and device and a computer storage medium. BACKGROUND
[0002] In actual life, various terminals in different Internet of Things scenarios continue to develop in the direction of intelligence, and massive data is converged at the edge, data is coordinated between the edge and the cloud, and a complete data circulation path is formed to decentralize data processing and application running functions from the cloud platform to the edge side, realize local data processing and storage, reduce the number of data transmissions, and thus produce faster network service responses.
[0003] The existing cloud-edge collaboration technical solution generally deploys edge nodes close to the source of data, but there are unstable network factors between the cloud and the edge in the cloud-edge collaboration scenario, and there are problems such as low transmission efficiency in the process of transmitting business data from the cloud platform to the edge side. It can be seen that the existing technology has certain problems that need to be solved. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a cloud-edge data synchronization method, system, device and computer storage medium, which can realize intelligent control of each target edge device, thereby improving the control efficiency and control reliability of each target edge device, and further improving the data transmission efficiency during cloud-edge data synchronization.
[0005] To solve the above technical problems, the present application discloses a cloud-edge data synchronization method in the first aspect, which is applied to a cloud-edge data synchronization system, the cloud-edge data synchronization system at least includes a cloud platform and a target edge node, and the method comprises:
[0006] The cloud platform receives a data synchronization request sent by a user, wherein the data synchronization request is triggered when the data of an existing device in all devices corresponding to the cloud platform changes;
[0007] After the data synchronization request is verified, the cloud platform obtains the to-be-synchronized data of all first devices corresponding to the data synchronization request, and generates device configuration information of all the first devices according to a pre-set manner;
[0008] The cloud platform sends the to-be-synchronized data and the device configuration information to the target edge node;
[0009] The target edge node determines a target edge device according to the to-be-synchronized data;
[0010] The target edge node communicates with the target edge device according to the device configuration information to perform data synchronization.
[0011] As an optional implementation, in the first aspect of the present application, the data synchronization request comprises at least all the first identity information corresponding to all the first devices;
[0012] The cloud platform generates the device configuration information of all the first devices according to a preset manner, comprising:
[0013] The cloud platform divides all the second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, wherein each device group comprises all the second identity information corresponding to all the second devices in the device group;
[0014] For each device group, the cloud platform determines whether the first device exists in all the second devices in the device group according to all the first identity information and all the second identity information, and if the first device exists in all the second devices in the device group, generates the device configuration information corresponding to the device group as the device configuration information of all the first devices.
[0015] As an optional implementation, in the first aspect of the present application, the cloud platform divides all the second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, comprising:
[0016] The cloud platform obtains the device tag corresponding to each second device of all the second devices corresponding to the cloud platform, wherein the device tag corresponding to each second device is used to represent the interface information between each second device and the edge node corresponding thereto;
[0017] The cloud platform divides all the second devices into at least one device group according to the device tags corresponding to all the second devices respectively, wherein the device tags corresponding to each second device in the same device group are the same.
[0018] As an optional implementation, in the first aspect of the present application, the data to be synchronized comprises all the third identity information of all the third devices to which the data to be synchronized needs to be synchronized;
[0019] The target edge node determines the target edge device according to the data to be synchronized, comprising:
[0020] The target edge node obtains the device list corresponding thereto, and the device list is used to record all the fourth identity information corresponding to all the fourth devices currently maintained by the target edge node;
[0021] The target edge node determines whether the device list includes the third device according to all the third identity information and all the fourth identity information;
[0022] If the target edge node determines that the device list includes the third device, all the third devices included in the device list are determined as target edge devices.
[0023] As an optional implementation manner, in the first aspect of the present invention, the device configuration information includes at least a device protocol type and protocol connection information;
[0024] The target edge node communicates with the target edge device according to the device configuration information to perform data synchronization, including:
[0025] The target edge node establishes a communication path with the target edge device according to the device protocol type and the protocol connection information;
[0026] The target edge node synchronizes the data to be synchronized through the communication path, and obtains the device reporting information corresponding to the target edge device and synchronizes it to the cloud platform.
[0027] As an optional implementation, in the first aspect of the present invention, the target edge node has a corresponding message queue;
[0028] After the cloud platform sends the data to be synchronized and the device configuration information to the target edge node, the method further includes:
[0029] The target edge node stores the data to be synchronized and the device configuration information in the message queue.
[0030] As an optional implementation manner, in the first aspect of the present invention, before the target edge node stores the data to be synchronized and the device configuration information in the message queue, the method further includes:
[0031] The target edge node verifies the data to be verified, wherein the data to be verified includes at least the data to be synchronized and / or the device configuration information;
[0032] If the verification fails, the target edge node generates a data supplement request corresponding to the data to be verified, and sends the data supplement request to the cloud platform;
[0033] After the cloud platform obtains the corresponding supplementary data according to the data supplementation request, the target edge node receives the supplementary data sent by the cloud platform and merges the data to be verified with the supplementary data to obtain the corresponding target synchronization data;
[0034] The target edge node stores the data to be synchronized and the device configuration information in the message queue, including:
[0035] The target edge node stores the target synchronization data in the message queue, wherein if the verification is successful, the target synchronization data is the data to be synchronized and the device configuration information.
[0036] A second aspect of the present invention discloses a cloud-edge data synchronization system, the system comprising at least a cloud platform and a target edge node, the cloud platform comprising:
[0037] A first receiving module is configured to receive a data synchronization request sent by a user, wherein the data synchronization request is triggered when data of a device in all devices corresponding to the cloud platform is changed by the user;
[0038] A first acquisition module is configured to acquire, after the data synchronization request is verified, the to-be-synchronized data of all first devices corresponding to the data synchronization request;
[0039] A first generating module is configured to generate device configuration information of all the first devices according to a preset method after the data synchronization request is verified;
[0040] A first sending module, configured to send the data to be synchronized and the device configuration information to the target edge node;
[0041] The target edge node includes:
[0042] a second receiving module, configured to receive the data to be synchronized and the device configuration information sent by the first sending module;
[0043] A determination module, configured to determine a target edge device based on the data to be synchronized;
[0044] A communication module is used to communicate with the target edge device according to the device configuration information to synchronize data.
[0045] As an optional implementation manner, in the second aspect of the present invention, the data synchronization request at least includes all first identity information corresponding to all first devices;
[0046] The first generating module generates the device configuration information of all the first devices in a preset manner as follows:
[0047] Dividing all second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, wherein each device group includes all second identity information corresponding to all second devices in the device group;
[0048] For each of the device groups, it is determined whether the first device exists among all the second devices in the device group based on all the first identity information and all the second identity information. If it is determined that the first device exists among all the second devices in the device group, the device configuration information corresponding to the device group is generated as the device configuration information of all the first devices.
[0049] As an optional implementation, in the second aspect of the present invention, the first generation module divides all second devices corresponding to the cloud platform into multiple device groups according to the predetermined device grouping condition in the following manner:
[0050] Obtaining a device tag corresponding to each second device among all corresponding second devices, wherein the device tag corresponding to each second device is used to represent interface information between each second device and its corresponding edge node;
[0051] According to the device tags corresponding to all the second devices, all the second devices are divided into at least one device group, wherein the device tags corresponding to each second device in the same device group are the same.
[0052] As an optional implementation manner, in the second aspect of the present invention, the data to be synchronized includes all third identity information of all third devices to which the data to be synchronized needs to be synchronized;
[0053] The specific method in which the determination module determines the target edge device according to the data to be synchronized is:
[0054] Obtaining a device list corresponding to the target edge node, where the device list is used to record all fourth identity information corresponding to all fourth devices currently maintained by the target edge node;
[0055] determining whether the device list includes the third device according to all the third identity information and all the fourth identity information;
[0056] If it is determined that the device list includes the third device, all the third devices included in the device list are determined as target edge devices.
[0057] As an optional implementation manner, in the second aspect of the present invention, the device configuration information includes at least a device protocol type and protocol connection information;
[0058] The communication module communicates with the target edge device according to the device configuration information to perform data synchronization in the following manner:
[0059] establishing a communication path with the target edge device according to the device protocol type and the protocol connection information;
[0060] The data to be synchronized is synchronized through the communication path, and the device reporting information corresponding to the target edge device is obtained and synchronized to the cloud platform.
[0061] As an optional implementation, in the second aspect of the present invention, the target edge node has a corresponding message queue;
[0062] The target edge node also includes:
[0063] A storage module is configured to store the data to be synchronized and the device configuration information in the message queue after the first sending module sends the data to be synchronized and the device configuration information to the target edge node.
[0064] As an optional implementation manner, in the second aspect of the present invention, the target edge node further includes:
[0065] a verification module, configured to verify the data to be synchronized and the device configuration information before the storage module stores the data to be synchronized and the device configuration information in the message queue, wherein the data to be verified includes at least the data to be synchronized and / or the device configuration information;
[0066] A second generating module is configured to generate a data supplement request corresponding to the data to be verified if the verification fails;
[0067] A second sending module, configured to send the data supplement request to the cloud platform;
[0068] The second receiving module is further configured to receive the supplementary data sent by the cloud platform after the cloud platform obtains the corresponding supplementary data according to the data supplementation request;
[0069] A merging module, configured to merge the data to be verified with the supplementary data to obtain corresponding target synchronization data;
[0070] The storage module stores the data to be synchronized and the device configuration information in the message queue in the following manner:
[0071] The storage module stores the target synchronization data in the message queue, wherein if the verification is successful, the target synchronization data is the data to be synchronized and the device configuration information.
[0072] The third aspect of the present application discloses a cloud-edge data synchronization device, the device comprises:
[0073] a memory storing executable program codes;
[0074] a processor coupled with the memory;
[0075] The processor invokes the executable program codes stored in the memory to execute the cloud-edge data synchronization method disclosed in the first aspect of the present application.
[0076] The fourth aspect of the present application discloses a computer storage medium storing computer instructions, when the computer instructions are invoked, the computer instructions are used to execute the cloud-edge data synchronization method disclosed in the first aspect of the present application.
[0077] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0078] In the embodiments of the present application, the cloud platform receives a data synchronization request sent by a user; after the data synchronization request is verified, the cloud platform obtains the to-be-synchronized data of all first devices corresponding to the data synchronization request, and generates the device configuration information of all first devices according to a pre-set manner; the cloud platform sends the to-be-synchronized data and the device configuration information to a target edge node; the target edge node determines a target edge device according to the to-be-synchronized data; the target edge node communicates with the target edge device according to the device configuration information to perform data synchronization. It can be seen that the implementation of the present application can realize intelligent control of each target edge device, thereby improving the control efficiency and control reliability of each target edge device, and further improving the data transmission efficiency during cloud-edge data synchronization. BRIEF DESCRIPTION OF DRAWINGS
[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0080] Figure 1 is a flowchart of a cloud-edge data synchronization method disclosed by the embodiments of the present application;
[0081] Figure 2 is a flowchart of another cloud-edge data synchronization method disclosed by the embodiments of the present application;
[0082] Figure 3 is a structural diagram of a cloud-edge data synchronization optimization system disclosed by the embodiments of the present application;
[0083] Figure 4 It is a structural diagram of another cloud-edge data synchronization optimization device disclosed in an embodiment of the present invention;
[0084] Figure 5 It is a structural diagram of another cloud-edge data synchronization optimization device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0085] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0086] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.
[0087] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0088] The present invention discloses a cloud-edge data synchronization method, system, device, and computer storage medium, which enable intelligent control of each target edge device, thereby improving the control efficiency and reliability of each target edge device, and further improving the data transmission efficiency during cloud-edge data synchronization. These are described in detail below.
[0089] Example 1
[0090] See also Figure 1 , Figure 1 This is a flow chart of a cloud-edge data synchronization method disclosed in an embodiment of the present invention. Figure 1The described cloud-edge data synchronization method can be applied to a cloud-edge data synchronization optimization system, which may include a cloud and a target edge node, wherein the target edge node is used for accessing edge devices in the corresponding edge scenario and communicating with the cloud, which is not limited in the embodiments of the present invention. Figure 1 As shown, the cloud-edge data synchronization method is applied to a cloud-edge data synchronization system, which includes at least a cloud platform and a target edge node. The method may include the following operations:
[0091] 101. The cloud platform receives a data synchronization request sent by a user.
[0092] In an embodiment of the present invention, a data synchronization request is triggered when a user changes the data of a device in all devices corresponding to the cloud platform. Optionally, the data of the device is device twin data used to describe the status of the device. Optionally, the change of the device data includes creating, updating, and deleting device twin data. Furthermore, device twin data is a dynamic attribute of the device, which represents the proprietary real-time data of a specific device, such as: the on / off status of the light, and the temperature value actually collected by the thermometer. Furthermore, "desired value" and "reported value" are defined in the device twin data. Among them, desired value refers to the state that the control end hopes the device will reach, for example: when the user turns on the light remotely, the instruction issued by the user belongs to the expected value; and reported value refers to the actual value reported by the device to the control end, such as the temperature value collected by the thermometer. Optionally, the control end can be the device corresponding to the cloud platform.
[0093] In this embodiment of the present invention, before a user sends a data synchronization request, the user creates a Device CRD instance by calling the Kubernetes API interface and saves it in the ECTD. The creation information of the Device CRD instance indicates that the data of an existing device managed by the cloud platform has changed.
[0094] In an embodiment of the present invention, the cloud platform has corresponding cloud components, and the cloud components at least include a device controller, an edge node controller, and a cloud pipeline center.
[0095] 102. After the data synchronization request is verified, the cloud platform obtains the to-be-synchronized data of all first devices corresponding to the data synchronization request.
[0096] In this embodiment of the present invention, the first device is the device whose data synchronization request indicates a data change, and the first device is at least one device among all devices corresponding to the cloud platform. Optionally, the data to be synchronized includes a desired value, that is, the data to be synchronized includes the state that the control end desires the device to achieve. In this case, the control end is the first device.
[0097] 103. The cloud platform generates device configuration information of all first devices according to a preset method.
[0098] In an embodiment of the present invention, device configuration information includes at least a device profile, which is used to provide the ability to quickly access local and remote device profiles, such as: inserting, deleting, and querying local device profiles; querying remote device profiles; subscribing to notifications of remote profile changes; synchronizing profiles across devices, etc.
[0099] 104. The cloud platform sends the data to be synchronized and the device configuration information to the target edge node.
[0100] In an embodiment of the present invention, the edge node is a business platform built on the edge of the network close to the user, providing storage, computing, network and other resources. Some business applications are sunk to the edge of the access network through the edge node. The edge node serves as an extension of the cloud platform on the device side, which can reduce the width and delay losses caused by network transmission and multi-level forwarding.
[0101] In an embodiment of the present invention, the target edge node optionally has a corresponding edge component, and the edge component includes at least an edge pipeline center. Furthermore, after the cloud platform receives a data synchronization request sent by a user, the device controller sends the to-be-synchronized data of all first devices corresponding to the data synchronization request to the edge component via the cloud-edge pipeline center.
[0102] 105. The target edge node determines a target edge device based on the data to be synchronized.
[0103] In an embodiment of the present invention, the target edge node has a corresponding device list, which is used to record identity information corresponding to all devices currently maintained by the target edge node. Optionally, the identity information corresponding to the device includes at least the device name.
[0104] 106. The target edge node communicates with the target edge device according to the device configuration information to synchronize data.
[0105] In an embodiment of the present invention, the data to be synchronized is sent from the cloud platform to the target edge device in json format. Both the cloud platform and the target edge device define the structure of the data to be synchronized, and parse the json into a structure by calling the parsing code.
[0106] It can be seen that implementation Figure 1 The described cloud-edge data synchronization method can send the data to be synchronized and the device configuration information to the target edge node through the cloud platform, so that the target edge node can determine the target edge device based on the data to be synchronized, and communicate with the target edge device based on the device configuration information, thereby realizing intelligent control of each target edge device, thereby improving the control efficiency and control reliability of each target edge device, and further improving the data transmission efficiency during cloud-edge data synchronization.
[0107] In an optional embodiment, the data synchronization request includes at least all first identity information corresponding to all first devices;
[0108] The cloud platform generates device configuration information for all first devices according to a pre-set method, including:
[0109] The cloud platform divides all second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, wherein each device group includes all second identity information corresponding to all second devices in the device group;
[0110] For each device group, the cloud platform determines whether there is a first device among all the second devices in the device group based on all the first identity information and all the second identity information. If it is determined that there is a first device among all the second devices in the device group, the cloud platform generates device configuration information corresponding to the device group as the device configuration information of all the first devices.
[0111] In this optional embodiment, the first device is the device corresponding to the data to be synchronized, that is, the device where the data has changed, and the second device is all devices managed by the cloud platform. Optionally, each device group includes at least one second device and the identity information corresponding to the second device.
[0112] In this optional embodiment, if it is determined that the first device does not exist among all the second devices in the device group, the device configuration information corresponding to the device group will not be generated, and the size of the device configuration information can be reduced, for example: from 10M to 10kb, thereby reducing the requirements for the network environment when the cloud platform communicates with the target edge node, allowing it to be transmitted in a weak network environment, thereby improving the effectiveness and efficiency of information transmission.
[0113] In this optional embodiment, as an optional implementation, for each device group, the cloud platform determines whether the first device exists among all the second devices in the device group based on all the first identity information and all the second identity information, including:
[0114] For each first device, the cloud platform determines whether there is a target second device among all second devices corresponding to the device group, wherein the second identity information corresponding to the target second device is the same as the first identity information corresponding to the first device;
[0115] If the cloud platform determines that the target second device exists among all the second devices corresponding to the device group, then confirming that the first device exists among all the second devices in the device group;
[0116] If the cloud platform determines that the target second device does not exist among all the second devices corresponding to the device group, it confirms that the first device does not exist among all the second devices in the device group.
[0117] In this optional embodiment, optionally, the first identity information corresponding to the first device and the second identity information corresponding to the second device can be device names. Further, if the device name of the first target device in all first devices is the same as the device name of the second target device in a certain device group, it is confirmed that the first device exists in all second devices in the device group.
[0118] It can be seen that this optional implementation can determine whether the first device exists in all the second devices in each device group by judging whether the first identity information is the same as the second identity information, thereby improving the accuracy of generating device configuration information.
[0119] It can be seen that this optional embodiment can reduce the volume of device configuration information by only generating device configuration information corresponding to the device group where the first device exists, and not generating device configuration information for the device group where the first device does not exist. This can reduce the requirements for the network environment when the cloud platform communicates with the target edge node, allowing it to be transmitted in a weak network environment, thereby improving the effectiveness and efficiency of information transmission.
[0120] In another optional embodiment, the cloud platform divides all second devices corresponding to the cloud platform into multiple device groups according to a predetermined device grouping condition, including:
[0121] The cloud platform obtains a device tag corresponding to each second device among all corresponding second devices, wherein the device tag corresponding to each second device is used to represent interface information between each second device and its corresponding edge node;
[0122] The cloud platform divides all the second devices into at least one device group according to the device tags corresponding to all the second devices, wherein the device tags corresponding to each second device in the same device group are the same.
[0123] It can be seen that this optional embodiment can divide all devices corresponding to the cloud platform with the same device label into a device group, so that after determining that there is a first device in a device group, device configuration information can be generated only for the device group, without obtaining the device configuration information corresponding to all devices corresponding to a certain edge node, thereby improving the efficiency of cloud-edge data synchronization.
[0124] Example 2
[0125] See also Figure 2 , Figure 2 This is a flow chart of another cloud-edge data synchronization method disclosed in an embodiment of the present invention. Figure 2 The described cloud-edge data synchronization method can be applied to a cloud-edge data synchronization optimization system, which may include a cloud and a target edge node, wherein the target edge node is used for accessing edge devices in the corresponding edge scenario and communicating with the cloud, which is not limited in the embodiments of the present invention. Figure 2 As shown, the method may include the following operations:
[0126] 201. The cloud platform receives a data synchronization request sent by a user.
[0127] 202. After the data synchronization request is verified, the cloud platform obtains the to-be-synchronized data of all first devices corresponding to the data synchronization request.
[0128] 203. The cloud platform generates device configuration information of all first devices according to a pre-set method.
[0129] 204. The cloud platform sends the data to be synchronized and the device configuration information to the target edge node.
[0130] 205. The target edge node obtains its corresponding device list.
[0131] In the embodiment of the present invention, the device list is used to record all fourth identity information corresponding to all fourth devices currently maintained by the target edge node. Optionally, the fourth identity information may include a device name of the fourth device.
[0132] 206. The target edge node determines whether the device list includes the third device according to all the third identity information and all the fourth identity information.
[0133] In the embodiment of the present invention, the data to be synchronized includes all third identity information of all third devices to which the data to be synchronized needs to be synchronized. Optionally, the third identity information may include device names of the third devices.
[0134] 207. If the target edge node determines that the device list includes a third device, all third devices included in the device list are determined as target edge devices.
[0135] In an embodiment of the present invention, optionally, the target edge node determines whether there is at least one fourth device in the device list whose fourth identity information is identical to the third identity information corresponding to any one of all the third devices. If it is determined that there is at least one fourth device in the device list whose fourth identity information is identical to the third identity information corresponding to any one of all the third devices, then the fourth device with the same identity information as the third device is determined as the target edge device. Furthermore, the fourth device with the same device name as the third device can be determined as the target edge device.
[0136] 208. The target edge node communicates with the target edge device according to the device configuration information to synchronize data.
[0137] In the embodiment of the present invention, for other descriptions of steps 201 to 204 and step 208, please refer to other specific descriptions of steps 101 to 104 and step 106 in the first embodiment, which will not be repeated in the embodiment of the present invention.
[0138] It can be seen that implementation Figure 2 The described cloud-edge data synchronization method enables the target edge node to determine the target edge device based on the device identity information of its maintenance device and the device identity information carried in the data to be synchronized, thereby improving the accuracy of determining the target edge device, realizing intelligent control of each target edge device, and further improving the data transmission efficiency during cloud-edge data synchronization.
[0139] In an optional embodiment, the device configuration information includes at least a device protocol type and protocol connection information; the target edge node communicates with the target edge device according to the device configuration information to perform data synchronization, including:
[0140] The target edge node establishes a communication path with the target edge device based on the device protocol type and protocol connection information;
[0141] The target edge node synchronizes the data to be synchronized through the communication path, obtains the device reporting information corresponding to the target edge device, and synchronizes it to the cloud platform.
[0142] In this optional embodiment, optionally, each target edge device has a corresponding device protocol type and protocol connection information. Optionally, the protocol connection information may include an account password, address, etc. Optionally, when the target edge node needs to establish a communication path with the target edge device, it only needs to call the code in the SDK plug-in of the relevant device protocol type according to the protocol connection information.
[0143] In this optional embodiment, each target edge node has a corresponding mapper program. Furthermore, after the target edge node establishes a communication connection with the target edge device, the device status acquisition interface is called periodically to obtain the current status of the target edge device, and the current status of the target edge device is determined as device reporting information to be synchronized to the cloud platform.
[0144] It can be seen that this optional embodiment can synchronize the data to be synchronized to the target edge node through the device protocol type and protocol connection information in the device configuration information, and obtain the device reporting information and synchronize it to the cloud platform, so as to realize the intelligent control of the target edge node over the target edge device, thereby improving the control reliability of the target edge device.
[0145] In another optional embodiment, the target edge node has a corresponding message queue; after the cloud platform sends the data to be synchronized and the device configuration information to the target edge node, the method further includes:
[0146] The target edge node stores the data to be synchronized and the device configuration information in the message queue.
[0147] In this optional embodiment, the message queue is used to cache messages sent from the cloud platform to the target edge node. Optionally, the message queue can also be used to cache device reporting information sent by the target edge device to the cloud platform. Optionally, each target edge node has a corresponding queue. Optionally, each message entering the message queue has a corresponding time tag. Furthermore, when the cloud-edge network is abnormal or the data synchronization is abnormal, the message queue can be used as temporary storage. After the cloud-edge network is restored, the device controller processes the messages in order according to the time tag corresponding to each message in the message queue. The first-in-first-out rule is used to ensure the order of processing or synchronizing the messages temporarily stored in the message queue.
[0148] It can be seen that this optional embodiment can store communication messages between the cloud and the edge through the message queue corresponding to the target edge node and can ensure the order of messages temporarily stored in the message queue after processing or synchronization after network recovery based on the timeliness of the messages, thereby improving the order of cloud-edge device data synchronization in a weak network environment or after network disconnection and recovery, and further improving the accuracy of cloud-edge data synchronization.
[0149] In yet another optional embodiment, before the target edge node stores the data to be synchronized and the device configuration information in the message queue, the method further includes:
[0150] The target edge node verifies the data to be verified, wherein the data to be verified includes at least the data to be synchronized and / or device configuration information;
[0151] If the verification fails, the target edge node generates a data supplement request corresponding to the data to be verified and sends the data supplement request to the cloud platform;
[0152] After the cloud platform obtains the corresponding supplementary data according to the data supplementation request, the target edge node receives the supplementary data sent by the cloud platform and merges the data to be verified with the supplementary data to obtain the corresponding target synchronization data;
[0153] The target edge node stores the data to be synchronized and the device configuration information in the message queue, including:
[0154] The target edge node stores the target synchronization data in the message queue, wherein if the verification is successful, the target synchronization data is the data to be synchronized and the device configuration information.
[0155] It can be seen that this optional embodiment can verify the message before storing it in the message queue, generate a data supplement request for the data that fails the verification, and require the cloud platform to supplement the corresponding data to obtain the corresponding target synchronization data, thereby ensuring the integrity and accuracy of the messages stored in the message queue, and thus reducing the probability of synchronization data loss to ensure the effectiveness of cloud-edge data synchronization.
[0156] Example 3
[0157] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a cloud-edge data synchronization system disclosed in an embodiment of the present invention. Figure 3 As shown, the cloud-edge data synchronization system includes at least a cloud platform and a target edge node. The cloud platform includes:
[0158] The first receiving module 301 is configured to receive a data synchronization request sent by a user, wherein the data synchronization request is triggered when the data of a device in all devices corresponding to the cloud platform is changed;
[0159] A first acquisition module 302 is configured to acquire, after the data synchronization request is verified, all to-be-synchronized data of the first device corresponding to the data synchronization request;
[0160] A first generating module 303 is configured to generate device configuration information of all first devices according to a preset method after the data synchronization request is verified;
[0161] A first sending module 304 is configured to send the data to be synchronized and the device configuration information to the target edge node;
[0162] The target edge nodes include:
[0163] The second receiving module 305 is configured to receive the data to be synchronized and the device configuration information sent by the first sending module 304;
[0164] A determination module 306 is configured to determine a target edge device based on the data to be synchronized;
[0165] The communication module 307 is used to communicate with the target edge device according to the device configuration information to perform data synchronization.
[0166] visible, Figure 3 The described cloud-edge data synchronization system can send the data to be synchronized and the device configuration information to the target edge node through the cloud platform, so that the target edge node can determine the target edge device based on the data to be synchronized, and communicate with the target edge device based on the device configuration information, thereby realizing intelligent control of each target edge device, improving the data transmission efficiency during cloud-edge data synchronization, and thereby improving the control efficiency and control reliability of each target edge device.
[0167] In an optional embodiment, the data synchronization request includes at least all first identity information corresponding to all first devices;
[0168] The first generating module 303 generates the device configuration information of all first devices in a preset manner as follows:
[0169] Dividing all second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, wherein each device group includes all second identity information corresponding to all second devices in the device group;
[0170] For each device group, whether a first device exists among all the second devices in the device group is determined based on all the first identity information and all the second identity information. If it is determined that a first device exists among all the second devices in the device group, device configuration information corresponding to the device group is generated as the device configuration information of all the first devices.
[0171] It can be seen that this optional embodiment can reduce the volume of device configuration information by only generating device configuration information corresponding to the device group where the first device exists, and not generating device configuration information for the device group where the first device does not exist. This can reduce the requirements for the network environment when the cloud platform communicates with the target edge node, allowing it to be transmitted in a weak network environment, thereby improving the effectiveness and efficiency of information transmission.
[0172] In another optional embodiment, the first generating module 303 divides all second devices corresponding to the cloud platform into multiple device groups according to the predetermined device grouping condition in the following manner:
[0173] Obtaining a device tag corresponding to each second device among all corresponding second devices, wherein the device tag corresponding to each second device is used to represent interface information between each second device and its corresponding edge node;
[0174] According to the device tags corresponding to all the second devices, all the second devices are divided into at least one device group, wherein the device tags corresponding to each second device in the same device group are the same.
[0175] It can be seen that this optional embodiment can divide all devices corresponding to the cloud platform with the same device label into a device group, so that after determining that there is a first device in a device group, device configuration information can be generated only for the device group, without obtaining the device configuration information corresponding to all devices corresponding to a certain edge node, thereby improving the efficiency of cloud-edge data synchronization.
[0176] In yet another optional embodiment, the data to be synchronized includes all third identity information of all third devices to which the data to be synchronized needs to be synchronized;
[0177] The determination module 306 determines the target edge device according to the data to be synchronized in the following manner:
[0178] Obtain a device list corresponding to the target edge node, where the device list is used to record all fourth identity information corresponding to all fourth devices currently maintained by the target edge node;
[0179] determining whether the device list includes the third device based on all third identity information and all fourth identity information;
[0180] If it is determined that the device list includes a third device, all third devices included in the device list are determined as target edge devices.
[0181] It can be seen that this optional embodiment enables the target edge node to determine the target edge device based on the device identity information of its maintenance device and the device identity information carried in the data to be synchronized, thereby improving the accuracy of determining the target edge device, so as to realize intelligent control of each target edge device, and further improve the data transmission efficiency during cloud-edge data synchronization.
[0182] In yet another optional embodiment, the device configuration information includes at least a device protocol type and protocol connection information;
[0183] The communication module 307 communicates with the target edge device according to the device configuration information to synchronize data in the following manner:
[0184] Establish a communication path with the target edge device based on the device protocol type and protocol connection information;
[0185] Synchronize the data to be synchronized through the communication path, obtain the device reporting information corresponding to the target edge device and synchronize it to the cloud platform.
[0186] It can be seen that this optional embodiment can synchronize the data to be synchronized to the target edge node through the device protocol type and protocol connection information in the device configuration information, and obtain the device reporting information and synchronize it to the cloud platform, so as to realize the intelligent control of the target edge node over the target edge device, thereby improving the control reliability of the target edge device.
[0187] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of another cloud-edge data synchronization system disclosed in an embodiment of the present invention. Figure 4 As shown, the target edge node has a corresponding message queue;
[0188] Target edge nodes also include:
[0189] The storage module 308 is configured to store the data to be synchronized and the device configuration information in a message queue after the first sending module 304 sends the data to be synchronized and the device configuration information to the target edge node and the second receiving module 305 receives them.
[0190] It can be seen that this optional embodiment can store communication messages between the cloud and the edge through the message queue corresponding to the target edge node and can ensure the order of messages temporarily stored in the message queue after processing or synchronization after network recovery based on the timeliness of the messages, thereby improving the order of cloud-edge device data synchronization in a weak network environment or after network disconnection and recovery, and further improving the accuracy of cloud-edge data synchronization.
[0191] In yet another optional embodiment, the target edge node further includes:
[0192] The verification module 309 is configured to verify the data to be synchronized and the device configuration information before the storage module 308 stores the data to be synchronized and the device configuration information in the message queue, wherein the data to be verified includes at least the data to be synchronized and / or the device configuration information;
[0193] The second generating module 310 is configured to generate a data supplement request corresponding to the data to be verified if the verification module 309 fails verification;
[0194] The second sending module 311 is used to send the data supplement request to the cloud platform;
[0195] The second receiving module 305 is further configured to receive the supplementary data sent by the cloud platform after the cloud platform obtains the corresponding supplementary data according to the data supplementation request;
[0196] A merging module 312 is used to merge the data to be verified with the supplementary data to obtain corresponding target synchronization data;
[0197] The storage module 308 stores the data to be synchronized and the device configuration information in the message queue in the following manner:
[0198] The storage module 308 stores the target synchronization data in the message queue, wherein if the verification is successful, the target synchronization data is the data to be synchronized and the device configuration information.
[0199] It can be seen that this optional embodiment can verify the message before storing it in the message queue, generate a data supplement request for the data that fails the verification, and require the cloud platform to supplement the corresponding data to obtain the corresponding target synchronization data, thereby ensuring the integrity and accuracy of the messages stored in the message queue, and thus reducing the probability of synchronization data loss to ensure the effectiveness of cloud-edge data synchronization.
[0200] Example 4
[0201] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a cloud-edge data synchronization optimization device disclosed in an embodiment of the present invention. Figure 5 As shown, the cloud-edge data synchronization optimization device may include:
[0202] A memory 501 storing executable program code;
[0203] a processor 502 coupled to the memory 501;
[0204] The processor 502 calls the executable program code stored in the memory 501 to execute the steps in the cloud-edge data synchronization method described in the first embodiment of the present invention or the second embodiment of the present invention.
[0205] Example 5
[0206] An embodiment of the present invention discloses a cloud platform, which is used to execute the steps executed by the cloud platform in the cloud-edge data synchronization method described in Embodiment 1 or Embodiment 2 of the present invention.
[0207] Example 6
[0208] The embodiment of the present application discloses a computer storage medium, which stores computer instructions, and the computer instructions are used to execute the steps performed by the cloud platform in the cloud edge data synchronization method described in the embodiment one or the embodiment two of the present application.
[0209] Embodiment seven
[0210] The embodiment of the present application discloses a computer program product, which comprises a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps in the cloud edge data synchronization method described in the embodiment one or the embodiment two.
[0211] Embodiment eight
[0212] The embodiment of the present application discloses a target edge node, which is used to execute the steps performed by the target edge node in the cloud edge data synchronization method described in the embodiment one or the embodiment two of the present application.
[0213] Embodiment nine
[0214] The embodiment of the present application discloses another computer storage medium, which stores computer instructions, and the computer instructions are used to execute the steps performed by the target edge node in the cloud edge data synchronization method described in the embodiment one or the embodiment two of the present application.
[0215] Embodiment ten
[0216] The embodiment of the present application discloses another computer program product, which comprises a non-transitory computer storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps performed by the target edge node in the cloud edge data synchronization method described in the embodiment one or the embodiment two of the present application.
[0217] The above described device embodiments are only schematic, wherein the modules described as separate components can or can not be physically separate, and the components displayed as modules can or can not be physical modules, and can be located in one place or distributed on multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0218] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the portion that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0219] Finally, it should be noted that the cloud-edge data synchronization method, system, device and computer storage medium disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that it is still possible to modify the technical solutions recorded in the aforementioned embodiments, or to make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A cloud-edge data synchronization method, characterized in that: The method is applied to a cloud-edge data synchronization system, which includes at least a cloud platform and a target edge node. The method includes: The cloud platform receives a data synchronization request sent by a user, wherein the data synchronization request is triggered by a change in device data of all devices corresponding to the cloud platform by the user; After the data synchronization request is verified, the cloud platform obtains the to-be-synchronized data of all first devices corresponding to the data synchronization request, and generates device configuration information of all first devices according to a pre-set method, wherein the device configuration information includes at least a device protocol type and protocol connection information; The cloud platform sends the data to be synchronized and the device configuration information to the target edge node; The target edge node determines a target edge device according to the data to be synchronized; The target edge node establishes a communication path with the target edge device according to the device protocol type and the protocol connection information; The target edge node synchronizes the data to be synchronized through the communication path, and obtains the device reporting information corresponding to the target edge device and synchronizes it to the cloud platform; And, the target edge node has a corresponding message queue; After the cloud platform sends the data to be synchronized and the device configuration information to the target edge node, the method further includes: The target edge node stores the data to be synchronized and the device configuration information in the message queue; Before the target edge node stores the data to be synchronized and the device configuration information in the message queue, the method further includes: The target edge node verifies the data to be verified, wherein the data to be verified includes at least the data to be synchronized and / or the device configuration information; If the verification fails, the target edge node generates a data supplement request corresponding to the data to be verified, and sends the data supplement request to the cloud platform; After the cloud platform obtains the corresponding supplementary data according to the data supplementation request, the target edge node receives the supplementary data sent by the cloud platform and merges the data to be verified with the supplementary data to obtain the corresponding target synchronization data; The target edge node stores the data to be synchronized and the device configuration information in the message queue, including: The target edge node stores the target synchronization data in the message queue, wherein if the verification is successful, the target synchronization data is the data to be synchronized and the device configuration information.
2. The cloud-edge data synchronization method according to claim 1, characterized in that: The data synchronization request includes at least all first identity information corresponding to all first devices; The cloud platform generates device configuration information of all the first devices according to a preset method, including: The cloud platform divides all second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, wherein each device group includes all second identity information corresponding to all second devices in the device group; For each of the device groups, the cloud platform determines whether the first device exists among all the second devices in the device group based on all the first identity information and all the second identity information. If it is determined that the first device exists among all the second devices in the device group, the device configuration information corresponding to the device group is generated as the device configuration information of all the first devices.
3. The cloud-edge data synchronization method according to claim 2, characterized in that: The cloud platform divides all second devices corresponding to the cloud platform into a plurality of device groups according to a predetermined device grouping condition, including: The cloud platform obtains a device tag corresponding to each of all second devices corresponding to the cloud platform, wherein the device tag corresponding to each second device is used to represent interface information between each second device and its corresponding edge node; The cloud platform divides all the second devices into at least one device group according to the device tags corresponding to all the second devices, wherein the device tags corresponding to each second device in the same device group are the same.
4. The cloud-edge data synchronization method according to claim 1, characterized in that: The data to be synchronized includes all third identity information of all third devices to which the data to be synchronized needs to be synchronized; The target edge node determines a target edge device according to the data to be synchronized, including: The target edge node obtains a corresponding device list, where the device list is used to record all fourth identity information corresponding to all fourth devices currently maintained by the target edge node; The target edge node determines whether the device list includes the third device according to all the third identity information and all the fourth identity information; If the target edge node determines that the device list includes the third device, all the third devices included in the device list are determined as target edge devices.
5. A cloud-edge data synchronization system, characterized in that: The system includes at least a cloud platform and a target edge node, the system is used to execute the cloud-edge data synchronization method according to any one of claims 1 to 4, and the cloud platform includes: A first receiving module is configured to receive a data synchronization request sent by a user, wherein the data synchronization request is triggered when data of a device in all devices corresponding to the cloud platform is changed by the user; A first acquisition module is configured to acquire, after the data synchronization request is verified, the to-be-synchronized data of all first devices corresponding to the data synchronization request; A first generating module is configured to generate device configuration information of all the first devices according to a preset method after the data synchronization request is verified; A first sending module, configured to send the data to be synchronized and the device configuration information to the target edge node; The target edge node includes: a second receiving module, configured to receive the data to be synchronized and the device configuration information sent by the first sending module; A determination module, configured to determine a target edge device based on the data to be synchronized; A communication module is used to communicate with the target edge device according to the device configuration information to synchronize data.
6. A cloud-edge data synchronization device, characterized in that: The device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the cloud-edge data synchronization method as described in any one of claims 1-4.
7. A computer storage medium, characterized in that The computer storage medium stores computer instructions, which, when called, are used to execute the cloud-edge data synchronization method as described in any one of claims 1-4.
Citation Information
Patent Citations
Asset management method and device for cloud platform, equipment and storage medium
CN112115203A
Application resource deployment method and device, electronic equipment and medium
CN112925652A