A data synchronization method, apparatus, electronic device, storage medium, and product.
By using a combination of clustering and single-node processing in Redis data synchronization, the problems of low data synchronization efficiency and poor quality are solved, achieving highly reliable and complete data synchronization and improving the user experience.
Patent Information
- Application Number
- CN202210067446.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-01-20
AI Technical Summary
In existing technologies, Redis data synchronization processing suffers from low efficiency and poor quality, resulting in a poor user experience.
By adaptively adjusting the step size, the first agent program uses a cluster approach to store the target data on the nodes of the relational database, while the second agent program uses a single node approach to retrieve data from the master node and uses a data synchronization plugin to store the target data in the corresponding target channel, executing the full data synchronization event in a preset order.
It improves the speed and integrity of data synchronization, enhances the user experience, and ensures high reliability of data storage and the implementation of UPF microservices.
Smart Images

Figure CN114579587B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to a data synchronization method, apparatus, electronic device, storage medium, and product. Background Technology
[0002] Redis (Remote Dictionary Server) is an open-source, high-performance, in-memory key-value database written in ANSI C (American National Standards Institute) language, supporting multiplexed network I / O.
[0003] In existing technologies, Redis is typically the preferred solution for application data caching when storing data. However, data synchronization in Redis usually involves switching the current node to a slave node to store master node information, and the data synchronization plugin implements a single-node connection. This approach leads to incomplete data synchronization on some nodes, poor data processing stability, and a poor user experience. Summary of the Invention
[0004] This invention provides a clock synchronization processing method, apparatus, electronic device, storage medium, and product to solve the technical problems of low synchronization processing efficiency and poor quality in the prior art, which leads to a poor user experience. This invention aims to improve synchronization processing efficiency and enhance user experience by adaptively adjusting the step size.
[0005] In a first aspect, the present invention provides a data synchronization method, comprising:
[0006] Get the target data to be synchronized;
[0007] The first agent program stores the target data to be synchronized on a node of the relational database;
[0008] The second agent program retrieves the target data to be synchronized from the nodes of the relational database and performs synchronization processing on the target data.
[0009] Furthermore, according to the data synchronization method provided by the present invention, the first agent program stores the target data to be synchronized on a node of a relational database, including:
[0010] The first agent program stores the target data to be synchronized on nodes of a relational database in a cluster manner.
[0011] Furthermore, according to the data synchronization method provided by the present invention, the second agent program obtains the target data to be synchronized from the nodes of the relational database, including:
[0012] Based on the mapping relationship between the nodes in the second agent program and the master nodes in the relational database, the second agent program obtains the target data to be synchronized from the master nodes of the relational database in a single-node manner.
[0013] Furthermore, according to the data synchronization method provided by the present invention, the synchronization processing of the target data to be synchronized includes:
[0014] Based on the connection relationship between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the multiple connected nodes into the corresponding target channel.
[0015] Furthermore, according to the data synchronization method provided by the present invention, the synchronization processing of the target data to be synchronized further includes:
[0016] The target data stored in multiple target channels is retrieved in a preset order to obtain all the target data to be synchronized;
[0017] All target data to be synchronized are stored in the data synchronization process, and a full data synchronization event is executed.
[0018] Furthermore, according to the data synchronization method provided by the present invention, the step of storing all the target data to be synchronized into a data synchronization processing program and executing a full data synchronization event includes:
[0019] In the data synchronization process, the target data is added, modified, updated, or deleted based on the descriptor information of all target data to be synchronized.
[0020] Secondly, the present invention also provides a data synchronization device, comprising:
[0021] The acquisition module is used to acquire the target data to be synchronized.
[0022] A storage module is used by the first agent program to store the target data to be synchronized on a node of a relational database;
[0023] The synchronization module is used by the second agent program to obtain the target data to be synchronized from the nodes of the relational database and to perform synchronization processing on the target data to be synchronized.
[0024] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the data synchronization methods described above.
[0025] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the data synchronization methods described above.
[0026] Fifthly, the present invention also provides a computer program product comprising computer-executable instructions, which, when executed, are used to implement the steps of the data synchronization method as described in any of the preceding claims.
[0027] This invention provides a data synchronization method, apparatus, electronic device, storage medium, and product. The method includes: acquiring target data to be synchronized; a first agent program storing the target data to be synchronized on a node of a relational database; a second agent program retrieving the target data to be synchronized from the node of the relational database; and performing synchronization processing on the target data to be synchronized. The data synchronization method provided by this invention can ensure high reliability of data storage, integrity of data synchronization, and implementation of UPF microservices, thereby improving the data synchronization processing speed and enhancing the user experience. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0029] Figure 1 This is a flowchart illustrating the data synchronization method provided by the present invention;
[0030] Figure 2 This is a schematic diagram of the overall process of the data synchronization method provided by the present invention;
[0031] Figure 3 This is a schematic diagram of the data synchronization device provided by the present invention;
[0032] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0034] Figure 1 A flowchart illustrating the data synchronization method provided by this invention is shown below. Figure 1 As shown, the data synchronization method provided by this invention specifically includes the following steps:
[0035] Step 101: Obtain the target data to be synchronized.
[0036] In this embodiment, it is necessary to obtain the target data to be synchronized from the UPF network element microservice. The UPF network element (User Plane Function) is a session point for interconnecting the external PDU with the data network, which is used to provide users with relevant data for the microservice.
[0037] It should be noted that the target data to be synchronized in this embodiment refers to the target data to be backed up. The target data needs to be backed up, that is, the target data in a primary UPF network element is backed up to a backup UPF network element. When the primary UPF network element fails, the data in the backup UPF network element is directly used for communication processing.
[0038] Step 102: The first agent program stores the target data to be synchronized on a node of the relational database.
[0039] In this embodiment, the target data to be synchronized obtained from the main UPF network element needs to be stored on the node of the relational database using the first agent program. The first agent program refers to the main agent program (Agent). The main agent program and the relational database (Redis) are connected and communicated using a cluster communication method. Cluster is a multi-purpose and high-efficiency wireless scheduling communication mode that shares resources, shares costs, and shares channel equipment and services, realizing a many-to-many application relationship.
[0040] It should be noted that in telecommunications networks, a node is a connection point, representing a redistribution point or a communication endpoint. In this embodiment, the relational database contains master and slave nodes. The first agent application stores the target data to be synchronized on the master node of the relational database. In other embodiments, the target data to be synchronized can also be stored on the slave nodes or master and slave nodes of the relational database. This can be configured according to the user's actual needs, and no specific limitation is made here.
[0041] Step 103: The second agent program obtains the target data to be synchronized from the node of the relational database and performs synchronization processing on the target data to be synchronized.
[0042] In this embodiment, a second proxy program is required to extract the target data to be synchronized from the nodes of the relational database and perform synchronization processing operations on the obtained target data. In this embodiment, the second proxy program refers to a backup proxy program, primarily used to implement the synchronization processing of the target data.
[0043] It should be noted that the nodes in the second agent program need to establish a relationship with the master nodes in the relational database through a single-node pattern. Each master node in the relational database is treated as a client, and a connection relationship is established with the nodes in the second agent program in turn. That is, if there are master nodes A and B in the relational database, and node 1 and node 2 in the second agent program, the corresponding relationships between master node A and node 1 and master node B and node 2 are established in turn, and then the corresponding target data to be synchronized is extracted according to the corresponding relationships.
[0044] According to the data synchronization method provided by this invention, by acquiring the target data to be synchronized, a first agent program stores the target data to be synchronized on a node of a relational database, and a second agent program retrieves the target data to be synchronized from the node of the relational database and performs synchronization processing on the target data. The data synchronization method provided by this invention can ensure high reliability of data storage, integrity of data synchronization, and implementation of UPF microservices, thereby improving the data synchronization processing speed and enhancing the user experience.
[0045] Based on any of the above embodiments, in this embodiment, the first agent program stores the target data to be synchronized on a node of the relational database, including:
[0046] The first agent program stores the target data to be synchronized on nodes of a relational database in a cluster manner.
[0047] In this embodiment, the first agent program stores the acquired target data to be synchronized on the nodes of the relational database in a cluster manner. The first agent program is the main agent program, which stores the target data to be synchronized on the master node of the relational database (Redis) in a cluster manner.
[0048] According to the data synchronization method provided by the present invention, the first agent program connects to the relational database in a cluster manner, and then transmits the target data to be synchronized to the relational database, thereby ensuring the reliability and security of the target data to be synchronized and improving the data synchronization processing speed.
[0049] Based on any of the above embodiments, in this embodiment, the second agent program obtains the target data to be synchronized from the nodes of the relational database, including:
[0050] Based on the mapping relationship between the nodes in the second agent program and the master nodes in the relational database, the second agent program obtains the target data to be synchronized from the master nodes of the relational database in a single-node manner.
[0051] In this embodiment, a mapping relationship needs to be pre-established between the nodes in the second agent program and the master node in the relational database. Then, the second agent program retrieves the target data to be synchronized from the master node in the relational database in a single-node manner. For example, node 1 in the second agent program has a mapping relationship with master node A in the relational database, and node 1 of the second agent program extracts the target data to be synchronized from master node A. It should be noted that the specific mapping relationship can be set according to the user's actual needs, and is not specifically limited here.
[0052] According to the data synchronization method provided by the present invention, based on the mapping relationship between the nodes in the second agent program and the master nodes in the relational database, the second agent program obtains the target data to be synchronized from the master nodes in the relational database in a single-node manner, which ensures the integrity of the target data synchronization processing and improves the data synchronization processing speed.
[0053] Based on any of the above embodiments, in this embodiment, the synchronization processing of the target data to be synchronized includes:
[0054] Based on the connection relationship between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the multiple connected nodes into the corresponding target channel.
[0055] In this embodiment, based on the connection relationships between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the connected nodes in the corresponding target channel. It should be noted that during the initialization process of the data synchronization plugin, it sequentially calls the structures and methods contained in each connection relationship to obtain the target data to be synchronized stored in each master node of the relational database and stores it in a unified channel.
[0056] According to the data synchronization method provided by the present invention, based on the connection relationship between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the multiple nodes with connection relationship into the corresponding target channel, which can provide data support for realizing the synchronization processing of all data.
[0057] Based on any of the above embodiments, in this embodiment, the synchronization processing of the target data to be synchronized further includes:
[0058] The target data stored in the target channel is retrieved in a preset order to obtain all the target data to be synchronized;
[0059] All target data to be synchronized are stored in the data synchronization process, and a full data synchronization event is executed.
[0060] In this embodiment, a full data synchronization event needs to be executed. First, the target data stored in the target channel is extracted one by one in a preset order to obtain all the target data to be synchronized. Then, all the target data to be synchronized is stored in the data synchronization (KV) processing program, and the full data synchronization event is executed. It should be noted that the specific operation of the synchronization processing adopts the processing method in the prior art, which will not be described in detail here.
[0061] According to the data synchronization method provided by the present invention, all target data to be synchronized is obtained by retrieving the target data stored in the target channel in a preset order; then, all target data to be synchronized is stored in the data synchronization processing program to perform full data synchronization, which can ensure the integrity of data synchronization and improve the processing speed of data synchronization.
[0062] Based on any of the above embodiments, in this embodiment, storing all the target data to be synchronized in the data synchronization processing program and executing the full data synchronization event includes:
[0063] In the data synchronization process, the target data is added, modified, updated, or deleted based on the descriptor information of all target data to be synchronized.
[0064] In this embodiment, the data synchronization process needs to match descriptors of various target data to be synchronized. Based on the descriptors, corresponding operations can be performed on the target data, such as adding, modifying, updating, or deleting. A descriptor is an identifier used to describe data of the same type, such as a prefix.
[0065] According to the data synchronization method provided by the present invention, in the data synchronization processing program, the target data is added, modified, updated or deleted according to the descriptor information of all target data to be synchronized, which can synchronize the validity of the data, realize the real-time update of the target data and improve the user experience.
[0066] Based on any of the above embodiments, in this embodiment, as Figure 2 As shown, the first agent (primary agent) stores the target data to be synchronized in a relational database (Redis) and connects to the relational database in a cluster mode, storing the received target data to be synchronized on nodes within the relational database (Redis cluster). Then, the second agent (backup agent) synchronizes the target data, connecting to the master node of the relational database (Redis cluster) in single-node mode, treating each master node of the Redis cluster as a client, and establishing connections sequentially. Each connection requires the creation of corresponding related structure configurations and processing methods.
[0067] It should be noted that during the initialization process of the data synchronization plugin, the structure configuration and methods contained in each connection relationship are called sequentially to obtain the target data stored in each master node and store it in a unified channel.
[0068] It should be noted that the second agent (backup agent) needs to execute the target data retrieved from the synchronization channel and list the target data from the channel one by one for synchronization processing. The synchronization processing involves transferring the target data to the data synchronization processing program for scheduling and processing, executing a full data synchronization event.
[0069] It should be noted that the key-value (KV) processing program needs to match the KV descriptor information registered by various target data. Based on the descriptor information, operations such as adding, modifying, updating, or deleting the target data can be performed.
[0070] According to the data synchronization method provided by the present invention, for the Redis cluster environment on which the UPF microservice depends, the proxy application adopts a combination of single-node and cluster modes. The cluster mode is used to store the target data and ensure the high reliability of the target data storage, while the single-node mode is used to read and synchronize the target data and ensure the integrity of the target data synchronization processing. The combination of the two modes accurately ensures the consistency and integrity of the target data of the primary and backup UPF network elements, and ensures the implementation of the UPF microservice.
[0071] Figure 3 The present invention provides a data synchronization device, such as... Figure 3 As shown, the data synchronization device provided by the present invention includes:
[0072] Module 301 is used to acquire the target data to be synchronized;
[0073] Storage module 302 is used by the first agent program to store the target data to be synchronized on a node of a relational database;
[0074] The synchronization module 303 is used by the second agent program to obtain the target data to be synchronized from the nodes of the relational database and to perform synchronization processing on the target data to be synchronized.
[0075] According to the data synchronization device provided by the present invention, by acquiring the target data to be synchronized, a first agent program stores the target data to be synchronized on a node of a relational database, and a second agent program retrieves the target data to be synchronized from the node of the relational database and performs synchronization processing on the target data to be synchronized. The data synchronization device provided by the present invention can ensure high reliability of data storage, integrity of data synchronization, and implementation of UPF microservices, improve the data synchronization processing speed, and enhance the user experience.
[0076] Since the device described in this embodiment of the invention is based on the same principle as the method described in the above embodiments, more detailed explanations will not be repeated here.
[0077] Figure 4 This is a schematic diagram of the physical structure of the electronic device provided in the embodiments of the present invention, such as... Figure 4 As shown, the present invention provides an electronic device, including: a processor 401, a memory 402, and a bus 403;
[0078] The processor 401 and the memory 402 communicate with each other via the bus 403.
[0079] The processor 401 is used to call program instructions in the memory 402 to execute the methods provided in the above method embodiments, such as: acquiring target data to be synchronized; a first agent program storing the target data to be synchronized on a node of a relational database; and a second agent program acquiring the target data to be synchronized from the node of the relational database and performing synchronization processing on the target data to be synchronized.
[0080] Furthermore, the logical instructions in the aforementioned memory 403 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0081] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is able to execute the methods provided by the above methods, the method including: acquiring target data to be synchronized; a first agent program storing the target data to be synchronized on a node of a relational database; a second agent program acquiring the target data to be synchronized from the node of the relational database, and performing synchronization processing on the target data to be synchronized.
[0082] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods provided above, the method comprising: acquiring target data to be synchronized; a first agent program storing the target data to be synchronized on a node of a relational database; and a second agent program acquiring the target data to be synchronized from the node of the relational database and performing synchronization processing on the target data to be synchronized.
[0083] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data synchronization method, characterized in that, include: Obtain the target data to be synchronized from the UPF network element microservice; The first agent program stores the target data to be synchronized on the nodes of the relational database. The first agent program and the relational database are connected and communicated in a cluster communication manner. The first agent program stores the target data to be synchronized on the nodes of the relational database in a cluster manner. The second agent program obtains the target data to be synchronized from the nodes of the relational database and performs synchronization processing on the target data to be synchronized. The second agent program obtains the target data to be synchronized from the nodes of the relational database, including: Based on the mapping relationship between the nodes in the second agent program and the master node in the relational database, the second agent program obtains the target data to be synchronized from the master node of the relational database in a single-node manner; The synchronization process for the target data to be synchronized includes: Based on the connection relationship between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the multiple connected nodes into the corresponding target channel.
2. The data synchronization method according to claim 1, characterized in that, The synchronization process for the target data to be synchronized further includes: The target data stored in multiple target channels is retrieved in a preset order to obtain all the target data to be synchronized; All target data to be synchronized are stored in the data synchronization process, and a full data synchronization event is executed.
3. The data synchronization method according to claim 2, characterized in that, The step of storing all the target data to be synchronized into the data synchronization processing program and executing the full data synchronization event includes: In the data synchronization process, the target data is added, modified, updated, or deleted based on the descriptor information of all target data to be synchronized.
4. A data synchronization device, characterized in that, include: The acquisition module is used to obtain the target data to be synchronized from the UPF network element microservice; The storage module is used by the first agent program to store the target data to be synchronized on the node of the relational database. The first agent program and the relational database are connected and communicated in a cluster communication manner. The first agent program stores the target data to be synchronized on the node of the relational database in a cluster manner. The synchronization module is used by the second agent program to obtain the target data to be synchronized from the nodes of the relational database and to perform synchronization processing on the target data to be synchronized. The synchronization module is specifically used to obtain the target data to be synchronized from the master node of the relational database in a single-node manner, based on the mapping relationship between the nodes in the second agent program and the master node in the relational database. Based on the connection relationship between the data synchronization plugin and multiple nodes in the second agent program, the data synchronization plugin stores the target data from the multiple connected nodes into the corresponding target channel.
5. An electronic device, characterized in that, include: Processor, memory, and bus, among which, The processor and the memory communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, which can invoke the program instructions to perform the steps of the data synchronization method as described in any one of claims 1 to 3.
6. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the steps of the data synchronization method as described in any one of claims 1 to 3.
7. A computer program product, said computer program product comprising computer-executable instructions, characterized in that, When executed, the instructions are used to implement the steps of the data synchronization method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Method for clustering multiple nodes of memory database of power information system
CN102508881A
Hot data increment synchronization method and device based on KV indexes
CN111367996A
Data synchronization method and device, electronic equipment and storage medium
CN112966046A
Distributed high-speed storage system based on persistent redis storage service
CN113434515A