A data transmission method and related apparatus
By filtering and transmitting target data at edge nodes, the problems of low security and transmission efficiency in cloud-deployed IoT platforms in the Industrial Internet of Things are solved, achieving efficient and stable data transmission and processing.
Patent Information
- Application Number
- CN202211351690.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-10-31
AI Technical Summary
In industrial IoT scenarios, cloud-deployed IoT platforms are difficult to guarantee security, and directly reporting device data to the cloud leads to wasted transmission resources and low data transmission efficiency, affecting the efficiency and accuracy of data processing.
At the edge nodes, by obtaining device identifiers and mapping relationships, the target data of the target task is filtered out and transmitted to the central node, thereby reducing the amount of data transmitted.
This improves data transmission efficiency and stability, thereby enhancing the efficiency and accuracy of subsequent data processing.
Smart Images

Figure CN117955978B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and provides a data transmission method and related apparatus. Background Technology
[0002] The Internet of Things (IoT) is a network concept that enables all ordinary physical objects that can be independently addressed to communicate with each other, based on information carriers such as the Internet and traditional telecommunications networks. One of the most important components in this field is the IoT platform, which connects various IoT devices to the IoT network and provides a unified interface for IoT applications.
[0003] In related technologies, IoT platforms are typically deployed in the cloud, with various IoT devices directly reporting their data to the cloud. However, in industrial IoT scenarios, the cloud serves as a connection platform for various industrial IoT devices. This necessitates public network connections between these devices, located in different factories, which complicates security. Furthermore, since a large amount of non-core data exists within the devices, directly reporting to the cloud leads to a waste of transmission resources. Moreover, with a large volume of data connected to the cloud, data transmission is heavily reliant on network performance, making it difficult to guarantee data transmission efficiency and stability, thus impacting the efficiency and accuracy of subsequent data processing. Summary of the Invention
[0004] This application provides a data transmission method and related apparatus to reduce the amount of data transmitted and improve data transmission efficiency and stability.
[0005] In a first aspect, embodiments of this application provide a data transmission method applied to an edge node, wherein the edge node is connected to a target Internet of Things (IoT) device, comprising:
[0006] When data to be processed is received from the target IoT device, the stored device identifiers are retrieved;
[0007] When it is determined that each device identifier contains a target identifier of a target IoT device, based on the first mapping relationship between each device identifier and each candidate task, at least one target task corresponding to the target identifier is determined from each candidate task;
[0008] Obtain the target attribute set corresponding to each of the at least one target task, and extract the target data corresponding to each of the at least one target task from the data to be processed based on the obtained at least one target attribute set;
[0009] For each of the at least one target task, the corresponding target data is transmitted to the central node.
[0010] Secondly, embodiments of this application provide a data transmission method applied to a central node, comprising:
[0011] In response to an add operation for an edge node, obtain the node address of the edge node;
[0012] When the network connectivity of the edge node is determined to be normal based on the node address, the edge node is added, and target data corresponding to at least one target task sent by the edge node is received.
[0013] Wherein, each target data is the data to be processed that the edge node receives the data to be processed from the target IoT device and determines that the target IoT device’s target identifier is included in the stored device identifiers. Based on the first mapping relationship between each device identifier and each candidate task, the edge node determines the at least one target task corresponding to the target identifier and extracts it from the data to be processed based on the target attribute set corresponding to each of the at least one target task.
[0014] Thirdly, embodiments of this application provide a data transmission device, which is connected to a target Internet of Things (IoT) device, including:
[0015] The acquisition unit is used to acquire the stored device identifiers when it receives data to be processed from the target IoT device.
[0016] The determining unit is configured to, when it is determined that each device identifier contains a target identifier of a target IoT device, determine at least one target task corresponding to the target identifier from each candidate task based on a first mapping relationship between each device identifier and each candidate task;
[0017] An extraction unit is used to obtain the target attribute set corresponding to each of the at least one target task, and extract the target data corresponding to each of the at least one target task from the data to be processed based on the obtained at least one target attribute set;
[0018] The transmission unit is used to transmit the corresponding target data to the central node for the at least one target task.
[0019] Fourthly, embodiments of this application provide a data transmission apparatus, including:
[0020] The acquisition unit is used to acquire the node address of the edge node in response to the addition operation for the edge node;
[0021] The receiving unit is configured to add the edge node and receive target data corresponding to at least one target task sent by the edge node when it is determined that the network connectivity of the edge node is normal based on the node address.
[0022] Wherein, each target data is the data to be processed that the edge node receives the data to be processed from the target IoT device and determines that the target IoT device’s target identifier is included in the stored device identifiers. Based on the first mapping relationship between each device identifier and each candidate task, the edge node determines the at least one target task corresponding to the target identifier and extracts it from the data to be processed based on the target attribute set corresponding to each of the at least one target task.
[0023] Fifthly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the above-described data transmission method.
[0024] Sixthly, embodiments of this application provide a computer-readable storage medium including a computer program, which, when run on an electronic device, causes the electronic device to perform the steps of the above-described data transmission method.
[0025] In a seventh aspect, embodiments of this application provide a computer program product, the program product including a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the steps of the above-described data transmission method.
[0026] In this embodiment, the edge node is connected to the target IoT device. When it receives data to be processed from the target IoT device, the edge node obtains the stored device identifiers. When it is determined that each device identifier contains the target identifier of the target IoT device, based on the first mapping relationship between each device identifier and each candidate task, at least one target task corresponding to the target identifier is determined from each candidate task. The target attribute set corresponding to each of the at least one target task is obtained, and based on the obtained at least one target attribute set, the target data corresponding to each of the at least one target task is extracted from the data to be processed. For each of the at least one target task, the corresponding target data is transmitted to the central node.
[0027] In this way, after receiving the data to be processed from the target IoT device, the edge node filters the data and forwards a portion of it, reducing the amount of data transmitted and thus improving data transmission efficiency and stability, which in turn improves the efficiency and accuracy of subsequent data processing.
[0028] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0029] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0030] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application;
[0031] Figure 2 This is a schematic diagram of the architecture of a central node provided in an embodiment of this application;
[0032] Figure 3 This is a schematic diagram of an edge node architecture provided in an embodiment of this application;
[0033] Figure 4 This is a flowchart illustrating a data transmission method applied to an edge node, as provided in an embodiment of this application.
[0034] Figure 5 This is a logical diagram illustrating a data flow direction provided in an embodiment of this application;
[0035] Figure 6 This is a schematic diagram illustrating the logic of a cache update provided in an embodiment of this application;
[0036] Figure 7 This is a flowchart illustrating a data transmission method applied to a central node, as provided in an embodiment of this application.
[0037] Figure 8 This is a flowchart illustrating a metadata synchronization method provided in an embodiment of this application;
[0038] Figure 9 This is a schematic diagram of a first identifier set and a second identifier set provided in the embodiments of this application;
[0039] Figure 10 This is a schematic diagram illustrating the interaction between an edge node and a center node provided in an embodiment of this application;
[0040] Figure 11 This is a schematic diagram illustrating another interaction between an edge node and a center node provided in an embodiment of this application;
[0041] Figure 12This is a schematic diagram of the structure of a data transmission device provided in an embodiment of this application;
[0042] Figure 13 This is a schematic diagram of another data transmission device provided in the embodiments of this application;
[0043] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.
[0045] Cloud-edge architecture: The cloud-edge architecture includes the cloud and the edge, with the cloud including public and private clouds. In this application implementation, in an industrial scenario, the edge is the industrial plant, and the cloud is the group's IoT platform. The edge is mainly used for device data collection, and the cloud is mainly used for data aggregation and processing.
[0046] Metadata: Metadata, also known as intermediary data or relay data, is data about data. It mainly describes the properties of data and is used to support functions such as indicating storage location, historical data, resource lookup, and file records. Metadata includes data tables, data descriptions, and data field information. Through metadata, the core definition information of data can be completely described.
[0047] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.
[0048] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0049] The Internet of Things (IoT) refers to the use of various information sensors, RFID technology, GPS, infrared sensors, laser scanners, and other devices and technologies to collect real-time data on any object or process that needs to be monitored, connected, or interacted with. This data includes information on sound, light, heat, electricity, mechanics, chemistry, biology, location, and other parameters. Through various possible network access methods, it achieves ubiquitous connectivity between things and between things and people, enabling intelligent perception, identification, and management of objects and processes. The IoT is an information carrier based on the internet and traditional telecommunications networks, enabling all independently addressable ordinary physical objects to form an interconnected network.
[0050] Cloud IoT aims to connect the information sensed and commands received by traditional IoT devices to the Internet, truly achieving networking. It also enables massive data storage and computation through cloud computing technology. Due to the nature of IoT, which involves connecting things to each other and sensing the current operating status of each "object" in real time, a large amount of data information is generated in this process. How to aggregate this information and how to sift out useful information from the massive amount of data to support decision-making for future development have become key issues affecting the development of IoT. As a result, IoT cloud based on cloud computing and cloud storage technology has become a powerful support for IoT technology and applications.
[0051] In related technologies, IoT platforms are typically deployed in the cloud, with various IoT devices directly reporting their data to the cloud. However, in industrial IoT scenarios, the cloud serves as a connection platform for various industrial IoT devices. This necessitates public network connections between these devices, located in different factories, which complicates security. Furthermore, since a large amount of non-core data exists within the devices, directly reporting to the cloud leads to a waste of transmission resources. Moreover, with a large volume of data connected to the cloud, data transmission is heavily reliant on network performance, making it difficult to guarantee data transmission efficiency and stability, thus impacting the efficiency and accuracy of subsequent data processing.
[0052] In this embodiment, the edge node is connected to the target IoT device. When it receives data to be processed from the target IoT device, the edge node obtains the stored device identifiers. When it is determined that each device identifier contains the target identifier of the target IoT device, based on the first mapping relationship between each device identifier and each candidate task, at least one target task corresponding to the target identifier is determined from each candidate task. The target attribute set corresponding to each of the at least one target task is obtained, and based on the obtained at least one target attribute set, the target data corresponding to each of the at least one target task is extracted from the data to be processed. For each of the at least one target task, the corresponding target data is transmitted to the central node.
[0053] In this way, after receiving the data to be processed from the target IoT device, the edge node filters the data and forwards a portion of it, reducing the amount of data transmitted and thus improving data transmission efficiency and stability, which in turn improves the efficiency and accuracy of subsequent data processing.
[0054] See Figure 1 The diagram illustrates a possible application scenario provided in this application embodiment. This application scenario includes a central node 110, at least one edge node 120, and at least one IoT device 130. The central node 110 is connected to each edge node 120, and each edge node 120 is connected to at least one IoT device 130.
[0055] The central node 110 can be deployed on one or more servers. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0056] A central node 110, at least one edge node 120, and at least one Internet of Things device 130 can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions.
[0057] Each edge node 120 can be deployed on one or more servers. The servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0058] As one possible implementation, a central node 110, an edge node 120, and at least one IoT device 130 connected to an edge node 120 can be set up.
[0059] As another possible implementation, considering that the IoT devices 130 may be located in different regions, in this embodiment, a central node 110 and multiple edge nodes 120 can also be set up. Each edge node connects to at least one IoT device 130 located in a region. In practical applications, regions are usually divided according to geographical location, but are not limited to this.
[0060] To ensure network and data security, each area can use a local area network (LAN) connection, but no external network connection is allowed.
[0061] Taking an industrial IoT scenario as an example, a group has multiple factories, each located in a different geographical location, and each factory contains at least one IoT device 130. Each factory is connected via an industrial local area network. Each edge node 120 is connected to each IoT device 130 in a factory area.
[0062] The IoT device 130 can be an industrial IoT device, such as a distributed control system (DCS), a programmable logic controller (PLC), or a host computer, but is not limited to these. The IoT device 130 can connect directly to the edge node 120, or it can connect to the edge node 120 through a gateway.
[0063] Edge node 120 is used for data acquisition and processing, as well as synchronizing the processed device data to the central node. Central node 110 is used for edge connection management, metadata management, and data synchronization to meet the device interconnection needs in industrial IoT scenarios.
[0064] In this embodiment of the application, the central node 110, in response to the addition operation for the edge node, obtains the node address of the edge node; when it is determined that the network connectivity of the edge node is normal based on the node address, the edge node is added; and it is used to receive target data corresponding to at least one target task sent by the edge node 120.
[0065] When edge node 120 receives data to be processed from target IoT device 130, it acquires the stored device identifiers; when it determines that each device identifier contains the target identifier of the target IoT device, it determines at least one target task corresponding to the target identifier from each candidate task based on the first mapping relationship between each device identifier and each candidate task; it acquires the target attribute set corresponding to each of the at least one target task, and extracts the target data corresponding to each of the at least one target task from the data to be processed based on the acquired at least one target attribute set; and it transmits the corresponding target data to the central node 110 for each of the at least one target task.
[0066] See Figure 2 The diagram shown illustrates the architecture of an edge node provided in this embodiment. The edge node includes a data processing module and a Platform as a Service (PaaS) component. Specifically, the data processing module includes a device management module, a data flow module, and a visualization module.
[0067] The device management module is used for connection management, device management, attribute management, rule calculation, and configuration visualization. The data flow module is used for device connection, protocol parsing, and data transmission. The visualization module is used for asset storage, asset management, streaming / offline processing, and data services. Data collected by the data flow module can be stored in a time-series database (InfluxDB). In some embodiments, device data obtained from protocol parsing can also be forwarded to the central node via Kafka. In some embodiments, the visualization module can obtain asset storage by subscribing to Kafka.
[0068] PaaS components include, but are not limited to, one or more of the following: Remote Dictionary Server (Redis), Kafka, MySQL, ClickHouse, and Infrastructure as a Service (IaaS) (containers).
[0069] See Figure 3 The diagram shown illustrates the architecture of a central node provided in this embodiment. The central node includes a console, a data development module, a data subscription module, a metadata synchronization module, a reporting module, and PaaS components. The console is used for cloud-edge management.
[0070] The data subscription model is used to store target data sent by edge nodes via ClickHouse, and for stream computing based on Flink.
[0071] The data development module is used to extract target data sent by edge nodes from ClickHouse, perform data development based on the target data, and apply the data development results to functions such as device view, configuration / cockpit, and data overview.
[0072] The metadata synchronization module is used to implement edge node management, device management, and attribute management.
[0073] The reporting module is used to implement functions such as data dashboards, report management, data calculation, and data source management. Reports can be Business Intelligence (BI) reports, but are not limited to this.
[0074] PaaS components include, but are not limited to, one or more of the following: Cloud Service Provider (CSP), Redis, Kafka, distributed search engine (Elasticsearch, ES), MySQL, ClickHouse, and IaaS (container cloud management and container platform).
[0075] It should be noted that in this embodiment of the application, the central node can be deployed in the cloud or at the edge.
[0076] See Figure 4 The diagram shown is a flowchart of a data transmission method provided in this embodiment of the application. This method is applied to an edge node, which is connected to a target IoT device. The specific process is as follows:
[0077] S401. When receiving data to be processed from the target IoT device, the edge node obtains the stored device identifiers.
[0078] The data to be processed can be the raw device data of the target IoT device, or it can refer to the device data obtained after data cleaning of the raw device data of the target IoT device. The raw device data includes, but is not limited to, information such as temperature, humidity, and rotation speed collected by the target IoT device.
[0079] In this embodiment of the application, the target IoT device may transmit the original device data to the edge node in, but is not limited to, the following ways:
[0080] Method 1: The target IoT device directly sends the raw device data to the edge node.
[0081] In Method 1, the target IoT device has the ability to communicate with the edge node. The communication protocol between the target IoT device and the edge node can be the Object Linking and Embedded Process Control (OLE for Process Control, OPC) protocol or the Modbus protocol, but is not limited to these.
[0082] Method 2: The target IoT device sends raw device data to the edge node through the IoT gateway. In Method 2, the target device may or may not have the ability to communicate with the edge node. The communication protocol between the IoT gateway and the edge node may or may not be limited to Message Queuing Telemetry Transport (MQTT) protocol.
[0083] See Figure 5 As shown, the IoT devices are industrial devices. Industrial device 1 is directly connected to the edge node, while industrial devices 2 and 3 are connected to the edge node through an industrial gateway. The edge node can process the acquired raw device data to obtain data to be processed. The edge node can store the data to be processed in a database and generate corresponding metadata. Then, after obtaining the target data based on the data to be processed, the edge node transmits the target data to the central node. The edge node can also transmit metadata to the central node.
[0084] In some embodiments, edge nodes can perform stream computing on raw device data to obtain structured data to be processed. This data can then be added to an asset instance. The stream computing is used for data cleaning, and the data cleaning process is not limited.
[0085] In some embodiments, edge nodes store raw device data into asset instances.
[0086] In some embodiments, after storing the data to be processed in a database, the edge node can also perform batch computation using Structured Query Language (SQL) on the data stored in the database, and store the batch computation results in the database. Furthermore, the batch computation results can be forwarded to Kafka or HTTP.
[0087] In some embodiments, the data to be processed, the table fields stored in the database, the data, and the batch calculation results forwarded to Kafka and HTTP can all be presented in a visual interface.
[0088] In some embodiments, after acquiring the data to be processed, the central node can perform data storage, data governance, and data modeling.
[0089] In some embodiments, the data to be processed, data modeling results, and metadata acquired by the central node can all be presented in the form of BI reports.
[0090] In some embodiments, the central node can add data to be processed to an asset instance.
[0091] It should be noted that, in this embodiment of the application, the asset instance may also include device information, which includes, but is not limited to, device type, device location, and connection relationship between devices.
[0092] For raw device data, on the one hand, stream computing can be used to obtain stream-processed data; on the other hand, the raw device data in the database can be batch-processed, and the batch processing results can be visualized. Both raw device data and stream-processed data can be referred to as asset instances. Resource instances can be transmitted to the central node through a message subscription mechanism. Metadata can be transmitted to the central node via HTTP.
[0093] S402. When it is determined that each device identifier contains the target identifier of the target IoT device, the edge node determines at least one target task corresponding to the target identifier from each candidate task based on the first mapping relationship between each device identifier and each candidate task.
[0094] It should be noted that, in the embodiments of this application, the task refers to filtering the data to be processed based on the target attribute set to obtain the target data.
[0095] Specifically, the first mapping relationship stores the mapping relationship between each device identifier and the task identifier of each candidate task. Based on the mapping relationship between each device identifier and the task identifier of each candidate task, the edge node determines at least one task identifier corresponding to the target identifier from the task identifiers of each candidate task, and takes the candidate task corresponding to the determined at least one task identifier as at least one target task.
[0096] In this embodiment, the identifier may be represented by, but is not limited to, a serial number (ID). The candidate tasks corresponding to each device identifier may be the same, different, or partially the same; there is no limitation on this.
[0097] For example, suppose the first mapping relationship stores device identifiers for Device 1, Device 2, and Device 3. Device ID1 is Device ID1, Device ID2 is Device ID2, and Device ID3 is Device ID3. Device ID1 corresponds to Task ID1, Task ID2, and Task ID3; Device ID2 corresponds to Task ID1 and Task ID3; and Device ID3 corresponds to Task ID4, Task ID5, and Task ID6. Task ID1 through Device ID6 are the task identifiers for Tasks 1 through 6, respectively. Tasks 1 through 6 are all candidate tasks. Taking Tasks 1 and 2 as examples, Task 1 is used to filter device data corresponding to temperature and humidity, and Task 2 is used to filter device data corresponding to temperature.
[0098] Taking the target IoT device as device 1 as an example, the target identifier is device ID1. In the first mapping relationship, the task identifiers corresponding to device ID1 are task ID1, task ID2, and task ID3. Based on the mapping relationship between each device identifier and the task identifiers of each candidate task, the edge node determines the task ID1, task ID2, and task ID3 corresponding to device ID1 from the task identifiers of each candidate task. The candidate tasks corresponding to the determined task ID1, task ID2, and task ID3 are taken as at least one target task, that is, task 1, task 2, and task 3 are taken as target tasks.
[0099] Taking the target IoT device as device 2 as an example, the target identifier is device ID2. In the first mapping relationship, the task identifiers corresponding to device ID2 are task ID1 and task ID3. Based on the mapping relationship between each device identifier and the task identifiers of each candidate task, the edge node determines the task ID1 and task ID3 corresponding to device ID2 from the task identifiers of each candidate task, and takes the candidate tasks corresponding to the determined task ID1 and task ID3 as at least one target task, that is, task 1 and task 3 as target tasks.
[0100] S403. The edge node obtains at least one target attribute set corresponding to each target task, and extracts at least one target data corresponding to each target task from the data to be processed based on the obtained at least one target attribute set.
[0101] In this embodiment, the data to be processed includes attribute values corresponding to one or more attributes. Attributes include, but are not limited to, temperature, humidity, pressure, and rotational speed. It should be noted that, in this embodiment, attributes can also be referred to as points.
[0102] It should be noted that the target data corresponding to the target task refers to the device data extracted from the data to be processed based on the target attribute set corresponding to the target task.
[0103] For example, suppose the target task is Task 1, which is used to acquire temperature and humidity data. The data to be processed contains 10,000 device data records. The edge node acquires the target attribute set {temperature, humidity} corresponding to Task 1, and based on the acquired target attribute set {temperature, humidity}, extracts 2 target data records from the 10,000 data records contained in the data to be processed. One target data record is the device data corresponding to temperature, and the other target data record is the device data corresponding to humidity.
[0104] S404. For at least one target task, the edge node transmits the corresponding target data to the central node.
[0105] In this embodiment of the application, through the above implementation method, after receiving the data to be processed from the target IoT device, the edge node filters the data to be processed and forwards a portion of the data, thereby reducing the amount of data transmitted, thus improving the data transmission efficiency and stability, and further improving the efficiency and accuracy of subsequent data processing.
[0106] In some embodiments, a group platform may be deployed in the central node, allowing users to configure foreground tasks. Foreground task configuration includes one or more of the following: task creation, task updating, and viewing existing tasks. Task creation specifically involves configuration operations such as device configuration, forwarding configuration, and attribute configuration; task updating specifically involves update operations such as forwarding configuration updates and attribute configuration updates; and the function to view existing tasks is used to view created tasks. The task creation and task updating functions are described below.
[0107] The task creation function includes one or more of the following: device configuration, forwarding configuration, and attribute configuration.
[0108] Specifically, device configuration can be achieved in, but is not limited to, the following ways: in response to a device configuration operation for at least one target task, the central node obtains a second mapping relationship between the target identifier and at least one target task, and stores the second mapping relationship in the first mapping relationship.
[0109] The device configuration operation for at least one target task can refer to the operation of associating at least one target task with a target IoT device. The second mapping relationship includes a target identifier and a task identifier for each of the at least one target task.
[0110] For example, suppose the target identifier of the target IoT device is device ID1, the task identifier of task 1 is task ID1, the task identifier of task 2 is task ID2, and the task identifier of task 3 is task ID3. The user associates device ID1 with task 1, task 2, and task 3. The central node responds to the device configuration operation for task 1, task 2, and task 3, obtains the second mapping relationship between device ID1 and task ID1, task ID2, and task 3, and stores the second mapping relationship in the first mapping relationship.
[0111] Specifically, attribute configuration can be implemented in, but is not limited to, the following ways: the central node responds to the attribute configuration operation for at least one target task and obtains the configuration information corresponding to each target task, and each configuration information contains at least the target attribute set of the corresponding target task.
[0112] It should be noted that in the embodiments of this application, attributes can also be referred to as points, and attribute configuration can also be referred to as point configuration.
[0113] For example, the central node presents a set of candidate attributes for the target IoT device to the user in the operation interface. The user can select one or more target attributes from the set of candidate attributes for at least one target task. In response to the attribute configuration operation for at least one target task, the central node obtains the configuration information corresponding to at least one target task, wherein each configuration information contains at least the target attribute set of the corresponding target task.
[0114] For example, the candidate attributes in the candidate attribute set of the target IoT device include temperature, humidity, and rotation speed. For target task 1, the user selects temperature and humidity as target attributes from the candidate attribute set; for target task 2, the user selects temperature as the target attribute from the candidate attribute set. The central node responds to the attribute configuration operation for target task 1 by obtaining configuration information 1 corresponding to target task 1, which at least contains the target attribute set {temperature, humidity} for target task 1. Similarly, the central node responds to the attribute configuration operation for target task 2 by obtaining configuration information 2 corresponding to target task 2, which at least contains the target attribute set {temperature} for target task 2.
[0115] Through the above implementation, on the one hand, users can configure devices and attributes on the front end, reducing the difficulty of user operation and thus improving the user experience; on the other hand, by configuring devices and attributes, the data to be processed can be processed quickly, improving data processing efficiency.
[0116] In some embodiments, before executing S402, the edge node can use a Bloom filter to determine whether the target task is stored in the cache. A Bloom filter can be used to retrieve whether an element is in a set. In this embodiment, the element includes a target identifier and a target attribute set corresponding to the target task. The set may contain device identifiers and attribute sets corresponding to each candidate task. The specific implementation of the Bloom filter is not limited thereto.
[0117] If the target identifier is not in the Bloom filter, or if none of the attributes contained in the data to be processed are in the Bloom filter, then it is determined that there is no target task related to the data to be processed. If the target identifier exists in the Bloom filter, and at least one attribute in the data to be processed exists in the Bloom filter, then it is determined that there is a target task related to the data to be processed. Then, based on the first mapping relationship between each device identifier and each candidate task, at least one target task corresponding to the target identifier is determined from each candidate task.
[0118] Clearly, the above implementation method can quickly filter out target tasks and speed up data forwarding.
[0119] In some embodiments, during the execution of S404, due to cross-network data forwarding, data transmission between the central node and edge nodes can be achieved through a message queue (MQ). Specifically, the MQ mechanism can be implemented using Kafka and / or MQTT, without limitation. This article only uses the transmission of target data based on Kafka as an example for illustration.
[0120] Specifically, the edge nodes send the target data to a third-party node used for message subscription, and the third-party node then transmits the target data to the central node. This third-party node is a Kafka node.
[0121] When using a message subscription mechanism, the task creation function also includes forwarding configuration. Specifically, forwarding configuration can be implemented in, but is not limited to, the following ways:
[0122] In response to a forwarding configuration operation for at least one target task, the central node obtains the forwarding address corresponding to each of the at least one target task and stores the obtained forwarding address into the corresponding configuration information.
[0123] The forwarding address is the address information of the third-party node, i.e., the Kafka address information. The address information can be represented by an IP address, or by an IP address and a port number; there are no restrictions on this.
[0124] For example, a user configures a forwarding address for target task 1 as the node address of Kafka node 1: 1.1.1.1, and for target task 2 as the node address of Kafka node 2: 1.1.1.2. The central node responds to the forwarding configuration operation for target task 1 by obtaining forwarding address 1 corresponding to target task 1, which is the node address of Kafka node 1: 1.1.1.1. The central node responds to the forwarding configuration operation for target task 2 by obtaining forwarding address 2 corresponding to target task 2, which is the node address of Kafka node 2: 1.1.1.2.
[0125] In some embodiments, a task update specifically involves one or more of the following: a forwarding configuration update and an attribute configuration update.
[0126] Specifically, attribute configuration updates can be implemented using, but are not limited to, the following operations: In response to a task update operation for at least one target task, the central node suspends at least one target task and obtains configuration update information; based on the configuration update information, the central node updates at least one configuration piece of information to obtain at least one updated configuration piece of information, and based on at least one updated configuration piece of information, restarts at least one target task.
[0127] Specifically, a task update operation targeting at least one objective task refers to user input of configuration update information. This configuration update information may include one or more of the following: forwarding update information and attribute update information.
[0128] In the first scenario, the user modifies both the forwarding configuration and the attribute configuration.
[0129] Specifically, in response to a task update operation for at least one target task, the central node suspends at least one target task and obtains configuration update information, which includes forwarding update information and attribute update information. Based on the forwarding update information contained in the configuration update information, the central node updates the forwarding addresses corresponding to each of the at least one target task, and updates the target attribute sets corresponding to each of the at least one target task based on the attribute update information contained in the configuration update information. Based on the updated forwarding addresses and updated target attribute sets, the central node obtains at least one updated configuration information and restarts at least one target task based on the at least one updated configuration information.
[0130] Taking Task 1 as an example, the configuration information for Task 1 includes its forwarding address and target attribute set. The forwarding address is the node address of Kafka node 1 (1.1.1.1), and the target attribute set is {temperature, humidity}. In response to a task update operation for Task 1, the central node pauses Task 1 and obtains its configuration update information. This update includes forwarding update information and attribute update information. The forwarding update information indicates that the forwarding address of Task 1 has been updated to the node address of Kafka node 3 (1.1.1.3), and the attribute update information indicates that the target attribute set of Task 1 has been updated to {temperature, rotation speed}. Then, based on the forwarding update information in the configuration update information, the central node updates the forwarding address of Task 1 and the target attribute set corresponding to Task 1. Then, the central node obtains the updated configuration information based on the updated forwarding address and the updated target attribute set. In the updated configuration information, the forwarding address corresponding to task 1 is the node address 1.1.1.3 of Kafka node 3, and the target attribute set of task 1 is {temperature, rotation speed}. Based on at least one updated configuration information, task 1 is restarted.
[0131] In the second scenario, the user modifies the forwarding configuration.
[0132] Specifically, in response to a task update operation for at least one target task, the central node suspends at least one target task and obtains configuration update information, which includes forwarding update information. Based on the forwarding update information contained in the configuration update information, the central node updates the forwarding addresses corresponding to each of the at least one target task. Based on the at least one updated forwarding address, it obtains at least one updated configuration information and restarts at least one target task based on the at least one updated configuration information.
[0133] Taking task 1 as the target task as an example, the central node responds to the task update operation for task 1 by pausing task 1 and obtaining the configuration update information for task 1. The configuration update information includes forwarding update information, which indicates that the forwarding address of task 1 is updated to the node address of Kafka node 3: 1.1.1.3. Then, based on the forwarding update information contained in the configuration update information, the central node updates the forwarding address of task 1. After that, based on the updated forwarding address, it obtains the updated configuration information. In the updated configuration information, the forwarding address corresponding to task 1 is the node address of Kafka node 3, 1.1.1.3, and the target attribute set of task 1 is {temperature, humidity}. Based on at least one updated configuration information, task 1 is restarted.
[0134] In the third scenario, the user modifies all attribute configurations.
[0135] Specifically, in response to a task update operation for at least one target task, the central node suspends at least one target task and obtains configuration update information, which includes attribute update information; based on the attribute update information contained in the configuration update information, it updates the target attribute set corresponding to each of the at least one target task; based on the updated target attribute set, it obtains at least one updated configuration information; and based on at least one updated configuration information, it restarts at least one target task.
[0136] Taking Task 1 as the target task as an example, the central node responds to the task update operation for Task 1 by pausing Task 1 and obtaining the configuration update information for Task 1. The configuration update information includes attribute update information, which indicates that the target attribute set of Task 1 is updated to {temperature, rotational speed}. Then, based on the attribute update information contained in the configuration update information, the central node updates the target attribute set corresponding to Task 1. After that, based on the updated target attribute set, it obtains the updated configuration information. In the updated configuration information, the forwarding address corresponding to Task 1 is the node address 1.1.1.1 of Kafka node 1, and the target attribute set of Task 1 is {temperature, rotational speed}. Based on at least one updated configuration information, Task 1 is restarted.
[0137] In some embodiments, to improve data acquisition speed, configuration information is stored in a database and a cache. During execution S403, the edge node obtains the target attribute set corresponding to at least one target task by reading the target attribute set corresponding to each target task stored in the cache.
[0138] If the edge node does not find the corresponding target attribute set when reading the cache, it can obtain the target attribute set corresponding to at least one target task by reading the target attribute set corresponding to each target task stored in the database, and update the cache with the obtained target attribute set corresponding to each target task.
[0139] If the database does not find the target attribute set corresponding to at least one target task, an empty flag can be set in the cache to prevent cache penetration. The empty flag can be an empty value or a default value.
[0140] Cache penetration refers to a situation where the requested data is neither in the cache nor in the database. For fault tolerance, if the data cannot be found in the database, it is not written to the cache. This results in every request querying the database, rendering the cache meaningless. Under high concurrency or frequent attacks using non-existent keys, the database pressure increases dramatically, potentially leading to a crash. It should be noted that in this embodiment, other methods can also be used to prevent cache penetration, and there are no limitations on this approach.
[0141] When caching configuration information, the key is the task identifier, and the value is a hash structure, which is a collection of key-value pairs. The key within the value is the attribute name, and the value within the value is the attribute value. The key in the value can include one or more of the following: task status, Kafka address information, MQTT address information, and attribute list information. The task status represents the running status of the corresponding task. The attribute list information stores the attributes corresponding to the task.
[0142] In some embodiments, to improve data acquisition speed, the first mapping relationship between each device identifier and each candidate task can also be stored in a database and a cache. During execution S402, the edge node reads the first mapping relationship stored in the cache.
[0143] When caching the first mapping relationship, the key is the device identifier of the IoT device, and the value is the task identifier set, which is a set structure. The task identifier set contains the task identifiers of the corresponding tasks.
[0144] Taking device 1 as an example, the key in the cache is device ID1, and the value is the task identifier set {task ID1, task ID2, task ID3}.
[0145] In some embodiments, to ensure data consistency between the cache and the database, when updating the cache, the cache is deleted first, then the database is updated, and then the cache update is delayed. Specifically, cache updates can employ, but are not limited to, the following operations:
[0146] The edge node deletes at least one configuration information in the cache and updates at least one configuration information stored in the database with at least one updated configuration information. When the cache delay update duration reaches a preset duration threshold, the edge node stores at least one updated configuration information in the cache. The cache delay update duration is used to characterize the duration from the time of the database update to the current time.
[0147] The preset duration threshold can be set for each key in the configuration information. For example, the preset duration threshold for each key is 10 minutes.
[0148] For example, see Figure 6 As shown, assuming the configuration information before the update is configuration information 1 and the configuration information after the update is configuration information 1s, the edge node deletes configuration information 1 from the cache, and then updates the configuration information 1 stored in the database to configuration information 1s. When the time elapsed between the database update time and the current time reaches 10 minutes, that is, when the cache update delay time reaches 10 minutes, the edge node stores configuration information 1s in the cache.
[0149] In some embodiments, a cache update is performed when at least one of the following events is triggered: task creation, task update, task deletion, task start / stop, attribute addition / deletion.
[0150] In some embodiments, when an edge node determines that at least one target task has started, it creates at least one message transmission channel corresponding to each target task. During execution S404, the edge node determines the message transmission channel corresponding to each target data based on the correspondence between the at least one target task and the extracted target data, and based on the correspondence between the at least one target task and the at least one created message transmission channel; using the corresponding message transmission channel, each target data is sent to the central node.
[0151] Specifically, when creating the message transmission channel corresponding to each of the at least one target task, the following operations may be used, but are not limited to:
[0152] Edge nodes acquire configuration information corresponding to at least one target task. Each configuration information contains the node address of a third-party node, which is used to represent a message subscription node that forwards the target message of the corresponding target task. Based on the data forwarding address, at least one message transmission channel corresponding to each target task is created.
[0153] To improve data reading speed, edge nodes can also store the mapping relationship between target tasks and message transmission channels in the cache.
[0154] Taking Kafka as an example, Kafka, as a messaging system, has three basic components: Producer, Broker, and Consumer. The Producer publishes messages, the Broker receives and stores messages from the Producer, and the Consumer consumes messages. In this embodiment, the message transmission channel is a Producer instance.
[0155] Assuming the target task is task 1, when task 1 starts, the edge node queries the database for the forwarding address of task 1, and then initializes the corresponding producer instance based on the forwarding address of task 1. The edge node stores the mapping relationship between task 1 and producer instances in its cache.
[0156] When the edge node receives data to be processed from the target IoT device, it obtains the stored device identifiers. When it is determined that each device identifier contains the target identifier of the target IoT device, based on the first mapping relationship between each device identifier and each candidate task, it determines the target task corresponding to the target identifier as task 1 from each candidate task. Then, it obtains the target attribute set corresponding to task 1, and based on the obtained target attribute set of task 1, it extracts the target data corresponding to task 1 from the data to be processed.
[0157] Subsequently, based on the correspondence between Task 1 and the target data, and based on the correspondence between Task 1 stored in the cache and at least one message transmission channel created, the edge node determines that the message transmission channel corresponding to the target data is the producer instance corresponding to Task 1, and uses the producer instance corresponding to Task 1 to transmit the target data to the central node.
[0158] It should be noted that in this embodiment of the application, when using the subscription model, the consumer can subscribe to one or more topics using the subscribe interface. As an example, multiple topics can be subscribed to as a set; as another example, topics with a specific pattern can be subscribed to using regular expressions. There is no limitation on this. For example, the consumer subscribes to the topic_device_data, where topic_device_data represents the pending data of the target IoT device.
[0159] Through the above implementation method, based on the message subscription mechanism, data transmission between edge nodes and central nodes is realized, thereby enabling cross-network data transmission when edge nodes and central nodes are located in different networks, improving data transmission efficiency while ensuring network security.
[0160] In some embodiments, the mapping relationship between target tasks and message transmission channels is stored in a cache. Edge nodes periodically check whether the forwarding addresses of target tasks stored in the database have changed. When it is determined that the forwarding addresses of target tasks stored in the database have changed, a new message transmission channel is created based on the changed forwarding address, and the cached mapping relationship between target tasks and message transmission channels is updated based on the new message transmission channel. For example, the timeout period can be 1 minute.
[0161] See Figure 7The diagram shown is a flowchart of a data transmission method provided in an embodiment of this application. This process is applied to a central node, and the specific process is as follows:
[0162] S701, the central node responds to the addition operation for the edge node and obtains the node address of the edge node.
[0163] The addition of edge nodes can be triggered by users through the group platform.
[0164] For example, in response to the add operation for edge node 1, the central node obtains the node address of edge node 1, which is 1.1.1.10.
[0165] S702. When the network connectivity of the edge node is determined to be normal based on the node address, the central node adds the edge node and receives the target data corresponding to at least one target task sent by the edge node.
[0166] For example, the central node can send connectivity test information to the edge node based on the node address, and when it receives the test response from the edge node, it determines that the network connectivity of the edge node is normal.
[0167] In some embodiments, to improve transmission security, when executing S701, the central node, in response to the addition operation for the edge node, obtains the node address of the edge node and the authentication information of the operation object. Accordingly, adding the edge node includes: the central node sending the authentication information to the edge node, and adding the edge node to the edge side upon receiving a verification pass response from the edge node.
[0168] The operation object refers to the object that triggers the add operation on the edge node. The authentication information of the operation object can be a key pair, which includes secretID and secretKey. SecretID is used to identify the identity of the interface caller. SecretKey is used to encrypt the signature string and verify the signature on the server side.
[0169] For example, suppose the operation target is account A. In response to the add operation for edge node 1, the central node obtains the node address of edge node 1 and the key pair of account A. The key pair includes the secretID and secretKey of account A. The central node sends the key pair of account A to edge node 1 and adds edge node 1 to the edge side when it receives the verification pass response returned by edge node 1.
[0170] By implementing the above methods, a secure connection between edge nodes and central nodes can be ensured, thereby effectively preventing data leakage and further improving data security.
[0171] To synchronize and store data between the central node and the edge nodes, the first step is to synchronize metadata. This involves synchronizing the metadata from the edge nodes to the central node, and then the central node creates a data table for data storage based on the metadata.
[0172] See Figure 8 The diagram shown is a flowchart of a data synchronization method provided in this embodiment of the application. This method is applied to a central node, and the specific process is as follows:
[0173] S801, the central node responds to the metadata synchronization operation and synchronizes the metadata stored in the central node and the edge nodes.
[0174] In this embodiment of the application, metadata includes one or more of device information and device attribute information, but is not limited to these.
[0175] Specifically, when synchronizing metadata stored in the central node and edge nodes, the following operations can be used, but are not limited to:
[0176] S8011, The central node obtains the first set of identifiers stored in the central node, where each first identifier is used to represent an Internet of Things device.
[0177] For example, the central node obtains the first set of identifiers stored in the central node, which includes device ID1, device ID2, and device ID3.
[0178] S8012. The central node obtains the second set of identifiers stored in the edge nodes through the edge nodes. Each second identifier is used to represent an Internet of Things device.
[0179] The central node can obtain the second set of identifiers stored in the edge node by calling the edge interface (openAPI).
[0180] For example, the central node obtains the second set of identifiers stored in the edge nodes through the edge nodes. The second set of identifiers contains device ID1, device ID3, and device ID4.
[0181] S8013, the central node determines the set of devices to be deleted and the set of devices to be modified based on the first and second identifier sets.
[0182] Specifically, when executing S8013, for each first identifier in the first identifier set, the following operations are performed respectively:
[0183] If a first identifier is different from all the second identifiers, the central node will treat the IoT device corresponding to the first identifier as a device to be deleted.
[0184] If a first identifier is the same as a second identifier, the central node obtains the first data update time corresponding to the first identifier and the second data update time corresponding to the second identifier. If the first data update time and the second data update time are different, the IoT device corresponding to the first identifier is regarded as a device to be updated.
[0185] Taking the first identifier x as an example, the first identifier x is any first identifier in the first identifier set. The central node matches the first identifier with each second identifier contained in the second identifier set.
[0186] If the matching result indicates that the first identifier is different from all the second identifiers, that is, there is no second identifier in the set of second identifiers that is the same as the first identifier, then the central node will treat the IoT device corresponding to the first identifier x as a device to be deleted.
[0187] If the matching result indicates that the first identifier x and the second identifier y are the same, and the second identifier y is any second identifier in the set of second identifiers (i.e., there exists a second identifier in the set that is the same as the first identifier), then the central node further determines whether the first data update time corresponding to the first identifier x is the same as the second data update time corresponding to the second identifier y. If the first data update time corresponding to the first identifier x is not the same as the second data update time corresponding to the second identifier y, then the central node treats the IoT device corresponding to the first identifier x as a device to be updated.
[0188] For example, see Figure 9 As shown, the first identifier set contains device ID1, device ID2, and device ID3, and the second identifier set contains device ID1, device ID3, and device ID4.
[0189] First, for device ID1 in the first identifier set, the central node matches device ID1 in the first identifier set with device ID1, device ID3, and device ID4 in the second identifier set. The matching result indicates that device ID1 in the first identifier set is the same as device ID1 in the second identifier set. Then, the central node judges whether the first data update time corresponding to device ID1 in the first identifier set is the same as the second data update time corresponding to device ID1 in the second identifier set. If the first data update time corresponding to device ID1 in the first identifier set is different from the second data update time corresponding to device ID1 in the second identifier set, then IoT device 1 corresponding to device ID1 in the first identifier set is regarded as a device to be updated.
[0190] Secondly, for device ID2 in the first identifier set, the central node matches device ID2 in the first identifier set with device ID1, device ID3, and device ID4 in the second identifier set. The matching result indicates that device ID2 in the first identifier set is different from each of the second identifiers in the second identifier set. The IoT device 2 corresponding to device ID2 in the first identifier set is regarded as a device to be deleted.
[0191] Finally, for device ID3 in the first identifier set, the central node matches device ID3 in the first identifier set with device ID1, device ID3, and device ID4 in the second identifier set. The matching result indicates that device ID3 in the first identifier set is the same as device ID3 in the second identifier set. Then, the central node judges whether the first data update time corresponding to device ID3 in the first identifier set is the same as the second data update time corresponding to device ID3 in the second identifier set. If the first data update time corresponding to device ID3 in the first identifier set is the same as the second data update time corresponding to device ID3 in the second identifier set, then no processing is performed on IoT device 3 corresponding to device ID3 in the first identifier set.
[0192] S8014. The central node deletes the metadata of each device to be deleted from the set of devices to be deleted in the database, and updates the metadata of each device to be updated from the set of devices to be updated in the database.
[0193] For example, the central node deletes the metadata of IoT device 2 from the database, and updates the metadata corresponding to the IoT device from the database.
[0194] S802. The central node creates a storage table to store the data of each target based on the synchronized metadata.
[0195] In this embodiment, the storage table may be, but is not limited to, the ClickHouse storage table. The ClickHouse storage table may also be referred to as the CK storage table.
[0196] S803, the central node stores the received target data into the created storage table.
[0197] The above implementation method synchronizes metadata between the central node and edge nodes, ensuring consistency between their metadata. Furthermore, metadata synchronization is achieved by matching the first set of identifiers stored in the central node with the second set of identifiers stored in the edge nodes. This simple operation reduces data processing time and improves efficiency. Moreover, by incorporating data update time into the matching process, devices to be updated and deleted can be effectively identified, improving accuracy and efficiency.
[0198] Since device information may change at any time, a synchronization mechanism is needed to ensure that the metadata information of the central node and the edge nodes is synchronized in real time, thereby avoiding data inconsistency. In this embodiment, S8011-S8014 can be executed periodically. By adjusting the time interval, the real-time synchronization of metadata information between the central node and the edge nodes can be achieved to a certain extent. For example, the time interval can be 5 seconds.
[0199] In some embodiments, the central node can manage edge nodes, enabling edge node management and status monitoring. Status monitoring includes heartbeat and connection verification. Connection verification refers to authorization verification during data acquisition. Specifically, the central node obtains the authentication information of the operation object and sends it to the edge node, allowing the edge node to perform verification based on the authentication information. Upon receiving a successful verification response from the edge node, the central node adds the edge node to the edge side. The heartbeat mechanism is used by the central node to connect to the edge node in real time and monitor its status. When a group node cannot connect to the edge node's heartbeat, a connection failure can be determined, and fault diagnosis can be performed. In this embodiment, the implementation of the heartbeat mechanism is not limited.
[0200] See Figure 10 As shown, this is a schematic diagram of the interaction between a central node and an edge node provided in an embodiment of this application. The central node is equipped with a group platform, an edge management module, an edge status monitoring module, and a data receiving module, while the edge node is equipped with an edge platform and a heartbeat service module.
[0201] S1001. The group platform sends a key pair retrieval request to the edge platform. Specifically, the group platform can respond to the input operation of the target object's object information by sending a key pair retrieval request to the edge platform.
[0202] S1002. The edge platform generates a key pair based on the object information of the target object. The key pair includes: secretID and secretKey.
[0203] S1003, The group platform receives the key pair returned by the edge platform.
[0204] S1004. In response to the target object's operation to add an edge node, the group platform sends an edge node add request to the edge management module of the central node. The edge node add request carries the node address of the edge node and the secretKey key pair.
[0205] S1005, The edge management module of the central node determines that the network connectivity of the edge node is normal.
[0206] S1006. The edge management module of the central node sends a key pair verification request to the edge platform. The key pair verification request carries the key pair.
[0207] S1007. The edge platform returns a verification successful response to the edge management module of the central node. Specifically, when the edge platform determines that it has the key pair carried in the key pair verification request stored locally, it determines that the key pair verification has passed.
[0208] S1008, The edge management module of the central node adds edge nodes to the edge side.
[0209] S1009, The edge management module of the central node returns a completion response to the group platform.
[0210] S1010: The edge status monitoring module of the central node sends a heartbeat request to the heartbeat service module of the edge node.
[0211] S1011, The heartbeat service module of the edge node returns heartbeat data to the edge status monitoring module of the central node.
[0212] S1012, The edge status monitoring module of the central node updates the node status of the edge nodes, synchronizes the last time, and periodically detects the heartbeat of the edge nodes.
[0213] S1013, The edge management module of the central node receives metadata synchronization instructions from the group platform.
[0214] S1014. The edge management module of the central node synchronizes the metadata stored in the central node and the edge nodes.
[0215] S1015, The edge management module of the central node creates a storage table for storing data of each target based on synchronized metadata.
[0216] S1016, The edge management module of the central node sends an instruction to the data receiving module to add a subscription task.
[0217] S1017, The data receiving module of the central node returns a task response to the edge management module.
[0218] S1018, The edge management module of the central node returns a synchronization response to the group platform.
[0219] S1019. The data receiving module of the central node stores the received target data into the created storage table. Specifically, the data receiving module of the central node receives Kafka data, performs data parsing and verification on the Kafka data, and then stores the data into the created storage table.
[0220] Given the massive amount of data, to ensure data consistency and stability, and since metadata synchronization affects the parsing of subsequent device data (i.e., target data), data synchronization can be achieved through a combination of real-time writing, scheduled synchronization, and asynchronous writing. Specifically, the central node first retrieves the metadata and stores it in a cache. The backend can periodically fetch the metadata, and after fetching the metadata, create a storage table. This solves the latency issues of batch data synchronization and batch table creation while performing data synchronization.
[0221] For example, see Figure 11 As shown, this is a schematic diagram of the interaction between a central node and an edge node provided in an embodiment of this application. The central node is equipped with a group platform, an edge management module, an asset synchronization service module, and a CK service module, while the edge node is equipped with an edge platform.
[0222] S1101, The edge management module of the central node receives metadata synchronization instructions from the group platform.
[0223] S1102, The edge management module of the central node synchronizes the metadata stored in the central node and the edge nodes.
[0224] S1103, The edge management module of the central node creates a storage table for storing data of each target based on synchronized metadata.
[0225] S1104. The edge management module of the central node sends an information caching instruction to the asset synchronization service module. The information caching instruction is used to cache metadata.
[0226] S1105, The edge management module of the central node returns a synchronization response to the group platform.
[0227] S1106. The asset synchronization service module of the central node writes metadata into the cache and reads the metadata stored in the cache periodically.
[0228] S1107. The asset synchronization service module of the central node sends a metadata query request to the edge platform. Specifically, the central node can call the node interface to implement S1106-S1107.
[0229] S1108. The edge platform returns metadata to the asset synchronization service module of the central node.
[0230] S1109. The asset synchronization service module of the central node sends a table creation request to the CK service module based on the returned metadata. The table creation request carries metadata or table creation information.
[0231] The S1110 and CK service modules create storage tables and fields within those tables.
[0232] S1111, the CK service module returns a creation response to the asset synchronization service module.
[0233] S1112. The central node's asset synchronization service module synchronizes the connection status and receives target data.
[0234] The creation process of the CK table in S1108-S1110 is an asynchronous process.
[0235] Based on the same inventive concept, embodiments of this application provide a data transmission device. For example... Figure 12 As shown, this is a schematic diagram of the structure of the data transmission device 1200, which may include:
[0236] The acquisition unit 1201 is used to acquire the stored device identifiers when it receives data to be processed from the target IoT device.
[0237] The determining unit 1202 is used to determine at least one target task corresponding to the target identifier from the candidate tasks based on a first mapping relationship between the device identifiers and the candidate tasks when it is determined that each device identifier contains a target identifier of the target IoT device.
[0238] Extraction unit 1203 is used to obtain the target attribute set corresponding to each of the at least one target task, and extract the target data corresponding to each of the at least one target task from the data to be processed based on the obtained at least one target attribute set;
[0239] The transmission unit 1204 is used to transmit the corresponding target data to the central node for the at least one target task.
[0240] As one possible implementation, a configuration unit 1205 is also included. The configuration unit 1205 is not shown in the figure. The configuration unit 1205 is used for:
[0241] In response to a device configuration operation for the at least one target task, a second mapping relationship between the target identifier and the at least one target task is obtained, and the second mapping relationship is stored in the first mapping relationship;
[0242] In response to the attribute configuration operation for the at least one target task, configuration information corresponding to each of the at least one target task is obtained, and each configuration information contains at least the target attribute set of the corresponding target task.
[0243] As one possible implementation, configuration unit 1205 is also used for:
[0244] In response to a task update operation for the at least one target task, the at least one target task is paused, and configuration update information is obtained;
[0245] Based on the configuration update information, the at least one configuration information is updated to obtain at least one updated configuration information, and based on the at least one updated configuration information, the at least one target task is restarted.
[0246] As one possible implementation, configuration unit 1205 is also used for:
[0247] Delete the at least one configuration information from the cache;
[0248] Update the at least one configuration information stored in the database to the at least one updated configuration information;
[0249] When the cache delay update duration reaches a preset duration threshold, the at least one updated configuration information is stored in the cache, whereby the cache delay update duration is used to characterize the duration from the database update time to the current time.
[0250] As one possible implementation, configuration unit 1205 is also used for:
[0251] When it is determined that the at least one target task is started, a message transmission channel corresponding to each of the at least one target task is created;
[0252] When transmitting the corresponding target data to the central node for the at least one target task, the transmission unit 1204 is specifically used for:
[0253] Based on the correspondence between the at least one target task and the extracted target data, and based on the correspondence between the at least one target task and the at least one created message transmission channel, the message transmission channel corresponding to each target data is determined.
[0254] Each target data is sent to the central node using the corresponding message transmission channel.
[0255] As one possible implementation, when creating the message transmission channel corresponding to each of the at least one target task, the configuration unit 1205 is specifically used for:
[0256] Obtain the configuration information corresponding to each of the at least one target task. Each configuration information contains the node address of a third-party node, which is used to represent a message subscription node that forwards the target message of the corresponding target task.
[0257] Based on the data forwarding address, a message transmission channel corresponding to each of the at least one target task is created.
[0258] Based on the same inventive concept, embodiments of this application provide a data transmission device. For example... Figure 13 As shown, this is a schematic diagram of the structure of the data transmission device 1300, which may include:
[0259] The acquisition unit 1301 is used to acquire the node address of the edge node in response to the addition operation for the edge node;
[0260] The receiving unit 1302 is configured to add the edge node and receive target data corresponding to at least one target task sent by the edge node when it is determined that the network connectivity of the edge node is normal based on the node address.
[0261] Wherein, each target data is the data to be processed that the edge node receives the data to be processed from the target IoT device and determines that the target IoT device’s target identifier is included in the stored device identifiers. Based on the first mapping relationship between each device identifier and each candidate task, the edge node determines the at least one target task corresponding to the target identifier and extracts it from the data to be processed based on the target attribute set corresponding to each of the at least one target task.
[0262] As one possible implementation, when obtaining the node address of an edge node in response to an add operation for that edge node, the acquisition unit 1301 is specifically used for:
[0263] In response to an operation to add an edge node, obtain the node address of the edge node and the authentication information of the operation object;
[0264] When it is determined based on the node address that the network connectivity of the edge node is normal, adding the edge node includes:
[0265] When the network connectivity of the edge node is determined to be normal based on the node address, the authentication information is sent to the edge node, and upon receiving the verification pass response from the edge node, the edge node is added to the edge side.
[0266] As one possible implementation, a synchronization unit 1303 is also included. Synchronization unit 1303 is not shown in the figure. Synchronization unit 1303 is used for:
[0267] In response to the metadata synchronization operation, the metadata stored in the central node and the edge nodes is synchronized; based on the synchronized metadata, a storage table is created to store the target data.
[0268] The received target data is stored in the created storage table.
[0269] As one possible implementation, when synchronizing the metadata stored in the central node and the edge nodes, the synchronization unit 1303 is specifically used for:
[0270] Obtain the first set of identifiers stored in the central node, where each first identifier is used to represent an Internet of Things (IoT) device;
[0271] The edge node is used to obtain a second set of identifiers stored in the edge node, and each second identifier is used to represent an Internet of Things device;
[0272] Based on the first identifier set and the second identifier set, determine the set of devices to be deleted and the set of devices to be modified;
[0273] In the database, delete the metadata of each device to be deleted from the set of devices to be deleted, and update the metadata of each device to be updated from the set of devices to be updated.
[0274] As one possible implementation, when determining the set of devices to be deleted and the set of devices to be updated based on the first identifier set and the second identifier set, the synchronization unit 1303 is specifically used for:
[0275] For each first identifier in the first identifier set, perform the following operations:
[0276] If a first identifier is different from all the second identifiers, then the IoT device corresponding to the first identifier is regarded as a device to be deleted.
[0277] If a first identifier is the same as a second identifier, then the first data update time corresponding to the first identifier and the second data update time corresponding to the second identifier are obtained. If the first data update time and the second data update time are different, the IoT device corresponding to the first identifier is regarded as a device to be updated.
[0278] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.
[0279] Regarding the apparatus in the above embodiments, the specific manner in which each unit executes the request has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0280] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."
[0281] Based on the same inventive concept, embodiments of this application also provide an electronic device. In one embodiment, the electronic device can be a server or a terminal device. See also... Figure 14 As shown, it is a schematic diagram of the structure of a possible electronic device provided in an embodiment of this application. Figure 14 In the electronic device 1400, there are: processor 1410 and memory 1420.
[0282] The memory 1420 stores a computer program that can be executed by the processor 1410. The processor 1410 can execute the steps of the above-described data transmission method by executing the instructions stored in the memory 1420.
[0283] Memory 1420 may be volatile memory, such as random-access memory (RAM); memory 1420 may also be non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1420 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1420 may also be a combination of the above-described memories.
[0284] Processor 1410 may include one or more central processing units (CPUs) or digital processing units, etc. Processor 1410 implements the above-described data transfer method when executing computer programs stored in memory 1420.
[0285] In some embodiments, the processor 1410 and the memory 1420 may be implemented on the same chip, while in other embodiments they may be implemented on separate chips.
[0286] This application embodiment does not limit the specific connection medium between the processor 1410 and the memory 1420. This application embodiment takes the connection between the processor 1410 and the memory 1420 via a bus as an example. Figure 14 The diagram uses thick lines to describe the connections between other components; these are merely illustrative and not intended to be limiting. Buses can be categorized as address buses, data buses, control buses, etc. For ease of description, Figure 14 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.
[0287] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium including a computer program. When the computer program is run on an electronic device, it causes the electronic device to perform the steps of the aforementioned data transmission method. In some possible implementations, various aspects of the data transmission method provided in this application can also be implemented as a program product including a computer program. When the program product is run on an electronic device, the computer program causes the electronic device to perform the steps in the aforementioned data transmission method. For example, the electronic device can perform actions such as... Figure 4 The steps are shown in the figure.
[0288] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0289] The program product of the embodiments of this application may be a CD-ROM and include a computer program, and may run on an electronic device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a computer program that may be used by or in conjunction with a command execution system, apparatus, or device.
[0290] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a readable computer program. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a computer program for use by or in conjunction with a command execution system, apparatus, or device.
[0291] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0292] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A data transmission method, characterized in that, Applied to edge nodes, which are connected to target IoT devices, including: When data to be processed is received from the target IoT device, the stored device identifiers are retrieved; When it is determined that each device identifier contains a target identifier of a target IoT device, based on the first mapping relationship between each device identifier and each candidate task, at least one target task corresponding to the target identifier is determined from each candidate task; Obtain the target attribute set corresponding to each of the at least one target task, and based on the obtained target attribute set, extract the target data corresponding to each of the at least one target task from the data to be processed; wherein, the target attribute set corresponding to each of the at least one target task is determined in the following manner: In response to a device configuration operation for at least one target task, a second mapping relationship between the target identifier and the at least one target task is obtained, and the second mapping relationship is stored in the first mapping relationship; In response to the attribute configuration operation for the at least one target task, configuration information corresponding to each of the at least one target task is obtained, and each configuration information contains at least the target attribute set of the corresponding target task; For each of the at least one target task, the corresponding target data is transmitted to the central node.
2. The method as described in claim 1, characterized in that, In response to the attribute configuration operation for the at least one target task, after obtaining the configuration information corresponding to each of the at least one target task, wherein each configuration information contains at least the target attribute set of the corresponding target task, the method further includes: In response to a task update operation for the at least one target task, the at least one target task is paused, and configuration update information is obtained; Based on the configuration update information, the at least one configuration information is updated to obtain at least one updated configuration information, and based on the at least one updated configuration information, the at least one target task is restarted.
3. The method as described in claim 2, characterized in that, The at least one configuration information is stored in a database and a cache. After updating the at least one configuration information based on the configuration update information to obtain at least one updated configuration information, the process further includes: Delete the at least one configuration information from the cache; Update the at least one configuration information stored in the database to the at least one updated configuration information; When the cache delay update duration reaches a preset duration threshold, the at least one updated configuration information is stored in the cache, whereby the cache delay update duration is used to characterize the duration from the database update time to the current time.
4. The method according to any one of claims 1-3, characterized in that, Before obtaining the stored device identifiers when receiving data to be processed from the target IoT device, the process further includes: When it is determined that the at least one target task is started, a message transmission channel corresponding to each of the at least one target task is created; The step of transmitting the corresponding target data to the central node for the at least one target task includes: Based on the correspondence between the at least one target task and the extracted target data, and based on the correspondence between the at least one target task and the at least one created message transmission channel, the message transmission channel corresponding to each target data is determined. Each target data is sent to the central node using the corresponding message transmission channel.
5. The method as described in claim 4, characterized in that, Creating a message transmission channel corresponding to each of the at least one target task includes: Obtain the configuration information corresponding to each of the at least one target task. Each configuration information contains the node address of a third-party node, which is used to represent a message subscription node that forwards the target message of the corresponding target task. The node address of the third-party node is used as the forwarding address, and a message transmission channel corresponding to each of the at least one target task is created based on the forwarding address.
6. A data transmission method, characterized in that, Applied to the central node, including: In response to an add operation for an edge node, obtain the node address of the edge node; When the network connectivity of the edge node is determined to be normal based on the node address, the edge node is added, and target data corresponding to at least one target task sent by the edge node is received. Wherein, each target data is determined by the edge node upon receiving data to be processed from the target IoT device and determining that the stored device identifiers contain the target identifier of the target IoT device, based on the first mapping relationship between the device identifiers and each candidate task, identifying at least one target task corresponding to the target identifier, and extracting it from the data to be processed based on the target attribute set corresponding to each of the at least one target task; the target attribute set corresponding to each of the at least one target task is determined in the following manner: in response to a device configuration operation for at least one target task, the obtained second mapping relationship between the target identifier and the at least one target task is stored in the first mapping relationship; in response to an attribute configuration operation for at least one target task, configuration information corresponding to each of the at least one target task is obtained, and each configuration information contains at least the target attribute set of the corresponding target task.
7. The method as described in claim 6, characterized in that, The step of obtaining the node address of the edge node in response to the addition operation for the edge node includes: In response to an operation to add an edge node, obtain the node address of the edge node and the authentication information of the operation object; When it is determined based on the node address that the network connectivity of the edge node is normal, adding the edge node includes: When the network connectivity of the edge node is determined to be normal based on the node address, the authentication information is sent to the edge node, and upon receiving the verification pass response from the edge node, the edge node is added to the edge side.
8. The method as described in claim 6 or 7, characterized in that, When the network connectivity of the edge node is determined to be normal based on the node address, after adding the edge node, and before receiving the target data corresponding to each of the at least one target task sent by the edge node, the method further includes: In response to the metadata synchronization operation, the metadata stored in the central node and the edge nodes is synchronized; based on the synchronized metadata, a storage table is created to store the target data. After receiving the target data corresponding to at least one target task sent by the edge node, the method further includes: The received target data is stored in the created storage table.
9. The method as described in claim 8, characterized in that, The synchronization of metadata stored in the central node and the edge nodes includes: Obtain the first set of identifiers stored in the central node, where each first identifier is used to represent an Internet of Things (IoT) device; The edge node is used to obtain a second set of identifiers stored in the edge node, and each second identifier is used to represent an Internet of Things device; Based on the first identifier set and the second identifier set, determine the set of devices to be deleted and the set of devices to be updated; In the database, delete the metadata of each device to be deleted from the set of devices to be deleted, and update the metadata of each device to be updated from the set of devices to be updated.
10. The method as described in claim 9, characterized in that, The step of determining the set of devices to be deleted and the set of devices to be updated based on the first identifier set and the second identifier set includes: For each first identifier in the first identifier set, perform the following operations: If a first identifier is different from all the second identifiers, then the IoT device corresponding to the first identifier is regarded as a device to be deleted. If a first identifier is the same as a second identifier, then the first data update time corresponding to the first identifier and the second data update time corresponding to the second identifier are obtained. If the first data update time and the second data update time are different, the IoT device corresponding to the first identifier is regarded as a device to be updated.
11. A data transmission device, characterized in that, The data transmission device is connected to the target IoT device, including: The acquisition unit is used to acquire the stored device identifiers when it receives data to be processed from the target IoT device. The determining unit is configured to, when it is determined that each device identifier contains a target identifier of a target IoT device, determine at least one target task corresponding to the target identifier from each candidate task based on a first mapping relationship between each device identifier and each candidate task; An extraction unit is configured to acquire target attribute sets corresponding to each of the at least one target task, and based on the acquired at least one target attribute set, extract target data corresponding to each of the at least one target task from the data to be processed; wherein, the target attribute sets corresponding to each of the at least one target task are determined in the following manner: In response to a device configuration operation for at least one target task, a second mapping relationship between the target identifier and the at least one target task is obtained, and the second mapping relationship is stored in the first mapping relationship; In response to the attribute configuration operation for the at least one target task, configuration information corresponding to each of the at least one target task is obtained, and each configuration information contains at least the target attribute set of the corresponding target task; The transmission unit is used to transmit the corresponding target data to the central node for the at least one target task.
12. A data transmission device, characterized in that, include: The acquisition unit is used to acquire the node address of the edge node in response to the addition operation for the edge node; The receiving unit is configured to add the edge node and receive target data corresponding to at least one target task sent by the edge node when it is determined that the network connectivity of the edge node is normal based on the node address. Wherein, each target data is determined by the edge node when it receives data to be processed from the target IoT device and determines that the stored device identifiers contain the target identifier of the target IoT device. Based on the first mapping relationship between the device identifiers and each candidate task, the edge node determines the at least one target task corresponding to the target identifier and extracts it from the data to be processed based on the target attribute set corresponding to each of the at least one target task. The target attribute set corresponding to each of the at least one target task is determined in the following way: in response to the device configuration operation for the at least one target task, the obtained second mapping relationship between the target identifier and the at least one target task is stored in the first mapping relationship. In response to the attribute configuration operation for the at least one target task, configuration information corresponding to each of the at least one target task is obtained, and each configuration information contains at least the target attribute set of the corresponding target task.
13. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any of the methods of claims 1 to 5, or to perform the steps of any of the methods of claims 6 to 10.
14. A computer-readable storage medium, characterized in that, It includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described in claims 1 to 5, or to perform the steps of any of the methods described in claims 6 to 10.
15. A computer program product, characterized in that, It includes a computer program stored in a computer-readable storage medium, and a processor of an electronic device reads from and executes the computer program, causing the electronic device to perform the steps of any of the methods of claims 1 to 5, or to perform the steps of any of the methods of claims 6 to 10.
Citation Information
Patent Citations
Filtering control method and routing node of Internet of Things data
CN107465566A
Data processing method and device
CN113472779A
