Data synchronization method and device, equipment, storage medium and program product
Through the data synchronization method between routers in the home sensing scenario, the environmental information similarity is dynamically calculated and the matching rule base is synchronized, which solves the problem of low manual update efficiency in the existing technology, improves the update efficiency, and reduces maintenance costs.
Patent Information
- Application Number
- CN202411487849.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-10-23
AI Technical Summary
In home perception scenarios, the prior art requires manual update of matching rules in sensors through over-the-air download technology (OTA), which is inefficient.
Through the method of implementing data synchronization between routers, dynamically calculate the environmental information similarity between the routers, and synchronize the rules library according to the similarity to avoid manual update.
It improves the efficiency of updating matching rules, reduces manual intervention, and reduces equipment maintenance costs.
Smart Images

Figure CN119363770A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of data transmission, and in particular, relates to a method, device, equipment, storage medium and program product for data synchronization. Background Art
[0002] In the home perception scenario, the response rules are integrated into the sensors. After collecting the environmental data, the sensors process the environmental data according to the local feature extraction algorithm to obtain the environmental feature data. Then, the sensors search for matching rules that match the environmental feature data in the matching rules, and finally respond according to the matching rules.
[0003] For example, in a home sensing scenario, the acoustic wave sensor is deployed with acoustic wave matching rules. When the acoustic wave sensor collects the "turn on the light" command issued by the user, the acoustic wave data collected by the user is processed using an acoustic wave feature extraction algorithm to obtain feature data, and then the corresponding matching rule is searched in the acoustic wave matching rules based on the feature data, thereby issuing an on command to the smart switch corresponding to the light.
[0004] Then, when the matching rules in the sensor need to be updated, the sensor needs to be updated manually using Over-The-Air (OTA) technology. Thus, manually updating the matching rules is inefficient. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for data synchronization, which can improve the matching rule update efficiency.
[0006] In a first aspect, an embodiment of the present application provides a data synchronization method, applied to a first router, the method comprising:
[0007] receiving a dynamic distribution request sent by a second router, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router;
[0008] Calculating the similarity between the environment information of the second router and the environment information of the first router using a preset algorithm;
[0009] sending the similarity to the second router;
[0010] receiving a data synchronization request sent by the second router, wherein the data synchronization request is determined by the second router based on a highest similarity among similarities received from at least one first router;
[0011] The matching rule base is synchronized to the second router.
[0012] In a possible implementation, the environment information includes device type information, device usage information, and existing rule information; and the using a preset algorithm to calculate the similarity between the environment information of the second router and the environment information of the first router includes:
[0013] Calculating the ratio of the number of similar devices based on the device type information using a first preset algorithm;
[0014] Calculating a device usage frequency ratio based on the device usage information using a second preset algorithm;
[0015] Calculate the similar rule ratio based on the existing rule information using a third preset algorithm;
[0016] The sum of the ratio of the number of similar devices, the ratio of the device usage frequency and the ratio of the proportion of similar rules is calculated to obtain the similarity of the environmental information.
[0017] In a possible implementation, the using a first preset algorithm to calculate the ratio of the number of similar devices based on the device type information includes:
[0018] Determine, among the devices connected to the first router, devices of the same type as the device in the device type information, and obtain the number of first devices;
[0019] Determine, according to the device type information, devices connected to the second router that are of the same type as the devices connected to the first router, and obtain the number of second devices;
[0020] The ratio of the number of the first devices to the number of the second devices is calculated to obtain the ratio of the number of the same type of devices.
[0021] In a possible implementation, the calculating the device usage frequency ratio based on the device usage information by using a second preset algorithm includes:
[0022] Counting the usage frequency of the first device according to the device usage information to obtain a first frequency;
[0023] Counting the usage frequency of the second device according to the local device usage information to obtain a second frequency;
[0024] The ratio of the first frequency to the second frequency is calculated to obtain the device usage frequency ratio.
[0025] In a possible implementation, the using a third preset algorithm to calculate the similar rule ratio based on the existing rule information includes:
[0026] Determine a first response rule matching the first device according to the existing rule information;
[0027] Calculate the ratio of the number of the first response rules to the total number of response rules in the existing rule information to obtain a similar rule ratio of the first device;
[0028] Determine, according to the local rule information, a second response rule matching the second device;
[0029] Calculate the ratio of the number of the second response rules to the total number of response rules in the local rule information to obtain a similar rule ratio of the second device;
[0030] The ratio of the similar rule ratio of the first device to the similar rule ratio of the second device is calculated to obtain the similar rule ratio.
[0031] In a second aspect, an embodiment of the present application provides a method for data synchronization, which is applied to a second router, and the method includes:
[0032] Sending a dynamic distribution request to a first router in a local area network, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router;
[0033] Receiving the similarity of the environment information sent by at least one first router;
[0034] Determine, from the similarities of the environmental information sent by each first router, the target similarity with the highest similarity and the target first router corresponding to the target similarity;
[0035] Sending a data synchronization request to the target first router;
[0036] Receiving a matching rule base sent by the target first router;
[0037] The local matching rule base is updated according to the matching rule base.
[0038] In a third aspect, an embodiment of the present application provides a data synchronization device, which is applied to a first router, and the device includes:
[0039] A receiving module, configured to receive a dynamic distribution request sent by a second router, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router;
[0040] a calculation module, configured to calculate the similarity between the environment information of the second router and the environment information of the first router by using a preset algorithm;
[0041] A sending module, configured to send the similarity to the second router;
[0042] The receiving module is further configured to receive a data synchronization request sent by the second router, wherein the data synchronization request is determined by the second router based on the highest similarity among the similarities received from at least one first router;
[0043] A synchronization module is used to synchronize the matching rule base to the second router.
[0044] In a fourth aspect, an embodiment of the present application provides a data synchronization device, which is applied to a second router, and the device includes:
[0045] A sending module, used for sending a dynamic distribution request to a first router in a local area network, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used for characterizing a use environment of the second router;
[0046] A receiving module, configured to receive the similarity of the environment information sent by at least one first router;
[0047] A determination module, configured to determine the target similarity with the highest similarity and the target first router corresponding to the target similarity from the similarities of the environmental information sent by each first router;
[0048] The sending module is further used to send a data synchronization request to the target first router;
[0049] The receiving module is further used to receive the matching rule library sent by the target first router;
[0050] An updating module is used to update the local matching rule base according to the matching rule base.
[0051] In a fifth aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0052] When the processor executes the computer program instructions, the method for data synchronization as described in any one of the first aspect or the second aspect is implemented.
[0053] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, a method for data synchronization as described in any one of the first aspect or the second aspect is implemented.
[0054] In a seventh aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the data synchronization method as described in any one of the first aspect or the second aspect.
[0055] A method, device, equipment, storage medium and program product for data synchronization in an embodiment of the present application, a first router receives a dynamic distribution request sent by a second router, and then calculates the similarity of the environmental information of the first router and the second router based on the environmental information carried in the dynamic distribution request, and then the first router returns the similarity to the second router. Among them, the similarity can be used to determine whether the first router and the second router can provide similar functions for the user. Thus, the second router determines the first router with the highest similarity from multiple first routers, and sends a data synchronization request to the first router, the data synchronization request is used to instruct the first router to synchronize the local matching rule base, and finally the second router receives the matching rule base synchronized by the first router. In this way, after the first router feeds back the similarity of the environmental information to the second router, the second router determines that the similarity of the first router is the highest, that is, the possibility that the first router and the second router provide the same function is the highest, therefore, the first router and the second router can dynamically update each other's matching rule base. It avoids manual updating of matching rules and improves the updating efficiency of matching rules. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0057] Figure 1 A schematic diagram of a system architecture of a data synchronization method provided by an embodiment of the present application using an embodiment of the present application;
[0058] Figure 2 It is a flowchart of a data synchronization method provided by an embodiment of the present application;
[0059] Figure 3 It is a flowchart of a method for calculating similarity provided in an embodiment of the present application;
[0060] Figure 4 It is a flow chart of a method for calculating the ratio of the number of similar devices provided in an embodiment of the present application;
[0061] Figure 5 is an exemplary schematic diagram of a method for calculating a similar rule ratio provided in an embodiment of the present application;
[0062] Figure 6 is an exemplary schematic diagram of a virtual switch provided in an embodiment of the present application;
[0063] Figure 7 It is a structural diagram of a data processing module provided in an embodiment of the present application;
[0064] Figure 8 is an exemplary schematic diagram of a data synchronization method provided in an embodiment of the present application;
[0065] Fig. 9 is an exemplary schematic diagram of another data synchronization method provided in an embodiment of the present application;
[0066] Fig.10 It is a flowchart of another data synchronization method provided in an embodiment of the present application;
[0067] Fig.11 is an exemplary schematic diagram of another data synchronization method provided in an embodiment of the present application;
[0068] Fig.12 It is a structural diagram of a data synchronization device provided in an embodiment of the present application;
[0069] Fig.13 This is a schematic diagram of another data synchronization device provided in an embodiment of the present application.
[0070] Fig.14 It is a structural schematic diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0071] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0072] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0073] Currently, in home scenarios, the following two solutions can be used to achieve scene perception:
[0074] Solution 1: Deploy sensors in the home scene, and use the sensors to collect environmental data in the home scene, where the environmental data can be sound wave data, radio wave data, and light data, etc. The sensors then upload the collected environmental data to the cloud server, which matches the response rules based on the environmental data and sends the response rules to the devices in the home scene, and the devices respond based on the response rules.
[0075] For the above solution 1, the processing time required is long and the device responds slowly.
[0076] Solution 2: Integrate the feature extraction algorithm and rule matching function into the sensor, and the sensor extracts features from the collected environmental data and matches the response rules based on the extracted feature data.
[0077] Regarding the above-mentioned solution 2, when the feature extraction algorithm and the response rule need to be updated, the user needs to manually update the sensor or replace the sensor as a whole, resulting in high equipment maintenance costs.
[0078] In order to solve the problems existing in the prior art, the embodiments of the present application provide a method, apparatus, device, storage medium and program product for data synchronization. Figure 1 The following describes a system framework for applying the above data synchronization method provided by an embodiment of the present application. Figure 1 As shown, the system includes a cloud server, an edge router and sensors.
[0079] Specifically, the user can also configure matching rules on the cloud server, and the cloud server sends the configured matching rules to the edge router.
[0080] The sensor is used to collect environmental data and upload the collected environmental data to the edge router.
[0081] The edge router processes the environmental data using a built-in feature extraction algorithm and searches for matching rules that match the environmental data in a built-in response rule database.
[0082] In addition, the edge router can also synchronize the matching rules in each edge router.
[0083] Specifically, the method for data synchronization between edge routers is as follows: Figure 2 As shown, the method is applied to the first router, and the data synchronization method specifically includes:
[0084] S201: Receive a dynamic distribution request sent by a second router.
[0085] The dynamic distribution request includes the environment information of the second router, and the environment information is used to characterize the use environment of the second router.
[0086] The first router and the second router belong to the same local area network. The routers in the local area network use the same communication protocol. The local area network includes multiple routers, the second router initiates the dynamic distribution request in the local area network, and the first router receives the dynamic distribution request in the local area network.
[0087] Specifically, the second router may periodically send a dynamic distribution request to the first router to synchronize the matching rules in each router. The second router may also trigger the sending of a dynamic distribution request to the first router when detecting a new device access.
[0088] S202: Calculate the similarity between the environment information of the second router and the environment information of the first router using a preset algorithm.
[0089] S203: Send the similarity to the second router.
[0090] S204: Receive a data synchronization request sent by the second router.
[0091] The data synchronization request is determined by the second router based on the highest similarity among the similarities received from at least one first router.
[0092] It can be understood that the second router sends a dynamic distribution request to all first routers in the local area network, so the second router can receive the similarity returned by each first router.
[0093] S205: Synchronize the matching rule base to the second router.
[0094] With the above method, the first router receives the dynamic distribution request sent by the second router, and then calculates the similarity of the environmental information of the first router and the second router based on the environmental information carried in the dynamic distribution request, and then the first router returns the similarity to the second router. Among them, the similarity can be used to determine whether the first router and the second router can provide similar functions for users. Thus, the second router determines the first router with the highest similarity from multiple first routers, and sends a data synchronization request to the first router, the data synchronization request is used to instruct the first router to synchronize the local matching rule base, and finally the second router receives the matching rule base synchronized by the first router. In this way, after the first router feeds back the similarity of the environmental information to the second router, the second router determines that the similarity of the first router is the highest, that is, the possibility that the first router and the second router provide the same function is the highest, therefore, the first router and the second router can dynamically update each other's matching rule base. It avoids manual updating of matching rules and improves the updating efficiency of matching rules.
[0095] The following is a detailed introduction to the method of calculating the similarity of environmental information. Figure 3 As shown, the above S202, using a preset algorithm to calculate the similarity between the environment information of the second router and the environment information of the first router, can be implemented as follows:
[0096] S2021. Calculate the ratio of the number of similar devices based on the device type information using a first preset algorithm.
[0097] The device type information includes the type of device accessed through the router. For example, the device may be a sensor, and the device type of the sensor may be an optical sensor or an acoustic sensor.
[0098] The ratio of the number of similar devices refers to the ratio of the number of devices of the same type in the devices connected to the first router and the devices connected to the second router.
[0099] It can be understood that the larger the ratio of the number of similar devices is, the more devices of the same type are connected to the first router and the second router, and the greater the possibility that the first router and the second router provide the same function.
[0100] Specifically, the first router uses the following method to calculate the ratio of the number of similar devices, such as Figure 4 As shown, the method includes:
[0101] S401: Determine the devices connected to the first router that have the same device type as the device in the device type information, and obtain the number of first devices.
[0102] Specifically, the first router obtains the device type included in the device type information sent by the second router, obtains the device type of the device connected to the second router, and then obtains the device type of the device connected to the first router, and obtains the number of devices with the same device type by comparing the device type of the device connected to the first router with the device type of the device connected to the second router. The first device refers to a device with the same device type as the device connected to the second router among the devices connected to the first router.
[0103] For example, the device type information sent by the second router includes device type A and device type B. The first router searches for a device corresponding to device type A and device type B in the downstream devices, that is, the first device.
[0104] S402: Determine the devices of the same type in the devices connected to the first router according to the local device type information, and obtain the number of second devices.
[0105] Specifically, after determining the target device of the same device type as that in the device type information among the local downstream devices, the first router determines the device type of the target device in the device type information based on the device type of the target device, and then determines the number of devices corresponding to the device type of the target device in the device type information.
[0106] Continuing with the above example, the first router finds the device corresponding to device type A in the downstream devices, and the first router searches for the number of devices corresponding to device type A in the device type information sent by the second router to obtain the number of second devices.
[0107] S403: Calculate the ratio of the number of first devices to the number of second devices to obtain a ratio of the number of similar devices.
[0108] It can be understood that the larger the ratio of the number of similar devices is, the more devices of the same type are connected to the first router and the second router, and the greater the possibility that the first router and the second router provide the same function. In this way, through the device type information, the first router can determine the number of devices of the same type in the devices connected to the first router and the second router, thereby determining the similarity between the first router and the second router in the dimension of the number of devices.
[0109] S2022: Calculate the device usage frequency ratio based on the device usage information using a second preset algorithm.
[0110] Specifically, the first router counts the usage frequency of the first device according to the device usage information to obtain a first frequency. The first router counts the usage frequency of the second device according to the local device usage information to obtain a second frequency. The ratio of the first frequency to the second frequency is calculated to obtain a device usage frequency ratio.
[0111] The first device is a target device in the first router with the same device type as that in the device type information sent by the second router, and the second device is a device in the second router with the same device type as that of the target device.
[0112] It is understandable that the higher the frequency of use of a device, the more likely the router corresponding to the device has the latest matching rule. Thus, the calculated device use frequency ratio can determine the possibility that the router has the latest matching rule.
[0113] S2023. Calculate the ratio of similar rules based on the existing rule information using a third preset algorithm.
[0114] Specifically, the first router uses the following method to calculate the ratio of similar rules: Figure 5 As shown, this specifically includes:
[0115] S501. Determine a first response rule matching a first device according to existing rule information.
[0116] S502: Calculate the ratio of the number of first matching rules to the total number of matching rules in the existing rule information to obtain a similar rule ratio of the first device.
[0117] S503: Determine a second matching rule that matches the second device according to the local rule information.
[0118] S504. Calculate the ratio of the number of second matching rules to the total number of matching rules in the local rule information to obtain a similar rule ratio of the second device;
[0119] S505: Calculate the ratio of the similar rule proportion of the first device to the similar rule proportion of the second device to obtain a similar rule proportion ratio.
[0120] In one example, the first device includes a device of device type A and a device of device type B, the number of rules included in the existing rule information is 10, and the response rules matching the first device in the existing rule information include rule 1, rule 2, rule 3, and rule 4. Then the similar rule ratio of the first device is 4 / 10=0.4. The number of rules included in the local rule information is 12, and the response rules matching the second device in the local rule information include rule A, rule B, and rule C. Then the similar rule ratio of the second device is 3 / 12=0.25. The calculated similar rule ratio is 0.4 / 0.25=1.6.
[0121] S2024. Calculate the sum of the ratio of the number of similar devices, the ratio of the frequency of device use, and the ratio of the proportion of similar rules to obtain the similarity of the environmental information.
[0122] The method provided in the embodiment of the present application is adopted to calculate the ratio of the number of similar devices between the first router and the second router using the device type information, calculate the ratio of the device usage frequency between the first router and the second router using the device usage information, and calculate the ratio of the proportion of similar rules between the first router and the second router using the existing rule information. Among them, the ratio of the number of similar devices, the ratio of the device usage frequency, and the ratio of the proportion of similar rules can measure the similarity between the first router and the second router from three dimensions respectively. Therefore, on the basis of the above-calculated ratio of the number of similar devices, the ratio of the device usage frequency, and the ratio of the proportion of similar rules, the similarity of the environmental information between the first router and the second router can be obtained by adding the ratio of the number of similar devices, the ratio of the device usage frequency, and the ratio of the proportion of similar rules. In this way, the similarity can be accurately calculated by integrating the three dimensions of device type, usage, and matching rules.
[0123] The following combination Figure 6 The present application embodiment provides an internal structure of a router, such as Figure 6 As shown, the edge router is a general x-architecture server, and a virtual switch is constructed through network function virtualization technology. The virtual switch includes a rule matching module, a data processing module, an east-west communication module, and a routing forwarding module.
[0124] The edge router can realize the access of sensors and common devices. For example, the sensor can be an acoustic sensor or an optical sensor, and the common device can be a mobile phone or a tablet computer.
[0125] Specifically, the sensor collects environmental data and uploads the collected environmental data to the edge router. The data processing module in the edge router is used to receive the environmental data uploaded by the sensor, and select the corresponding feature extraction algorithm according to the data type of the environmental data, extract features from the environmental data, and obtain scene feature data.
[0126] The data processing module includes a plurality of feature extraction submodules, each of which corresponds to a feature extraction algorithm. The feature extraction algorithm may be a standard feature extraction algorithm or a customized feature extraction algorithm.
[0127] Among them, sensors using standard data types correspond to standard feature extraction algorithms, and sensors using customized data types correspond to customized feature extraction algorithms.
[0128] Specifically, when a new sensor is connected to the edge router, the new sensor uploads a feature extraction algorithm corresponding to the new sensor to the data processing module.
[0129] like Figure 7As shown, the data processing module in router 1 includes feature extraction algorithm 1, feature extraction algorithm 2 and feature extraction algorithm 3. Sensor 3 and sensor 1 correspond to feature extraction algorithm 1, sensor 2 corresponds to feature extraction algorithm 2, and sensor 4 corresponds to feature extraction algorithm 3. Sensor 3 and sensor 1 are standard connected sensors, and correspondingly feature extraction algorithm 1 is a standard feature extraction algorithm. If sensor 2 is a customized sensor, when sensor 2 is connected to router 1, sensor 2 uploads the algorithm and synchronizes the local feature extraction algorithm to router 1.
[0130] The data processing module in the router 2 includes a feature extraction algorithm 2 , and the sensor corresponding to the feature extraction algorithm 2 is the sensor 2 mounted under the router 2 .
[0131] After processing the environmental data, the data processing module obtains environmental characteristic data and sends the environmental characteristic data to the rule matching module. The rule matching module searches for matching rules corresponding to the environmental characteristic data in a local matching rule library.
[0132] In addition, the data processing module collects device data, sends the device data and the rules in the matching rule library in the rule matching module to the east-west communication module, and the east-west communication module sends the above device data and the rules in the matching rule library in the rule matching module as environmental information to other edge routers in the local area network.
[0133] The east-west communication module is used to realize the interaction of environmental information and the distribution of matching rules between edge routers. Specifically, edge routers exchange data through a customized communication protocol. In this way, by using a customized communication protocol, environmental information and matching rules can be distinguished from other communication traffic, ensuring the security and real-time nature of data interaction.
[0134] Specifically, the process of data interaction between edge routers through the east-west communication module is as follows: Figure 8 As shown. Among them, edge router 1 obtains local device type information, usage information and existing rule information and synchronizes environmental information through the east-west communication module. Specifically, the east-west communication module uses a customized communication protocol to encrypt the environmental information and sends the encrypted environmental information to edge router 2. The east-west communication module in edge router 2 decrypts the encrypted environmental information according to the customized communication protocol, thereby obtaining the environmental information of edge router 1.
[0135] In addition, for the common traffic sent by the common device and received by the edge router 1, the edge router 1 sends the common traffic to the edge router 2 through the routing and forwarding module, and the routing and forwarding module in the edge router 2 processes the received common traffic accordingly.
[0136] The routing forwarding module is used to implement the data communication function of the router and complete network data forwarding. Specifically, after receiving the data traffic sent by the ordinary device, the received data traffic is forwarded to other edge routers.
[0137] In addition, the routing forwarding module can perform directed forwarding of the environmental feature data based on the matching rules found by the rule matching module.
[0138] In the above Figure 6 Based on the embodiment shown, combined Fig. 9 The data synchronization method provided by the embodiment of the present application is introduced, such as Fig. 9 As shown:
[0139] Fig. 9 The example shows three edge routers included in the local area network.
[0140] When edge router 2 initiates a dynamic allocation request, edge router 1 and edge router 3 receive the dynamic allocation request and calculate the similarity of the environment information. Edge router 1 and edge router 3 return the similarity of the environment information to edge router 2.
[0141] The edge router 2 determines the environment information corresponding to the edge router based on the data processing module and the rule matching module in the virtual switch. The environment information includes device type information, usage information and existing rule information.
[0142] Edge router 2 determines that the similarity value corresponding to edge router 3 is the highest among the received similarities, and then edge router 2 requests edge router 3 for a matching rule set, and edge router 3 returns the matching rule set to edge router 2.
[0143] Based on the same concept, the embodiment of the present application also provides a data synchronization method, which is applied to a second router, such as Fig.10 As shown, the method includes:
[0144] S1001. Send a dynamic distribution request to a first router in a local area network.
[0145] The dynamic distribution request includes the environment information of the second router, and the environment information is used to characterize the use environment of the second router.
[0146] S1002: Receive similarity of environment information sent by at least one first router.
[0147] The method for the first router to calculate the similarity of the environment information is described in the above embodiment and will not be described in detail here.
[0148] S1003: Determine a target similarity with the highest similarity and a target first router corresponding to the target similarity from the similarities of the environment information sent by each first router.
[0149] S1004: Send a data synchronization request to the target first router.
[0150] S1005: Receive a matching rule library sent by the target first router.
[0151] S1006: Update the local matching rule base according to the matching rule base.
[0152] According to the method provided by the embodiment of the present application, the first router receives the dynamic distribution request sent by the second router, and then calculates the similarity of the environmental information of the first router and the second router based on the environmental information carried in the dynamic distribution request, and then the first router returns the similarity to the second router. Among them, the similarity can be used to determine whether the first router and the second router can provide similar functions for the user. Thus, the second router determines the first router with the highest similarity from multiple first routers, and sends a data synchronization request to the first router, the data synchronization request is used to instruct the first router to synchronize the local matching rule base, and finally the second router receives the matching rule base synchronized by the first router. In this way, after the first router feeds back the similarity of the environmental information to the second router, the second router determines that the similarity of the first router is the highest, that is, the possibility that the first router and the second router provide the same function is the highest, therefore, the first router and the second router can dynamically update each other's matching rule base. It avoids manual updating of matching rules and improves the updating efficiency of matching rules.
[0153] Based on the above embodiments, Fig.11 The method for dynamically distributing matching rules provided in the embodiment of the present application is introduced, such as Fig.11 As shown, the method includes:
[0154] S1101, calculating own environmental information.
[0155] Specifically, when a new device is connected to the router or the preset update time is reached, the router calculates and obtains the environmental information through the above-mentioned data processing module and rule matching module.
[0156] S1102. Distribute environmental information through the east-west communication module.
[0157] Specifically, the method for performing environment synchronization and matching rule distribution between edge routers refers to the relevant description in the above embodiment, which will not be repeated here.
[0158] S1103. Compare the similarities returned by all routers.
[0159] S1104: Select the router with the highest similarity and request its matching rule set.
[0160] S1105: Determine whether there is a matching rule for the new device.
[0161] If yes, execute S1106, if no, end the process.
[0162] S1106: Use the corresponding matching rule as a recommended matching rule.
[0163] It should be noted that if the matching rule set includes a matching rule for a new device, the matching rule may be recommended to the user, so that the user may manually modify the matching rule according to his or her actual business needs.
[0164] By adopting the method provided by the embodiment of the present application, by setting the feature extraction algorithm and matching rules in the edge router, the data flow path can be reduced, thereby ensuring the timeliness of scene perception. In addition, when a new device is connected, if the new device adopts a standard feature extraction algorithm, a correspondence between the data format of the new device and the standard feature extraction algorithm can be established. If the new device adopts a customized feature extraction algorithm, the new device can upload the customized feature extraction algorithm to the edge router, without manually updating the feature extraction algorithm in the edge router, thereby reducing the equipment maintenance cost. In addition, the edge router completes the synchronization of the matching rule set through the interaction of environmental information, completes the dynamic distribution of matching rules between edge routers, and realizes the update of matching rules in the edge router, further reducing the equipment maintenance cost, and can timely update the matching rules corresponding to the device, thereby improving the accuracy of scene perception.
[0165] Based on the same concept, the embodiment of the present application also provides a data synchronization device, which is applied to a first router, such as Fig.12 As shown, the device comprises:
[0166] The receiving module 1201 is used to receive a dynamic distribution request sent by a second router, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize the use environment of the second router;
[0167] A calculation module 1202, configured to calculate the similarity between the environment information of the second router and the environment information of the first router using a preset algorithm;
[0168] A sending module 1203, configured to send the similarity to the second router;
[0169] The receiving module 1201 is further configured to receive a data synchronization request sent by the second router, wherein the data synchronization request is determined by the second router based on the highest similarity among the similarities received from at least one first router;
[0170] The synchronization module 1204 is used to synchronize the matching rule base to the second router.
[0171] In a possible implementation, the environment information includes device type information, device usage information, and existing rule information; the calculation module 1202 is specifically configured to:
[0172] Calculating the ratio of the number of similar devices based on the device type information using a first preset algorithm;
[0173] Calculating a device usage frequency ratio based on the device usage information using a second preset algorithm;
[0174] Calculate the similar rule ratio based on the existing rule information using a third preset algorithm;
[0175] The sum of the ratio of the number of similar devices, the ratio of the device usage frequency and the ratio of the proportion of similar rules is calculated to obtain the similarity of the environmental information.
[0176] In a possible implementation, the calculation module 1202 is specifically configured to:
[0177] Determine, among the devices connected to the first router, devices of the same type as the device in the device type information, and obtain the number of first devices;
[0178] Determine, according to the device type information, devices connected to the second router that are of the same type as the devices connected to the first router, and obtain the number of second devices;
[0179] The ratio of the number of the first devices to the number of the second devices is calculated to obtain the ratio of the number of the same type of devices.
[0180] In a possible implementation, the calculation module 1202 is specifically configured to:
[0181] Counting the usage frequency of the first device according to the device usage information to obtain a first frequency;
[0182] Counting the usage frequency of the second device according to the local device usage information to obtain a second frequency;
[0183] The ratio of the first frequency to the second frequency is calculated to obtain the device usage frequency ratio.
[0184] In a possible implementation, the calculation module 1202 is specifically configured to:
[0185] Determine a first matching rule that matches the first device according to the existing rule information;
[0186] Calculate the ratio of the number of the first matching rules to the total number of matching rules in the existing rule information to obtain a similar rule ratio of the first device;
[0187] Determine, according to the local rule information, a second matching rule that matches the second device;
[0188] Calculate the ratio of the number of the second matching rules to the total number of matching rules in the local rule information to obtain a similar rule ratio of the second device;
[0189] The ratio of the similar rule ratio of the first device to the similar rule ratio of the second device is calculated to obtain the similar rule ratio.
[0190] It should be noted that the data synchronization device is a device corresponding to the above-mentioned method for data synchronization, and all implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.
[0191] Based on the same concept, the embodiment of the present application provides a data synchronization device, which is applied to a second router, such as Fig.13 As shown, the device comprises:
[0192] A sending module 1301 is used to send a dynamic distribution request to a first router in a local area network, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize the use environment of the second router;
[0193] The receiving module 1302 is used to receive the similarity of the environment information sent by at least one first router;
[0194] The determination module 1303 is used to determine the target similarity with the highest similarity and the target first router corresponding to the target similarity from the similarities of the environmental information sent by each first router;
[0195] The sending module 1301 is further configured to send a data synchronization request to the target first router;
[0196] The receiving module 1302 is further configured to receive a matching rule base sent by the target first router;
[0197] The updating module 1304 is used to update the local matching rule base according to the matching rule base.
[0198] It should be noted that the data synchronization device is a device corresponding to the above-mentioned method for data synchronization, and all implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.
[0199] Fig.14 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0200] The electronic device may include a processor 1401 and a memory 1402 storing computer program instructions.
[0201] Specifically, the processor 1401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0202] The memory 1402 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 1402 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 1402 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 1402 is a non-volatile solid-state memory.
[0203] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0204] The processor 1401 implements any one of the data synchronization methods in the above embodiments by reading and executing computer program instructions stored in the memory 1402 .
[0205] In one example, the electronic device may further include a communication interface 1403 and a bus 1404. Fig.14As shown, the processor 1401, the memory 1402, and the communication interface 1403 are connected via a bus 1404 and communicate with each other.
[0206] The communication interface 1403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0207] Bus 1404 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1404 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0208] In addition, in combination with the data synchronization method in the above embodiment, the embodiment of the present application can provide a computer storage medium to implement. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the data synchronization methods in the above embodiment is implemented.
[0209] In combination with the data synchronization method in the above embodiments, an embodiment of the present application may provide a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any data synchronization method in the above embodiments.
[0210] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0211] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0212] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0213] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0214] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for data synchronization, characterized in that: Applied to a first router, the method includes: receiving a dynamic distribution request sent by a second router, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router; Calculating the similarity between the environment information of the second router and the environment information of the first router using a preset algorithm; sending the similarity to the second router; receiving a data synchronization request sent by the second router, wherein the data synchronization request is determined by the second router based on a highest similarity among similarities received from at least one first router; The matching rule base is synchronized to the second router.
2. The method according to claim 1, characterized in that The environmental information includes device type information, device usage information, and existing rule information; the using a preset algorithm to calculate the similarity between the environmental information of the second router and the environmental information of the first router includes: Calculating the ratio of the number of similar devices based on the device type information using a first preset algorithm; Calculating a device usage frequency ratio based on the device usage information using a second preset algorithm; Calculate the similar rule ratio based on the existing rule information using a third preset algorithm; The sum of the ratio of the number of similar devices, the ratio of the device usage frequency and the ratio of the proportion of similar rules is calculated to obtain the similarity of the environmental information.
3. The method according to claim 2, characterized in that The using a first preset algorithm to calculate the ratio of the number of similar devices based on the device type information includes: Determine, among the devices connected to the first router, devices of the same type as the device in the device type information, and obtain the number of first devices; Determine, according to the device type information, devices connected to the second router that are of the same type as the devices connected to the first router, and obtain the number of second devices; The ratio of the number of the first devices to the number of the second devices is calculated to obtain the ratio of the number of the same type of devices.
4. The method according to claim 3, characterized in that The using a second preset algorithm to calculate the device usage frequency ratio based on the device usage information includes: Counting the usage frequency of the first device according to the device usage information to obtain a first frequency; Counting the usage frequency of the second device according to the local device usage information to obtain a second frequency; The ratio of the first frequency to the second frequency is calculated to obtain the device usage frequency ratio.
5. The method according to claim 3, characterized in that: The using a third preset algorithm to calculate the similar rule ratio based on the existing rule information includes: Determine a first matching rule that matches the first device according to the existing rule information; Calculate the ratio of the number of the first matching rules to the total number of matching rules in the existing rule information to obtain a similar rule ratio of the first device; Determine, according to the local rule information, a second matching rule that matches the second device; Calculate the ratio of the number of the second matching rules to the total number of matching rules in the local rule information to obtain a similar rule ratio of the second device; The ratio of the similar rule ratio of the first device to the similar rule ratio of the second device is calculated to obtain the similar rule ratio.
6. A method for data synchronization, characterized in that: Applied to the second router, the method includes: Sending a dynamic distribution request to a first router in a local area network, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router; Receiving the similarity of the environment information sent by at least one first router; Determine, from the similarities of the environmental information sent by each first router, the target similarity with the highest similarity and the target first router corresponding to the target similarity; Sending a data synchronization request to the target first router; Receiving a matching rule base sent by the target first router; The local matching rule base is updated according to the matching rule base.
7. A data synchronization device, characterized in that: Applied to a first router, the device comprises: A receiving module, configured to receive a dynamic distribution request sent by a second router, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used to characterize a use environment of the second router; a calculation module, configured to calculate the similarity between the environment information of the second router and the environment information of the first router by using a preset algorithm; A sending module, configured to send the similarity to the second router; The receiving module is further configured to receive a data synchronization request sent by the second router, wherein the data synchronization request is determined by the second router based on the highest similarity among the similarities received from at least one first router; A synchronization module is used to synchronize the matching rule base to the second router.
8. A data synchronization device, characterized in that: Applied to a second router, the device comprises: A sending module, used for sending a dynamic distribution request to a first router in a local area network, wherein the dynamic distribution request includes environment information of the second router, and the environment information is used for characterizing a use environment of the second router; A receiving module, configured to receive the similarity of the environment information sent by at least one first router; A determination module, configured to determine the target similarity with the highest similarity and the target first router corresponding to the target similarity from the similarities of the environmental information sent by each first router; The sending module is further used to send a data synchronization request to the target first router; The receiving module is further used to receive the matching rule library sent by the target first router; An updating module is used to update the local matching rule base according to the matching rule base.
9. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for data synchronization as described in any one of claims 1-5 or claim 6 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for data synchronization according to any one of claims 1 to 5 or claim 6 is implemented.
11. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the data synchronization method as described in any one of claims 1 to 5 or claim 6.
Citation Information
Patent Citations
Router equipment, main card thereof and method for adapting main card to interface card
CN102347904A
Key configuration automatic synchronization method among wireless routers
CN105392140A
Wireless configuration parameter synchronization method and device, network equipment and computer readable storage medium
CN110602732A
Firewall rule synchronization method and device, electronic equipment and storage medium
CN113765885A
Configuration method and device of intelligent equipment, electronic equipment and storage medium
CN116032680A