Data backup method and device of opendaylight-based SDN controller, and medium
Patent Information
- Application Number
- CN202210847396.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2042-07-19
AI Technical Summary
[0005]本说明书实施例提供了一种基于opendaylight的SDN控制器的数据备份方法及设备、介质,用于解决现有技术中的如下技术问题:基于opendaylight框架开发的SDN控制器采用集群实现数据备份需要全量同步整个快照,造成网络带宽的浪费,占用系统性能,甚至会导致集群分裂,对系统造成不可逆的损坏
[0053]本发明说明书实施例示例的基于opendaylight的SDN控制器的数据备份方法,通过设置一个主节点与若干备节点采用多机热备的方式来实现SDN控制器的数据同步及备份,当检测到主节点出现down机后,其中一个备节点可以自动将自己的状态切换为主节点,并向其余的备节点同步数据库信息。在本发明示例的数据备份方法中,备节点只承担数据备份功能,无需运行业务,因此每次数据备份只需要同步数据库的基本数据即可,相较于opendaylight的集群快照,本发明示例的数据备份方法同步的数据量小,对系统的开销占用也较小,不会导致系统损坏的问题;如果系统出现损坏等问题,能够方便地修复,可以有效地提高基于opendaylight的SDN控制器的数据备份的效率,
Smart Images

Figure CN115237674B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software development technology, and in particular to a data backup method, device, and medium based on an OpenDaylight-based SDN controller. Background Technology
[0002] Currently, SDN controllers developed based on the OpenDaylight framework use clustering for data backup. The OpenDaylight open-source framework employs the Akka clustering mechanism. The Akka module uses snapshot synchronization to achieve database synchronization between cluster nodes, preventing data loss due to server failures and thus achieving high availability for the database center SDN controller.
[0003] However, the clusters within the OpenDaylight framework are relatively fragile, and once a cluster splits, it is irrecoverable. Furthermore, OpenDaylight synchronizes data via snapshots. Over time, the amount of snapshot data requiring synchronization grows significantly. Each synchronization requires a full snapshot synchronization, resulting in substantial network bandwidth consumption and system performance degradation. If the snapshot data volume becomes too large, synchronization timeouts can occur, leading to cluster splits and irreversible system damage. Additionally, network fluctuations or server performance bottlenecks can also cause cluster splits, rendering the system unrecoverable.
[0004] Therefore, to better ensure data security, how to avoid using clustering to achieve data backup in SDN controllers has become a problem that urgently needs to be solved by those skilled in the art. Currently, there is a need to develop a new data backup method, device, and medium based on OpenDaylight for SDN controllers to synchronize and back up data in the SDN controller. This method aims to reduce the amount of synchronized data compared to cluster snapshots, thereby reducing system overhead and space usage, ensuring system stability and security, and making it easier to repair in case of system failure. Summary of the Invention
[0005] This specification provides a data backup method, device, and medium for an OpenDaylight-based SDN controller, which addresses the following technical problems in the prior art: SDN controllers developed based on the OpenDaylight framework require full synchronization of the entire snapshot to achieve data backup using a cluster, resulting in wasted network bandwidth, consuming system performance, and even causing cluster splitting, leading to irreversible damage to the system.
[0006] The embodiments in this specification adopt the following technical solutions:
[0007] A data backup method based on an OpenDaylight SDN controller, wherein a data backup system is composed of a master node and several backup nodes, the method comprising:
[0008] The master node acquires business data, writes the business data into its database, and synchronizes its database to the database of each backup node.
[0009] Detect the running status of the master node.
[0010] If the primary node goes down, a backup node is selected to become the new primary node;
[0011] The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
[0012] Furthermore, the master node synchronizes its database to the database of each backup node, including:
[0013] The database of the master node is written to the database of each backup node through a database API interface by listening.
[0014] The backup node senses changes in its database and queries the status of the primary node and the backup node.
[0015] If a query confirms that the node is not the master node, the business process will not be triggered.
[0016] Furthermore, detecting the operating status of the master node includes:
[0017] The master node sends keep-alive messages to each backup node at preset intervals.
[0018] If none of the backup nodes receive the keep-alive message within the preset time, the master node is confirmed to be down.
[0019] Further, a backup node is selected to become the new master node, including:
[0020] The system selects the new master node based on the pre-set priority of each backup node, and switches the status of the backup node with the highest priority to the new master node.
[0021] Furthermore, based on the pre-set priority of each backup node, the node with the highest priority is switched to become the new master node, including:
[0022] The corresponding delay time for each backup node is preset according to the priority order of the backup nodes;
[0023] If each backup node does not receive the keep-alive message within the preset time, each backup node will start timing according to the corresponding preset delay time. When the shortest delay time is reached, the backup node with the shortest delay time will send a request to become the new master node to the other backup nodes.
[0024] The remaining backup nodes receive the request, stop timing their corresponding delay time, and reply with an agreement to the request;
[0025] The backup node with the shortest delay time switches its status to become the new master node based on the response.
[0026] Furthermore, the data backup method for the OpenDaylight-based SDN controller also includes:
[0027] Detect the running status of the original master node after the machine goes down.
[0028] If the original master node recovers, then query the status of the original master node.
[0029] If the query confirms that the original master node is the initial master node, then its status is switched to prepare to become the master node, and an initial master node recovery request is sent to each backup node.
[0030] The new master node synchronizes the latest database data to the database of the original master node in full according to the recovery request of the initial master node.
[0031] Furthermore, the data backup method for the OpenDaylight-based SDN controller also includes:
[0032] After the original master node completes database synchronization, it sends a data synchronization completion message to the new master node.
[0033] Based on the data synchronization completion information, the new master node switches its status to a backup node, and the original master node switches its status from preparing to become a master node to becoming a master node.
[0034] Furthermore, the data backup method for the OpenDaylight-based SDN controller also includes:
[0035] Check the running status of the new master node.
[0036] If the new primary node goes down, another backup node is selected as the new secondary primary node;
[0037] If the new master node recovers, then query the status of the new master node.
[0038] If the query confirms that the new primary node is the initial backup node, then its status is switched to backup node.
[0039] A data backup device based on an OpenDaylight SDN controller, comprising:
[0040] At least one processor; and,
[0041] A memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions that can be executed by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0043] The master node acquires business data, writes the business data into its database, and synchronizes its database to the database of each backup node.
[0044] Detect the running status of the master node.
[0045] If the primary node goes down, a backup node is selected to become the new primary node;
[0046] The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
[0047] A non-volatile computer storage medium for data backup of an OpenDaylight-based SDN controller, storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0048] The master node acquires business data, writes the business data into its database, and synchronizes its database to the database of each backup node.
[0049] Detect the running status of the master node.
[0050] If the primary node goes down, a backup node is selected to become the new primary node;
[0051] The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
[0052] The above-described at least one technical solution used in the embodiments of this specification can achieve the following beneficial effects:
[0053] This invention provides an example of a data backup method for an OpenDaylight-based SDN controller. This method utilizes a multi-machine hot standby approach with one master node and several backup nodes to achieve data synchronization and backup for the SDN controller. When the master node fails, one of the backup nodes automatically switches to master status and synchronizes database information with the remaining backup nodes. In this example, the backup nodes only perform data backup and do not run any services. Therefore, each backup only needs to synchronize basic database data. Compared to OpenDaylight cluster snapshots, this method synchronizes less data, incurs less system overhead, and avoids system corruption. Furthermore, if system corruption occurs, it can be easily repaired, effectively improving the efficiency of data backup for OpenDaylight-based SDN controllers. Attached Figure Description
[0054] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0055] Figure 1 A schematic flowchart illustrating a data backup method for an SDN controller based on OpenDaylight provided in the embodiments of this specification;
[0056] Figure 2 A schematic diagram of an architecture consisting of a master node and several backup nodes, provided as an embodiment of this specification;
[0057] Figure 3 This is a schematic diagram illustrating how a new master node synchronizes database data with each backup node, as provided in the embodiments of this specification.
[0058] Figure 4 This is a schematic diagram illustrating how a new master node synchronizes database data with the recovered original master node, as provided in the embodiments of this specification. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this application.
[0060] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0061] like Figure 1 As shown, embodiments of this application provide a data backup method for an OpenDaylight-based SDN controller. For example... Figure 2 As shown, a data backup system consists of a master node and several backup nodes.
[0062] The data backup method for an SDN controller based on OpenDaylight, as exemplified in this application, includes: a master node acquiring service data, writing the service data into its database, and synchronizing its database to the databases of each backup node; detecting the running status of the master node, and if the master node goes down, selecting a backup node to become the new master node; the new master node acquiring service data, writing the service data into its database, and synchronizing its database to the databases of the remaining backup nodes.
[0063] This embodiment illustrates a data backup method for an SDN controller based on OpenDaylight. It employs a multi-machine hot standby approach to achieve data synchronization and backup of the SDN controller. The data backup system consists of a master node and several standby nodes. The operating status of the master node is monitored in real time. When the master node is detected to be down, one of the standby nodes can automatically switch its status to master node and synchronize database information with the other standby nodes.
[0064] Since the backup node only performs data backup functions and does not need to run services, each data backup only needs to synchronize basic database data. Compared to OpenDaylight cluster snapshots, the data backup method in this embodiment synchronizes less data and has lower system overhead, avoiding system corruption. If system corruption occurs, it can be easily repaired, effectively improving the efficiency of data backup for OpenDaylight-based SDN controllers.
[0065] In this embodiment, the master node synchronizes its database to the database of each backup node, including using a listening method to write the master node's database to the database of each backup node through the database API interface; the backup node senses the changes in its database, queries the status of the master node and the status of the backup node, and if the query confirms that the node is not the master node, the business process is not triggered.
[0066] When the master node receives business data and causes changes to its database, it listens and writes the data to the slave node's database via the database API. The slave node receives the database changes, checks the master / slave status, and if it finds it is not the master node, it does nothing and does not trigger any further business processes. This ensures the uniqueness of the business logic. Only the changed data is synchronized, ensuring that only a small amount of data needs to be synchronized each time.
[0067] In this embodiment, detecting the operating status of the master node includes the master node periodically sending keep-alive messages to each backup node according to a preset time. If one of the backup nodes does not receive a keep-alive message within the preset time, the master node is confirmed to be down.
[0068] In addition to synchronizing data with each standby node, the master node also periodically sends keep-alive messages to each standby node to indicate that its operating status is normal. If a standby node does not receive a keep-alive message from the master node within a set time, it confirms that the master node has gone down.
[0069] In this embodiment, selecting a backup node to become the new master node includes selecting based on the preset priority of each backup node, and switching the status of the backup node with the highest priority to the new master node.
[0070] After confirming the primary node is down, one of the backup nodes can be selected as the new primary node based on pre-set priorities. Each backup node has a pre-set priority, and the backup node with the highest priority will become the next primary node.
[0071] In this embodiment, the selection is based on the preset priority of each backup node, and the backup node with the highest priority is switched to the new master node. This includes presetting a corresponding delay time for each backup node according to the preset priority order; if no backup node receives a keep-alive message within the preset time, each backup node starts timing according to the preset corresponding delay time. When the shortest delay time is reached, the backup node with the shortest delay time sends a request to become the new master node to the other backup nodes; the other backup nodes receive the request, stop timing their corresponding delay time, and reply with an agreement request; the backup node with the shortest delay time switches its status to the new master node according to the reply.
[0072] The following steps can be used to ensure that the highest priority backup node becomes the next master node:
[0073] a. Set a delay time from shortest to longest for each backup node in descending order of priority.
[0074] b. If each standby node does not receive a keep-alive message from the master node within the preset time, each standby node will start a delay timer. When the shortest delay time is reached, the standby node with the shortest delay time will send a message to the other standby nodes requesting to become the new master node.
[0075] c. Since the highest priority backup node has the shortest corresponding delay time, the highest priority backup node can send the request to become the master node to the other backup nodes first. After receiving the request from the highest priority backup node, the other lower priority backup nodes stop their delay timers and reply with an acknowledgment message.
[0076] d. The highest priority standby node will switch its state to become the new master node after receiving all replies.
[0077] It is understandable that if the new primary node subsequently goes down, the remaining standby nodes can still follow the above steps according to the preset priority to determine the next primary node.
[0078] It is understandable that the above steps may also include: if one of the remaining standby nodes is down and fails to respond with an agreement message, the highest priority standby node waits until the timeout period and then automatically switches its status to become the new primary node.
[0079] like Figure 3 As shown, if the backup nodes are determined in order of priority from high to low according to the sequence 1, 2...n, then the backup node with the highest priority 1 will become the new master node, and then it will synchronize the database data to the other backup nodes.
[0080] In this embodiment, the data backup method of the SDN controller based on OpenDaylight further includes: detecting the running status of the original master node that has gone down; if the original master node recovers, querying the status of the original master node; if the query confirms that the original master node is the initial master node, then switching its status to prepare to become the master node, and sending an initial master node recovery request to each backup node; the new master node fully synchronizes the latest database data to the database of the original master node according to the initial master node recovery request.
[0081] After the original master node recovers from down to up, it detects that it is the initial master node, switches its state to the state of preparing to become the master node, and then sends an initial master node recovery request to all standby nodes. For example... Figure 4 As shown, the new master node will fully synchronize the latest database data to the original master node's database, ensuring that the data in the original master node's database is up-to-date.
[0082] In this embodiment, the data backup method of the SDN controller based on OpenDaylight further includes: after the original master node completes database synchronization, it sends data synchronization completion information to the new master node; according to the data synchronization completion information, the new master node switches its state to a backup node, and the original master node switches its state from preparing to become a master node to a master node.
[0083] After the database synchronization is complete, the original master node sends a data synchronization completion message to the new master node. The new master node will switch its master-slave status to a slave node, and the original master node will switch its status from preparing to become a master node to master node status.
[0084] In this embodiment, the data backup method of the SDN controller based on OpenDaylight further includes: detecting the running status of the new master node; if the new master node goes down, selecting another standby node to become the new master node; if the new master node recovers, querying the status of the new master node; if the query confirms that the new master node is the initial standby node, then switching its status to standby node.
[0085] After a standby node becomes a master node, if its status changes from down to up, it will switch its own master / standby status back to standby node to avoid the situation where there are multiple master nodes in the system.
[0086] Based on the same idea, some embodiments of this application also provide devices and non-volatile computer storage media corresponding to the above methods.
[0087] Some embodiments of this application provide corresponding Figure 1 A data backup device based on an OpenDaylight SDN controller, wherein the device includes:
[0088] At least one processor; and,
[0089] A memory communicatively connected to the at least one processor; wherein,
[0090] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:
[0091] The master node acquires business data, writes the business data into its database, and synchronizes its database to the database of each backup node.
[0092] Detect the running status of the master node.
[0093] If the primary node goes down, a backup node is selected to become the new primary node;
[0094] The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
[0095] Some embodiments of this application provide corresponding Figure 1A non-volatile computer storage medium for data backup based on an OpenDaylight-based SDN controller stores computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0096] The master node acquires business data, writes the business data into its database, and synchronizes its database to the database of each backup node.
[0097] Detect the running status of the master node.
[0098] If the primary node goes down, a backup node is selected to become the new primary node;
[0099] The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
[0100] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.
[0101] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0102] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0103] This invention relates to methods, apparatus (systems), and computer programs produced according to embodiments of the invention.
[0104] The flowcharts and / or block diagrams are used to describe the product. It should be understood that each block in the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the product in the flowcharts and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0105] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0106] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0107] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0108] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0109] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0110] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0111] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A data backup method for an SDN controller based on OpenDaylight, characterized in that, A data backup system consisting of a primary node and several backup nodes, the method comprising: The master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of each backup node. Detect the running status of the master node. If the primary node goes down, a backup node is selected to become the new primary node; Detect the running status of the original master node after the machine goes down. If the original master node recovers, then query the status of the original master node. If the query confirms that the original master node is the initial master node, then its status is switched to prepare to become the master node, and an initial master node recovery request is sent to each backup node. The new master node synchronizes the latest database data to the database of the original master node in full according to the recovery request of the initial master node; After the original master node completes database synchronization, it sends a data synchronization completion message to the new master node. Based on the data synchronization completion information, the new master node switches its status to a backup node, and the original master node switches its status from preparing to become a master node to a master node. Check the running status of the new master node. If the new primary node goes down, another backup node is selected as the new secondary primary node; If the new master node recovers, then query the status of the new master node. If the query confirms that the new master node is the initial backup node, then its status is switched to backup node; The new master node acquires business data, writes the business data into its database, and synchronizes its database to the databases of the remaining backup nodes.
2. The data backup method for an SDN controller based on OpenDaylight as described in claim 1, characterized in that, The master node synchronizes its database to the databases of each backup node, including: The database of the master node is written to the database of each backup node through a database API interface by listening. The backup node senses changes in its database and queries the status of the primary node and the backup node. If a query confirms that the node is not the master node, the business process will not be triggered.
3. The data backup method for an OpenDaylight-based SDN controller as described in claim 1, characterized in that, Detecting the running status of the master node includes: The master node sends keep-alive messages to each backup node at preset intervals. If none of the backup nodes receive the keep-alive message within the preset time, the master node is confirmed to be down.
4. The data backup method for an OpenDaylight-based SDN controller as described in claim 3, characterized in that, Select a backup node to become the new master node, including: The system selects the new master node based on the pre-set priority of each backup node, and switches the status of the backup node with the highest priority to the new master node.
5. The data backup method for an OpenDaylight-based SDN controller as described in claim 4, characterized in that, Based on the pre-set priority of each backup node, the node with the highest priority is selected and its status is switched to become the new master node, including: The corresponding delay time for each backup node is preset according to the priority order of the backup nodes; If each backup node does not receive the keep-alive message within the preset time, each backup node will start timing according to the corresponding preset delay time. When the shortest delay time is reached, the backup node with the shortest delay time will send a request to become the new master node to the other backup nodes. The remaining backup nodes receive the request, stop timing their corresponding delay time, and reply with an agreement to the request; The backup node with the shortest delay time switches its status to become the new master node based on the response.
6. A data backup device based on an OpenDaylight SDN controller, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the data backup method for the OpenDaylight-based SDN controller according to any one of claims 1-5.
7. A non-volatile computer storage medium for data backup of an OpenDaylight-based SDN controller, storing computer-executable instructions, characterized in that, The computer-executable instructions are capable of executing the data backup method for an OpenDaylight-based SDN controller according to any one of claims 1-5.
Citation Information
Patent Citations
Method and device for switching between master node and standby node
CN104679604A
Data backup method and device
CN106502829A
Node availability management and control method, node, cluster, device and medium
CN113704029A