Detailed Description
The embodiment of the specification provides a disaster recovery method and a server.
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort shall fall within the protection scope of the present specification.
When the main library has a disaster, operation and maintenance personnel are required to switch the application route to the disaster recovery library, and research and development personnel perform data consistency check and data synchronization operation. After the main library is recovered, the operation and maintenance personnel switch the applied route to the main library, and meanwhile, research and development personnel carry out data consistency verification and data synchronization operation. For payment applications involving user capital security, extensive manual operations may not avoid the risk of asset loss during operation, and communication and the like during manual operations may increase recovery time required for disaster recovery. Based on this, the embodiment of the specification can automatically realize disaster recovery when a disaster occurs, avoid the risk of asset loss caused by manual operation, reduce recovery time and improve disaster recovery efficiency.
An embodiment of a method for disaster recovery according to the present specification is described below. Figure 1 is a schematic flow diagram of one embodiment of a method for disaster recovery provided herein, which provides the method operations as described in the embodiments or flowcharts, but may include more or fewer operations based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual implementation, the system or client product may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures. Figure 2 is a timing diagram illustrating an embodiment of a disaster recovery method provided by the present description. Specifically, as shown in fig. 1 and fig. 2, the method may include:
s102: and detecting the state of the main warehouse, and judging whether to start disaster recovery according to the detection result.
The state of the main library can be detected, and whether disaster recovery is started or not is judged according to the detection result.
Specifically, a connection request may be initiated to the master library at preset time intervals, and whether the master library responds to the connection request is detected. The detection result may include: the master library responds to the connection request, or the master library does not respond to the connection request.
The determining whether to open the disaster recovery according to the detection result may include: and when the frequency of the main library for responding the connection request reaches a first preset frequency, starting disaster recovery. The first preset times can be selected according to practical application. For example, 10, 20, etc. may be selected.
After disaster tolerance is started, the data operation of the application associated with the main library can be transferred to the disaster recovery library for execution. The application associated with the master library may be one or more.
In another embodiment, prior to detecting the master library state, the method may further comprise: and inquiring whether the data of the application server associated with the master library meets disaster recovery switching conditions. And if not, storing the application data. The data that does not satisfy the disaster recovery switching condition may specifically include: the data cannot be synchronized to the disaster recovery database. At this time, data that cannot satisfy the disaster recovery switching condition needs to be stored in the preset memory. The preset memory may not be the disaster recovery library.
S104: and when the judgment result is yes, switching the state of the application server associated with the master library to a first preset state.
And when the judgment result is yes, the disaster tolerance can be started.
State switching may be performed for application servers associated with the master library. The state of the application server associated with the master library may be used to represent a database in which the application server performs data operations.
The first preset state may be used to indicate that the database where the application server performs data operation is a disaster recovery database.
For example, the original state of the application server may be "Master", which indicates that the data operated by the application server is a Master library, and after disaster tolerance is opened, the state of the application server may be switched to a first preset state, for example, "Failover", and when the state of the application server is "Failover", the data operated by the application server may be a disaster recovery library.
The switching of the state of the application server to the first preset state may be implemented by using a state machine. Specifically, the triggering condition for switching to the first preset state may be preset to start disaster recovery. Then, after disaster tolerance is started, the state machine can automatically switch the state of the application server to a first preset state.
S106: and acquiring the state of the application server, and recovering the service when the states of the application server are all the first preset states.
The state of the application server may be obtained, and it is checked whether the states of the application server have all been switched to the first preset state. The state of the application server can be obtained by means of state broadcasting.
And when the states of the application servers associated with the master library are all the first preset states, recovering the service. At this time, the data operation applied after the service is recovered is performed in the disaster recovery database.
S108: detecting whether the master library is recovered.
It may be detected whether the master library is restored. Specifically, a connection request may be initiated to the master library at preset time intervals, and whether the master library responds to the connection request is detected. When the number of times that the master library responds to the connection request reaches a second preset number of times, it may be determined that the master library has been restored. The first preset times can be selected according to practical application.
S110: and if the master library is detected to be recovered, switching the state of the application server to a second preset state.
After the master library is recovered, the state of the application server may be switched to a second preset state.
The second preset state may be used to indicate that the database where the application server performs data operations is a master database.
The switching of the state of the application server to the second preset state may be implemented by using a state machine. Specifically, the trigger condition for switching to the second preset state may be preset as the master library recovery. Then, when it is detected that the master library is restored, the state machine may automatically switch the state of the application server to a second preset state.
S112: and acquiring the state of the application server, and recovering the service when the states of the application server are all the second preset states.
The state of the application server may be acquired and it is checked whether the state of the application server has been switched to a second preset state. And when the states of the application servers associated with the master library are all the second preset states, the service can be recovered. At this time, the data operation of the application after the service is restored is performed in the master library.
In another embodiment, the method may further comprise: and processing the disaster backup database data.
The processing of the disaster backup database data may include: and backing up and/or cleaning the disaster backup database data.
In another embodiment, the method may further comprise: disaster recovery information is recorded.
The disaster recovery information may include: time of disaster occurrence, disaster recovery flow, disaster recovery time, and business data during disaster recovery.
By recording disaster recovery information, the disaster recovery processing method can be further optimized based on the recorded disaster recovery information.
Therefore, in one or more embodiments of the disaster recovery method in the present specification, by actively detecting the state of the master library to determine whether to open the disaster recovery, the disaster recovery can be found in time, and the disaster recovery speed can be increased. Meanwhile, the database of the application server for data processing currently is represented by the state of the application server associated with the supervisor, the state of the application server is processed by the state machine, the application server can be automatically switched between the main library and the disaster recovery library, and the consistency of the application server can be determined by checking the consistency of the states. Therefore, the embodiment of the disaster recovery method provided by the specification can realize a full-automatic disaster recovery process without manual intervention, and the disaster recovery efficiency is improved. Meanwhile, because manual operation is not needed, the risk of asset loss in the disaster recovery process can be avoided.
In another aspect, a disaster recovery server is provided, and fig. 3 is a schematic structural diagram of an embodiment of the disaster recovery server provided in this specification, and as shown in fig. 3, the disaster recovery server may include: a master library detection module 202, a state switching module 204, and a state consistency check module 206.
The master library detection module 202 may be configured to detect a master library state, and determine whether to open a disaster tolerance according to a detection result. The master library detection module 202 may be further configured to detect whether the master library is recovered.
The state switching module 204 may be configured to switch the state of the application server associated with the master library to a first preset state when the determination result of determining whether to start disaster recovery is yes. The state switching module 204 may be further configured to switch the state of the application server to a second preset state when it is detected that the master library is recovered. The state of the application server associated with the master library may be used to represent a database in which the application server performs data operations. The first preset state may be used to indicate that the database where the application server performs data operation is a disaster recovery database. The second preset state may be used to indicate that the database where the application server performs data operations is a master database.
The state consistency check module 206 may be configured to obtain the states of the application servers, recover the service when the states of the application servers are all in a first preset state, and recover the service when the states of the application servers are all in a second preset state.
In another embodiment, the server may further include: and a disaster recovery switching condition checking module, configured to query whether application data associated with the master library meets a disaster recovery switching condition before the master library detecting module 202 detects the master library state. The data that does not satisfy the disaster recovery switching condition may include: the data cannot be synchronized to the disaster recovery database.
In another embodiment, the server may further include: and the disaster backup database data processing module is used for processing the disaster backup database data. The processing of the disaster backup database data may include: and backing up and/or cleaning the disaster backup database data.
In another embodiment, the server may further include: and the information recording module is used for recording the disaster recovery information. The disaster recovery information may include: time of disaster occurrence, disaster recovery flow, disaster recovery time, and business data during disaster recovery.
The disaster recovery method or the server provided in the embodiments of the present specification may be implemented in a computer by a processor executing corresponding program instructions, for example, implemented on a PC side using a c + + language of a windows operating system, or implemented on an intelligent terminal using, for example, android and iOS system programming languages, and implemented on a processing logic based on a quantum computer. As shown in fig. 4, fig. 4 is a schematic block diagram of a server according to an exemplary embodiment of the present description. At the hardware level, the server may include a processor, an internal bus, a transport module, and a memory. The memory may include memory as well as non-volatile memory. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the word string recognition device on the logic level. It will be understood by those skilled in the art that the structure shown in fig. 4 is only an illustration, and is not a limitation to the structure of the server. For example, the server may also include more or fewer components than shown in fig. 4, and may also include other Processing hardware, such as a GPU (Graphics Processing Unit), for example, or have a different configuration than that shown in fig. 4. Of course, besides the software implementation, the present application does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Specifically, another aspect of the present specification further provides a server, including a processor and a memory, where the memory stores computer program instructions executed by the processor, and the processor executes the computer program instructions to implement the following steps:
detecting the state of the main warehouse, and judging whether to open disaster tolerance according to the detection result;
when the judgment result is yes, switching the state of the application server associated with the master library to a first preset state;
acquiring the state of the application server, and recovering the service when the states of the application server are all the first preset states;
detecting whether the master library is recovered;
if the master library is detected to be recovered, switching the state of the application server to a second preset state;
and acquiring the state of the application server, and recovering the service when the states of the application server are all the second preset states.
In the embodiment of the present disclosure, the processor may include a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU), and may also include other single-chip microcomputers, logic gates, integrated circuits, and the like with logic processing capability, or a suitable combination thereof. The memory according to the embodiment of the present application may be a memory device for storing information. In a digital system, the device capable of storing binary data may be a memory; in an integrated circuit, a circuit without an actual form and with a storage function can also be a memory, such as a RAM, a FIFO and the like; in the system, the storage device in physical form may also be called a memory or the like. When the method is implemented, the memory can also be implemented in a cloud memory mode, and the specific implementation mode is not limited in this specification.
Therefore, the embodiment of the disaster recovery server provided by the specification and the embodiment of the method provided by the specification are based on the same innovative concept, and therefore, the embodiment of the disaster recovery server provided by the specification can achieve the technical effects of the embodiment of the method provided by the specification.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The apparatuses, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or implemented by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may 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, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, apparatus or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may 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, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device and server embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of the present specification should be included in the scope of the claims.