Method for realizing, managing and controlling universal dual-computer hot standby

By changing the connection method of service equipment and using keepalive software, dual-machine hot standby status switching and service data synchronization are achieved, solving the problem of deep binding and high implementation costs of hot standby mechanisms and applications in the existing technology, and a flexible deployment mode and reduced upgrade and transformation difficulty are achieved.

CN119597544APending Publication Date: 2025-03-11NO 30 INST OF CHINA ELECTRONIC TECH GRP CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411689510.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, the hot standby mechanism is deeply bound to actual applications. The hot standby implementation mechanism cannot be reused, the implementation cost is high, and it is difficult to upgrade and transform existing systems.

Method used

By changing the connection mode of the two service devices, they can perform hot standby status switching and service data synchronization, use keepalive software to realize hot standby status switching and drift address management, realize the synchronization of the database and file storage methods of business data, build control command transmission services, and isolate the system's business and hot standby functions through the system adaptation module.

Benefits of technology

It realizes a dual-machine hot standby deployment that does not affect the existing business logic and system management methods, supports single-machine and dual-machine hot standby mode switching, reduces implementation costs and upgrades and transformation difficulties, and improves the maintainability and availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597544A_ABST
    Figure CN119597544A_ABST
Patent Text Reader

Abstract

The invention discloses a universal dual-computer hot standby implementation, management and control method, and relates to the field of hot standby deployment. According to the invention, aiming at some small and medium-sized application scenarios with high reliability requirements, a general dual-computer hot standby implementation scheme is realized, so that the problems that the existing hot standby mechanism is deeply bound with the practical application, the hot standby implementation mechanism cannot be reused, the implementation cost is high, the existing system is difficult to upgrade and reconstruct and the like are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of hot standby deployment, and in particular to a general dual-machine hot standby implementation, management and control method. Background Art

[0002] The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.

[0003] In various applications and management systems, the long-term normal operation of the core functional server is the key to the stability of the entire system. In large-scale applications and management systems, multi-server cluster deployment, distributed deployment and other solutions are generally used to improve the availability and reliability of the entire system; such solutions are complex to implement, high deployment costs, and difficult to operate and maintain, and are generally not suitable for small and medium-sized application systems. In most small and medium-sized application systems, one server is usually used to meet service needs. This deployment method has the advantages of low development difficulty, low construction cost, flexible deployment, and high maintainability, but it also has reliability issues such as single-machine failures, and cannot meet the needs of some applications with high reliability requirements.

[0004] At present, in application scenarios with high reliability requirements, some of them are solved by scheduled backup of business data and cold standby deployment of multiple devices, while others are solved by dual-machine hot standby mechanism. In such solutions, the former has problems such as business data loss and uncontrollable business interruption time. Although the latter can solve the reliability problem well, the implementation scheme often has problems such as deep binding with actual applications, non-reusable implementation mechanism, and high implementation cost. Therefore, it is necessary to design a universal dual-machine hot standby implementation scheme that neither affects the existing business logic implementation nor changes the original management and use of the system, supports dual-machine hot standby deployment and single-machine deployment mode, meets the deployment requirements of different application scenarios, improves implementation efficiency and reduces implementation cost. Summary of the invention

[0005] The purpose of the present invention is to solve the problems of deep binding of the current hot standby mechanism with actual application, the non-reusability of the hot standby implementation mechanism, the high implementation cost, and the difficulty in upgrading and transforming the existing system by implementing a universal dual-machine hot standby implementation solution for some small and medium-sized application scenarios with high reliability requirements.

[0006] The technical solution of the present invention is as follows:

[0007] A general dual-machine hot standby implementation, management, and control method includes:

[0008] Step S1: changing the connection mode of the two service devices so that the two service devices can perform hot standby state switching and business data synchronization;

[0009] Step S2: Use keepalive software to implement hot standby state switching and drift address management;

[0010] Step S3: Synchronize the service data of the two service devices, and divide the service data into two categories according to the storage method: service data stored in the database and service data stored in the file; the service data stored in the database is synchronized online based on the database's native master-slave synchronization mechanism, and the service data stored in the file is synchronized using inotify+rsync;

[0011] Step S4: synchronize the time of the two service devices;

[0012] Step S5: Building a control instruction transmission service for transmitting control instructions between the primary and standby devices to achieve linkage control of the two devices;

[0013] Step S6: Through the system adaptation module, the functions of isolating system services and hot standby are realized to complete the decoupling between the two.

[0014] Furthermore, the step S1 comprises:

[0015] Step S11: connecting the two service devices through a dedicated network port, so as to synchronize the service data of the two service devices and implement the active / standby state switching function;

[0016] Step S12: connecting the service ports of the two service devices to the external network through the switch, and the service device in the host state obtains the virtual service address and provides services to the outside world;

[0017] Step S13: Connect the local management port of the device to the management client through the switch, and the service device in the host state obtains the virtual management address to provide system management and maintenance services for the user.

[0018] Furthermore, the step S2 comprises:

[0019] Step S21: When the device is powered on, the system adapter module obtains hot standby information, initializes the keepalived service program, and starts the keepalived service;

[0020] Step S22: The system adapter module provides a service device operation status detection interface for keepalived to obtain the real-time operation status of the system;

[0021] Step S23: Implement the state switching function, complete the device virtual address configuration, and open or close the file and time synchronization service.

[0022] Furthermore, the business data synchronization method in step S3 includes:

[0023] Step A: When the device is powered on, the system adapter module obtains hot standby related information and initializes the database configuration file;

[0024] Step B: Start the database service and enable the data synchronization function;

[0025] Step C: To improve usability, when the automatic database synchronization fails and cannot be restored by itself, a one-key recovery function for database synchronization is provided. When the user triggers the one-key recovery function, the host will create a database mirror and forward it to the standby machine. The standby machine uses the mirror file to restore the database data and then restarts data synchronization from the mirror point.

[0026] Furthermore, the file synchronization method in step S3 includes:

[0027] Step 1: When the device is powered on, the system adapter module obtains the hot standby address, monitors the file list information, and completes the file synchronization service initialization;

[0028] Step 2: Start the file transfer service;

[0029] Step 3: Turn on or off the file synchronization service according to the current state of the device. If it is in the master state, turn on the service; if it is in the standby state, turn off the service. The master-standby switching module turns on or off the file synchronization service while switching the device state.

[0030] Step 4: When in standby mode, the file change monitoring service is turned off and the file receiving service is started;

[0031] Step 5: When in the host state, start the inotify file status change monitoring service. When a file change is found, call the rsync file synchronization tool to complete the file synchronization;

[0032] Step 6: If the file synchronization fails, the file information of the failed synchronization is recorded;

[0033] Step 7: If file synchronization fails, the retry module will periodically resynchronize files to the backup server until the file synchronization succeeds.

[0034] Furthermore, the step S4 uses the ntp time synchronization tool to complete time synchronization.

[0035] Furthermore, the step S4 comprises:

[0036] Step S41: When the device is powered on, the adapter module obtains the hot standby configuration information and completes the time synchronization service initialization;

[0037] Step S42: the master-slave switching module completes the time synchronization mode switching while implementing the device state switching;

[0038] Step S43: when the device is in the standby working state, start the scheduled time synchronization task to perform time synchronization with the device in the master state at regular intervals;

[0039] Step S44: When the device is in the host working state, the time synchronization service is started to receive a time synchronization request from the device in the standby state.

[0040] Furthermore, the step S5 comprises:

[0041] Step S51: the original service program of the device sends a device control instruction through the system adapter module;

[0042] Step S52: the system adaptation module forwards the device control instruction to another device;

[0043] Step S53: the device receives the control instruction and calls the original service program through the system adaptation module to execute the relevant control instruction.

[0044] Furthermore, the system adaptation module is used to isolate the device service program and the hot standby function module, so that the hot standby function module can be implemented independently and reduce the impact on the device service logic.

[0045] Furthermore, the system adaptation module completes the following aspects:

[0046] (1) When the device is powered on, complete file synchronization, time synchronization, database synchronization, and initialization of the keepalived service, and start the corresponding services;

[0047] (2) Implement the running status detection interface for keepalived to support keepalived to detect the system running status;

[0048] (3) Implement the device control instruction transmission agent function, provide an instruction transmission interface for the device service program, and call the device service program interface to complete the control instruction execution.

[0049] Compared with the prior art, the present invention has the following beneficial effects:

[0050] 1. The present invention does not affect the original deployment mode of the equipment. Users can choose the deployment mode according to their needs, which can well meet different application requirements;

[0051] 2. The present invention isolates the hot standby function module and the device service program through the system adapter module. The hot standby function logic does not affect the implementation of the device service program. At the same time, it can be applied to other application scenarios by only modifying the system adapter module, and the difficulty of upgrading and transforming the existing system is greatly reduced;

[0052] 3. The present invention supports integrated equipment control and one-key fault recovery functions without changing the user's existing operation and maintenance methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is the overall implementation idea diagram for dual-machine hot standby;

[0054] Figure 2 This is a schematic diagram of the device connection;

[0055] Figure 3 This is a dual-machine hot standby switching flow chart;

[0056] Figure 4 It is a flowchart of database data synchronization;

[0057] Figure 5 It is a flowchart of file synchronization;

[0058] Figure 6 Generate a flow chart for the query template;

[0059] Figure 7 To control the instruction processing flow. DETAILED DESCRIPTION

[0060] It should be noted that relational terms such as "first" and "second" are used only 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 sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0061] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.

[0062] Embodiment 1

[0063] See also Figure 1 A general dual-machine hot standby implementation, management, and control method specifically includes the following steps:

[0064] Step S1: changing the connection mode of the two service devices so that the two service devices can perform hot standby state switching and business data synchronization;

[0065] Step S2: Use keepalive software to implement hot standby state switching and drift address management;

[0066] Step S3: Synchronize the service data of the two service devices, and divide the service data into two categories according to the storage method: service data stored in the database and service data stored in the file; the service data stored in the database is synchronized online based on the database's native master-slave synchronization mechanism, and the service data stored in the file is synchronized using inotify+rsync;

[0067] Step S4: synchronize the time of the two service devices;

[0068] Step S5: Building a control command transmission service to transmit control commands between the primary and standby devices, such as system shutdown, restart, system upgrade and other operation commands, to achieve linkage control of the two devices;

[0069] Step S6: Through the system adaptation module, the functions of isolating system services and hot standby are realized to complete the decoupling between the two.

[0070] In this embodiment, specifically, step S1 includes (i.e., changing the service device connection mode as follows):

[0071] Step S11: connecting the two service devices through a dedicated network port, so as to synchronize the service data of the two service devices and implement the active / standby state switching function;

[0072] Step S12: connecting the service ports of the two service devices to the external network through the switch, and the service device in the host state obtains the virtual service address and provides services to the outside world;

[0073] Step S13: Connect the local management port of the device to the management client through the switch, and the service device in the host state obtains the virtual management address to provide system management and maintenance services for the user;

[0074] The device network connection diagram is as follows: Figure 2 shown.

[0075] In this embodiment, please refer to Figure 3 , the step S2 includes (that is, the dual-machine hot standby switching process is as follows):

[0076] Step S21: When the device is powered on, the system adapter module obtains hot standby information, initializes the keepalived service program, and starts the keepalived service;

[0077] Step S22: The system adapter module provides a service device operation status detection interface for keepalived to obtain the real-time operation status of the system;

[0078] Step S23: Implement the state switching function, complete the device virtual address configuration, and open or close the file and time synchronization service.

[0079] In this embodiment, specifically, this embodiment relies on the database native master-slave data synchronization solution to achieve business data synchronization, such as MySQL's log-based master-slave synchronization solution;

[0080] For details, please refer to Figure 4 The business data synchronization method in step S3 includes:

[0081] Step A: When the device is powered on, the system adapter module obtains hot standby related information and initializes the database configuration file;

[0082] Step B: Start the database service and enable the data synchronization function;

[0083] Step C: To improve usability, when the automatic database synchronization fails and cannot be restored by itself, a one-key recovery function for database synchronization is provided. When the user triggers the one-key recovery function, the host will create a database mirror and forward it to the standby machine. The standby machine uses the mirror file to restore the database data and then restarts data synchronization from the mirror point.

[0084] In this embodiment, specifically, the business data stored in files is synchronized using the inotify+rsync tool, and the synchronization process is as follows: Figure 5 Specifically, the file synchronization method in step S3 includes:

[0085] Step 1: When the device is powered on, the system adapter module obtains the hot standby address, monitors the file list information, and completes the file synchronization service initialization;

[0086] Step 2: Start the file transfer service;

[0087] Step 3: Turn on or off the file synchronization service according to the current state of the device. If it is in the master state, turn on the service; if it is in the standby state, turn off the service. The master-standby switching module turns on or off the file synchronization service while switching the device state.

[0088] Step 4: When in standby mode, the file change monitoring service is turned off and the file receiving service is started;

[0089] Step 5: When in the host state, start the inotify file status change monitoring service. When a file change is found, call the rsync file synchronization tool to complete the file synchronization;

[0090] Step 6: If the file synchronization fails, the file information of the failed synchronization is recorded;

[0091] Step 7: If file synchronization fails, the retry module will periodically resynchronize files to the backup server until the file synchronization succeeds.

[0092] In this embodiment, specifically, step S4 uses the ntp time synchronization tool to complete time synchronization.

[0093] In this embodiment, please refer to Figure 6 , the step S4 comprises:

[0094] Step S41: When the device is powered on, the adapter module obtains the hot standby configuration information and completes the time synchronization service initialization;

[0095] Step S42: the master-slave switching module completes the time synchronization mode switching while implementing the device state switching;

[0096] Step S43: when the device is in the standby working state, start the scheduled time synchronization task to perform time synchronization with the device in the master state at regular intervals;

[0097] Step S44: When the device is in the host working state, the time synchronization service is started to receive a time synchronization request from the device in the standby state.

[0098] In this embodiment, the control instruction transmission service implements the device control instruction transmission, which is used to transmit the control instruction triggered by the user on one device to another device and execute the relevant instructions, so as to achieve the purpose of controlling two devices at the same time, facilitate user operation and maintenance, and realize one-key shutdown, restart, system upgrade and other functions. Its processing flow is as follows: Figure 7 As shown, specifically, step S5 includes (that is, the control instruction transmission service processing flow is as follows):

[0099] Step S51: the original service program of the device sends a device control instruction through the system adapter module;

[0100] Step S52: the system adaptation module forwards the device control instruction to another device;

[0101] Step S53: the device receives the control instruction and calls the original service program through the system adaptation module to execute the relevant control instruction.

[0102] In this embodiment, specifically, the system adapter module is used to isolate the device service program and the hot standby function module, so that the hot standby function module can be implemented independently and reduce the impact on the device service logic. It mainly completes the following aspects:

[0103] (1) When the device is powered on, complete file synchronization, time synchronization, database synchronization, and initialization of the keepalived service, and start the corresponding services;

[0104] (2) Implement the running status detection interface for keepalived to support keepalived to detect the system running status;

[0105] (3) Implement the device control instruction transmission agent function, provide an instruction transmission interface for the device service program, and call the device service program interface to complete the control instruction execution.

[0106] The general dual-machine hot standby implementation, management, and control method proposed in this embodiment supports on-demand switching between single-machine and dual-machine hot standby deployment modes. This design does not affect the original service program structure of the device. The switching between single-machine and dual-machine hot standby working modes can be completed by turning on and off the hot standby function module.

[0107] The general dual-machine hot standby implementation, management, and control method proposed in this embodiment introduces a system adaptation module, isolates the hot standby function module and the device service program logic, has little impact on the system service program implementation, reduces the difficulty of system adaptation, and facilitates the upgrade and transformation of existing systems.

[0108] The general dual-machine hot standby implementation, management, and control method proposed in this embodiment introduces a control instruction transmission function, so that two devices can respond to device control instructions at the same time, simplifying the management operation during device hot standby deployment and improving the maintainability of the system;

[0109] The general dual-machine hot standby implementation, management, and control method proposed in this embodiment supports a one-key recovery function for database synchronization exceptions, automatically solves database synchronization exception problems, and improves system availability.

[0110] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.

[0111] This background section is provided to generally present the context of the invention, and the work of the presently named inventors, the work to the extent described in this background section, and aspects of this section that did not constitute prior art at the time of application are neither explicitly nor implicitly admitted to be prior art to the present invention.

Claims

1. A general dual-machine hot standby implementation, management, and control method, characterized in that: include: Step S1: changing the connection mode of the two service devices so that the two service devices can perform hot standby state switching and business data synchronization; Step S2: Use keepalive software to implement hot standby state switching and drift address management; Step S3: Synchronize the service data of the two service devices, and divide the service data into two categories according to the storage method: service data stored in the database and service data stored in the file; the service data stored in the database is synchronized online based on the database's native master-slave synchronization mechanism, and the service data stored in the file is synchronized using inotify+rsync; Step S4: synchronize the time of the two service devices; Step S5: Building a control instruction transmission service for transmitting control instructions between the primary and standby devices to achieve linkage control of the two devices; Step S6: Through the system adaptation module, the functions of isolating system services and hot standby are realized to complete the decoupling between the two.

2. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The step S1 comprises: Step S11: connecting the two service devices through a dedicated network port, so as to synchronize the service data of the two service devices and implement the active / standby state switching function; Step S12: connecting the service ports of the two service devices to the external network through the switch, and the service device in the host state obtains the virtual service address and provides services to the outside world; Step S13: Connect the local management port of the device to the management client through the switch, and the service device in the host state obtains the virtual management address to provide system management and maintenance services for the user.

3. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The step S2 comprises: Step S21: When the device is powered on, the system adapter module obtains hot standby information, initializes the keepalived service program, and starts the keepalived service; Step S22: The system adapter module provides a service device operation status detection interface for keepalived to obtain the real-time operation status of the system; Step S23: Implement the state switching function, complete the device virtual address configuration, and open or close the file and time synchronization service.

4. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The business data synchronization method in step S3 includes: Step A: When the device is powered on, the system adapter module obtains hot standby related information and initializes the database configuration file; Step B: Start the database service and enable the data synchronization function; Step C: To improve usability, when the automatic database synchronization fails and cannot be restored by itself, a one-key recovery function for database synchronization is provided. When the user triggers the one-key recovery function, the host will create a database mirror and forward it to the standby machine. The standby machine uses the mirror file to restore the database data and then restarts data synchronization from the mirror point.

5. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The file synchronization method in step S3 includes: Step 1: When the device is powered on, the system adapter module obtains the hot standby address, monitors the file list information, and completes the file synchronization service initialization; Step 2: Start the file transfer service; Step 3: Turn on or off the file synchronization service according to the current state of the device. If it is in the master state, turn on the service; if it is in the standby state, turn off the service. The master-standby switching module turns on or off the file synchronization service while switching the device state. Step 4: When in standby mode, the file change monitoring service is turned off and the file receiving service is started; Step 5: When in the host state, start the inotify file status change monitoring service. When a file change is found, call the rsync file synchronization tool to complete the file synchronization; Step 6: If the file synchronization fails, the file information of the failed synchronization is recorded; Step 7: If file synchronization fails, the retry module will periodically resynchronize files to the backup server until the file synchronization succeeds.

6. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The step S4 uses the ntp time synchronization tool to complete time synchronization.

7. A general dual-machine hot standby implementation, management and control method according to claim 6, characterized in that: The step S4 comprises: Step S41: When the device is powered on, the adapter module obtains the hot standby configuration information and completes the time synchronization service initialization; Step S42: the master-slave switching module completes the time synchronization mode switching while implementing the device state switching; Step S43: when the device is in the standby working state, start the scheduled time synchronization task to perform time synchronization with the device in the master state at regular intervals; Step S44: When the device is in the host working state, the time synchronization service is started to receive a time synchronization request from the device in the standby state.

8. A general dual-machine hot standby implementation, management, and control method according to claim 1, characterized in that: The step S5 comprises: Step S51: the original service program of the device sends a device control instruction through the system adapter module; Step S52: the system adaptation module forwards the device control instruction to another device; Step S53: the device receives the control instruction and calls the original service program through the system adaptation module to execute the relevant control instruction.

9. A general dual-machine hot standby implementation, management, and control method according to any one of claims 1 to 8, characterized in that: The system adapter module is used to isolate the device service program and the hot standby function module, so that the hot standby function module can be implemented independently and reduce the impact on the device business logic.

10. A general dual-machine hot standby implementation, management and control method according to claim 9, characterized in that: The system adaptation module completes the following aspects: (1) When the device is powered on, complete file synchronization, time synchronization, database synchronization, and initialization of the keepalived service, and start the corresponding services; (2) Implement the running status detection interface for keepalived to support keepalived to detect the system running status; (3) Implement the device control instruction transmission agent function, provide an instruction transmission interface for the device service program, and call the device service program interface to complete the control instruction execution.