CN104679604A - Method and device for switching between master node and standby node - Google Patents
Method and device for switching between master node and standby node Download PDFInfo
- Publication number
- CN104679604A CN104679604A CN201510076881.XA CN201510076881A CN104679604A CN 104679604 A CN104679604 A CN 104679604A CN 201510076881 A CN201510076881 A CN 201510076881A CN 104679604 A CN104679604 A CN 104679604A
- Authority
- CN
- China
- Prior art keywords
- node
- host node
- slave node
- slave
- log event
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 230000001360 synchronised effect Effects 0.000 claims abstract description 34
- 238000007667 floating Methods 0.000 claims abstract description 30
- 238000012360 testing method Methods 0.000 claims description 31
- 238000012546 transfer Methods 0.000 claims description 18
- 238000012544 monitoring process Methods 0.000 claims description 11
- 238000002407 reforming Methods 0.000 claims description 8
- 238000012913 prioritisation Methods 0.000 claims description 3
- 238000001514 detection method Methods 0.000 abstract description 9
- 230000002159 abnormal effect Effects 0.000 abstract description 7
- 230000008901 benefit Effects 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 7
- 238000004590 computer program Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000036541 health Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 230000001502 supplementing effect Effects 0.000 description 2
- 241000931705 Cicada Species 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention provides a method and a device for switching amaster node and standby node. The method comprises the following steps that according to a preset master node detection condition, whether the operation of the master node is abnormal or not is judged; if so, the operation switches to the standby node which is used as a new master node, the the original master node is used as a new standby node, and data information and version files of the main node and the spare node are synchronized; if not, the data information and the version files of the main node and the spare node are synchronized. The method and the device provided by the embodiment of the invention have the advantages that the main node and the spare node simultaneously operate and share one floating IP (Internet protocol) address for providing service, the data information and the version files of the main node and the spare node are synchronized, whether the operation of the main node is abnormal or not is judged according to the main node detection condition, if the main node fault occurs, the operation is switched onto the spare node for continuous operation, the service is provided for use, and the reliability and the stability of the node are effectively ensured.
Description
Technical field
The application relates to communication technical field, particularly relates to a kind of method of host node and slave node switching and the device of a kind of host node and slave node switching.
Background technology
Active and standby management is a kind of technology ensureing equipment dependability, it refers to the state of activation (i.e. Active state) being in certain business at an equipment, when another station server is in stand-by state (i.e. the Standby state) of this business, stand-by equipment (i.e. Backup or Slave) to backup process to data.When main equipment (i.e. Master) breaks down, business can be switched to stand-by equipment by system in time, and guarantee business is continual carries out.
Home signature user server (Home Subscriber Server; HSS) as the important component part of communication network; its Main Function stores user data and subscription data; and provide data, services to the network element of initiating request; therefore; the hardware or software failure that any reason causes; as planned shutdown (edition upgrading or periodicmaintenance), sudden shutdown (delay machine or power down); all by directly cause portion of user data or business datum unavailable, thus have influence on the normal use of communication network.
The active and standby Managed Solution of current existing server is mainly by adopting the user realizing main-standby nodes and the business datum real-time synchronization of third party software, and realize the health examination between main-standby nodes by third party software, usual employing transmission control protocol (Transmission Control Protocol, TCP) mode carries out heartbeat detection.Data syn-chronization and health detection is carried out owing to relying on third party software in the active and standby Managed Solution of existing server, and the interface that third party software outwards provides is less, very flexible, secondary development difficulty is comparatively large, cannot the reliability and stability of effective Deterministic service device.
Therefore, the technical matters needing those skilled in the art urgently to solve at present is exactly: the mechanism proposing a kind of host node and slave node switching, solve in prior art and rely on third party software and carry out data syn-chronization and health detection, cannot the technical matters of the effective reliability and stability of Deterministic service device.
Summary of the invention
The embodiment of the present application technical matters to be solved is to provide a kind of method of host node and slave node switching, rely on third party software carry out data syn-chronization and health detection in order to solve in prior art, cannot the technical matters of the effective reliability and stability of Deterministic service device.
Accordingly, the embodiment of the present application additionally provides the device of a kind of host node and slave node switching, in order to ensure the implementation and application of said method.
In order to solve the problem, this application discloses a kind of method of host node and slave node switching, described host node and slave node run simultaneously and share same floating IP address, and described floating IP address associates with host node, and described method comprises:
According to the host node testing conditions preset, judge described host node whether operation exception;
If so, then described slave node is switched to new host node, and former host node is switched to new slave node, and, the data message of described host node and slave node and version file are carried out synchronously;
If not, then the data message of described host node and slave node and version file are carried out synchronously.
Preferably, described host node testing conditions obtains from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf is generated by shell script.
Preferably, the data message of described host node and slave node is carried out synchronous step to comprise:
By the data information transfer of described host node to described slave node;
And/or,
By the data information transfer of described slave node to described host node.
Preferably, described the data information transfer of described host node to the sub-step of described slave node to be comprised further:
Obtain the daily record of the log event in the daily record of described host node to slave node; Described log event comprises the step generating data message;
To reform described log event, obtain the data message that described log event is corresponding.
Preferably, the log event in the daily record of the described host node of described acquisition comprises further to the sub-step of the daily record of slave node:
Whether the daily record of monitoring described host node exists newly-increased log event;
If so, the daily record of described newly-increased log event to slave node is then obtained.
Preferably, the version file of described host node and slave node is carried out synchronous step to comprise:
According to the time interval of presetting, the version file of described host node is transferred to described slave node by safety shell protocol SSH encrypted tunnel.
Preferably, described host node and slave node have priority, described described slave node are switched to new host node, and switch to the step of new slave node to comprise former host node:
Described slave node is sorted according to priority;
Slave node the highest for priority is switched to new host node, sets up associating of described floating IP address and described new host node;
Former host node is switched to new slave node, disconnects associating of described floating IP address and described former host node.
In order to solve the problem, disclosed herein as well is the device of a kind of host node and slave node switching, described host node and slave node run simultaneously and share same floating IP address, and described floating IP address associates with host node, and described device comprises:
Judge module, for according to the host node testing conditions preset, judges described host node whether operation exception; If so, handover module and synchronization module is then called; If not, then invoke synchronous module;
Handover module, for described slave node is switched to new host node, and switches to new slave node by former host node;
Synchronization module, for being undertaken the data message of described host node and slave node and version file synchronously.
Preferably, described host node testing conditions obtains from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf is generated by shell script.
Preferably, described synchronization module comprises:
The synchronous submodule of first data message, for by the data information transfer of described host node to described slave node;
And/or,
The synchronous submodule of second data message, for by the data information transfer of described slave node to described host node.
Preferably, the synchronous submodule of described first data message comprises further:
Log event acquiring unit, for obtaining the daily record of the log event in the daily record of described host node to slave node; Described log event comprises the step generating data message;
Log event is reformed unit, for described log event of reforming, obtains the data message that described log event is corresponding.
Preferably, described log event acquiring unit comprises further:
Monitor subelement, whether there is newly-increased log event for the daily record of monitoring described host node; If so, acquisition subelement is then called;
Obtain subelement, for obtaining the daily record of described newly-increased log event to slave node.
Preferably, described synchronization module comprises:
The synchronous submodule of version file, for transferring to described slave node by the version file of described host node by safety shell protocol SSH encrypted tunnel according to the time interval of presetting.
Preferably, described handover module comprises:
Prioritization submodule, for sorting described slave node according to priority;
Slave node switching submodule, for slave node the highest for priority is switched to new host node, sets up associating of described floating IP address and described new host node;
Host node switching submodule, for former host node is switched to new slave node, disconnects associating of described floating IP address and described former host node.
Compared with prior art, the embodiment of the present application comprises following advantage:
First, the embodiment of the present application is run simultaneously by host node and slave node and shared same floating IP address provides service, the data message of described host node and slave node and version file are carried out synchronously, according to the host node testing conditions preset, judge described host node whether operation exception, once there is host node fault, be just switched on slave node and continue run and provide business to use, effectively ensure the reliability and stability of node.
Second, the embodiment of the present application realizes the health detection of node by third party software keepalived, new configuration file keepalived.cnf can be generated by write shell script, realize arranging the testing conditions of third party software keepalived or revising, thus can carry out supplementing setting to testing conditions according to user's request, make the setting of testing conditions more flexible, thus ensure the reliability and stability of node further.
3rd, the embodiment of the present application is by obtaining log event, and described log event of reforming, obtains the mode of data message corresponding to described log event, realizes the synchronous of data message in active and standby node.Because the data volume of log event is much smaller than the data volume of data message, therefore, the mode of internodal data syn-chronization is realized with respect to the direct data message obtained in node, the data volume of transmission when the data message that the embodiment of the present application can reduce described host node and slave node carries out synchronous, decreases taking of resource.
4th, the embodiment of the present application is by monitoring whether there is newly-increased log event, when there is newly-increased log event, obtain described newly-increased log event, thus achieve the real-time monitoring of data message, real-time is synchronous, makes the data message of active and standby node synchronous more timely, improves the reliability of node.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of a kind of host node of the application and the embodiment of the method 1 of slave node switching;
The schematic diagram of Fig. 2 to be the active-standby mode of third party software keepalived be plunder pattern;
Fig. 3 is the active-standby mode of third party software keepalived is the schematic diagram of parallel model;
Fig. 4 is the flow chart of steps of a kind of host node of the application and the embodiment of the method 2 of slave node switching;
Fig. 5 is the structured flowchart of a kind of host node of the application and the device embodiment of slave node switching.
Embodiment
For enabling above-mentioned purpose, the feature and advantage of the application more become apparent, below in conjunction with the drawings and specific embodiments, the application is described in further detail.
One of core idea of the embodiment of the present application is, run simultaneously by host node and slave node and share same floating IP address and service is provided, the data message of described host node and slave node and version file are carried out synchronously, according to the host node testing conditions preset, judge described host node whether operation exception, once there is host node fault, be just switched on slave node and continue run and provide business to use, effectively ensure the reliability and stability of node.Further, by generating new configuration file keepalived.cnf according to user to the shell script that testing conditions is write, testing conditions can be arranged or revise, thus making the setting of testing conditions more flexible.And, can by obtaining log event, described log event of reforming, obtains the mode of data message corresponding to described log event, realizes the synchronous of data message in active and standby node, reduces the data volume of transmission, reduces resource occupation.
With reference to Fig. 1, show the flow chart of steps of a kind of host node of the application and the embodiment of the method 1 of slave node switching, specifically can comprise the steps:
Step 101, according to the host node testing conditions preset, judges described host node whether operation exception; If so, then step 102 is performed; If not, then step 103 is performed;
In the embodiment of the present application, described host node and slave node can run simultaneously, are namely in hot stand-by duty.Described host node and slave node can share same floating IP address, and described floating IP address can associate with host node.
In specific implementation, can be detected the running status of host node by third party software keepalived.
In actual applications, described host node testing conditions can obtain from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf can be generated by shell script.
It should be noted that, described configuration file keepalived.cnf can refer to and be configured in third party software keepalived, for controlling the file detected node of third party software keepalived.Described shell script can refer to the program utilizing the function of shell to write, for recording the instruction that user writes.The instruction recorded in described shell script can be the instruction for the whether abnormal testing conditions of decision node.
In specific implementation, by writing shell script on configuration file keepalived.cnf, new configuration file keepalived.cnf can be generated, realizes arranging the testing conditions of third party software keepalived or revising.
In actual applications, third party software keepalived according to the testing conditions recorded in configuration file keepalived.cnf, can detect host node.Judge whether described host node meets described testing conditions, if when described host node meets described testing conditions, then judge described host node operation exception; If when described host node does not meet described testing conditions, then judge described host node normal operation.Certainly, third party software keepalived also can adopt transmission control protocol (Transmission Control Protocol, TCP) to carry out heartbeat detection, when detecting that described host node heartbeat is lost, then judges described host node operation exception.
In specific implementation, can trigger whether operation exception judges to described host node according to the time interval of presetting.
It should be noted that, described node can be home signature user server (Home Subscriber Server, HSS).
Step 102, switches to new host node by described slave node, and former host node is switched to new slave node, and, the data message of described host node and slave node and version file are carried out synchronously;
It should be noted that, switch to new host node to refer to described slave node to set up associating of described floating IP address and slave node.Switched to by former host node new slave node to refer to and disconnect associating of described floating IP address and former host node.
In specific implementation, slave node can be realized to switch to new host node by third party software keepalived, former host node is switched to slave node.
In actual applications, the pattern of the active-standby switch of third party software keepalived can comprise plunder pattern and parallel model.
With reference to Fig. 3, the active-standby mode showing keepalived is the schematic diagram of plunder pattern;
In specific implementation, when the active-standby mode of keepalived is plunder pattern, statement state or priority can be preset to all nodes.Described statement state can comprise MASTER and BACKUP.When host node exists abnormal, described slave node is switched to new host node, and former host node is switched to new slave node.When there is abnormal slave node and reverting to normal, if the statement state that slave node is preset is that MASTER or priority ratio host node are high, then described slave node is switched to new host node, former host node is switched to slave node.Thus the upper described slave node of sign can grab the status of host node.
With reference to Fig. 4, the active-standby mode showing keepalived is the schematic diagram of parallel model;
In specific implementation, when the active-standby mode of keepalived is plunder pattern, to all nodes preset statement state or priority all identical, such as: preset statement be BACKUP.Due to statement state that all nodes are preset or priority all identical, when host node exists abnormal, described slave node is switched to new host node, and former host node is switched to new slave node.When there is abnormal slave node and reverting to normal, host node can continue to provide service, thus characterizes the status that upper described slave node initiatively can't grab host node.
In actual applications, when node is home signature user server (Home Subscriber Server, HSS), the pattern of the active-standby switch of third party software keepalived can adopt plunder pattern.
It should be noted that, described data message can refer to the data messages such as record user data in node, business datum.Those skilled in the art can be arranged the content of data message according to actual needs, and the application does not limit this.
Described version file can refer to the file of the system version for recording node.Described system version may be used for function corresponding to certainty annuity.
In specific implementation, the data message of described host node and slave node and version file are carried out synchronously can comprising: the data message of described host node and version file are transferred to described slave node; And/or, the data message of described slave node and version file are transferred to described host node.
Step 103, is undertaken the data message of described host node and slave node and version file synchronously.
In actual applications, when described host node normal operation, the data message of described host node and slave node and version file can be carried out synchronously.
The embodiment of the present application is run simultaneously by host node and slave node and shared same floating IP address provides service, the data message of described host node and slave node and version file are carried out synchronously, according to the host node testing conditions preset, judge described host node whether operation exception, once there is host node fault, just be switched on slave node and continue run and provide business to use, effectively ensure the reliability and stability of node.
And, the embodiment of the present application realizes the health detection of node by third party software keepalived, new configuration file keepalived.cnf can be generated by write shell script, realize arranging the testing conditions of third party software keepalived or revising, thus can carry out supplementing setting to testing conditions according to user's request, make the setting of testing conditions more flexible, thus ensure the reliability and stability of node further.
With reference to Fig. 4, show the flow chart of steps of a kind of host node of the application and the embodiment of the method 2 of slave node switching, specifically can comprise the steps:
Step 201, according to the host node testing conditions preset, judges described host node whether operation exception; If so, then step 202 is performed; If not, then step 203 is performed;
Step 202, switches to new host node by described slave node, and former host node is switched to new slave node, and, the data message of described host node and slave node and version file are carried out synchronously;
Step 203, is undertaken the data message of described host node and slave node and version file synchronously.
In the embodiment of the present application, the data message of described host node and slave node is carried out synchronous step and can comprise following sub-step:
Sub-step A, by the data information transfer of described host node to described slave node; And/or, by the data information transfer of described slave node to described host node.
In specific implementation, described the data information transfer of described host node be may further include following sub-step to described slave node:
Sub-step A1, obtains the daily record of the log event in the daily record of described host node to slave node;
It should be noted that, described log event can comprise the step generating data message.
In actual applications, the log event obtained in the daily record of described host node can be obtain log events whole in the daily record of described host node, also can be the log event of part in the daily record obtaining described host node, as newly-increased logging time, or, the logging time etc. of special time period, those skilled in the art can be arranged this according to actual needs.
In specific implementation, described node can have I/O (input/output, input/output port) thread, can obtain the daily record of the log event in the daily record of described host node to slave node by I/O thread.
In a preferred embodiment of the present application, described sub-step A1 comprises further:
Sub-step A11, whether the daily record of monitoring described host node exists newly-increased log event; If so, then sub-step A12 is performed;
In actual applications, the daily record of described host node can be monitored by the I/O thread of described slave node, judge whether the daily record of described host node exists newly-increased log event.
Sub-step A12, obtains the daily record of described newly-increased log event to slave node.
In specific implementation, when the daily record that the I/O thread of slave node listens to described host node exists newly-increased log event, described newly-increased log event can be obtained, by the daily record of described log event write slave node.
Sub-step A2, described log event of reforming, obtains the data message that described log event is corresponding.
In specific implementation, described node can have SQL (Structured Query Language, Structured Query Language (SQL)) thread, the daily record of described slave node can be monitored by the SQL thread of described slave node, to reform the log event recorded in described slave node, obtain the data message that described log event is corresponding.
In specific implementation, described the data information transfer of described slave node be may further include following sub-step to described host node:
Sub-step A3, obtains the daily record of the log event in the daily record of described slave node to host node;
Sub-step A31, whether the daily record of monitoring described slave node exists newly-increased log event; If so, then sub-step A32 is performed;
Sub-step A32, obtains the daily record of described newly-increased log event to host node.
Sub-step A4, described log event of reforming, obtains the data message that described log event is corresponding.
In the embodiment of the present application, the version file of described host node and slave node is carried out synchronous step and can comprise following sub-step:
Sub-step B, transfers to described slave node by the version file of described host node by safety shell protocol SSH encrypted tunnel according to the time interval of presetting.
In specific implementation, by arranging a timer, can trigger according to the time interval of presetting and the version file of described host node transferred to described slave node.
In realization application, the version file of described host node and slave node is carried out synchronous step and can also comprise following sub-step:
Sub-step B1, transfers to described host node by the version file of described slave node by safety shell protocol SSH encrypted tunnel according to the time interval of presetting.
In a preferred embodiment of the present application, described host node and slave node can have priority, described described slave node are switched to new host node, and switch to the step of new slave node can comprise following sub-step former host node:
Sub-step C1, sorts described slave node according to priority;
In actual applications, one or more slave node can be had.
Sub-step C2, switches to new host node by slave node the highest for priority, sets up associating of described floating IP address and described new host node;
Sub-step C3, switches to new slave node by former host node, disconnects associating of described floating IP address and described former host node.
The embodiment of the present application is by obtaining log event, and described log event of reforming, obtains the mode of data message corresponding to described log event, realizes the synchronous of data message in active and standby node.Because the data volume of log event is much smaller than the data volume of data message, therefore, the mode of internodal data syn-chronization is realized with respect to the direct data message obtained in node, the data volume of transmission when the data message that the embodiment of the present application can reduce described host node and slave node carries out synchronous, decreases taking of resource.
And, the preferred embodiment of the application is by monitoring whether there is newly-increased log event, when there is newly-increased log event, obtain described newly-increased log event, thus achieve the real-time monitoring of data message, real-time is synchronous, makes the data message of active and standby node synchronous more timely, improves the reliability of node.
It should be noted that, for embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the embodiment of the present application is not by the restriction of described sequence of movement, because according to the embodiment of the present application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action might not be that the embodiment of the present application is necessary.
With reference to Fig. 5, show the structured flowchart of the device embodiment of a kind of host node of the application and slave node switching, specifically can comprise as lower module:
Judge module 301, for according to the host node testing conditions preset, judges described host node whether operation exception; If so, handover module and synchronization module is then called; If not, then invoke synchronous module;
In specific implementation, described host node and slave node can run simultaneously and share same floating IP address, and described floating IP address can associate with host node.
In a preferred embodiment of the present application, described host node testing conditions can obtain from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf can be generated by shell script.
Handover module 302, for described slave node is switched to new host node, and switches to new slave node by former host node;
In a preferred embodiment of the present application, described handover module 302 comprises following submodule:
Prioritization submodule 302a, for sorting described slave node according to priority;
Slave node switching submodule 302b, for slave node the highest for priority is switched to new host node, sets up associating of described floating IP address and described new host node;
Host node switching submodule 302c, for former host node is switched to new slave node, disconnects associating of described floating IP address and described former host node.
Synchronization module 303, for being undertaken the data message of described host node and slave node and version file synchronously.
In a preferred embodiment of the present application, described synchronization module 303 comprises following submodule:
The synchronous submodule 303a of first data message, for by the data information transfer of described host node to described slave node;
And/or,
The synchronous submodule 303b of second data message, for by the data information transfer of described slave node to described host node.
In a preferred embodiment of the present application, the synchronous submodule 303a of described first data message comprises further as lower unit:
Log event acquiring unit 303a1, for obtaining the daily record of the log event in the daily record of described host node to slave node; Described log event comprises the step generating data message;
In a preferred embodiment of the present application, described log event acquiring unit 303a1 comprises following subelement further:
Monitor subelement, whether there is newly-increased log event for the daily record of monitoring described host node; If so, acquisition subelement is then called;
Obtain subelement, for obtaining the daily record of described newly-increased log event to slave node.
Log event is reformed unit 303a2, for described log event of reforming, obtains the data message that described log event is corresponding.
In a preferred embodiment of the present application, described synchronization module 303c comprises following submodule:
The synchronous submodule 303c1 of version file, for transferring to described slave node by the version file of described host node by safety shell protocol SSH encrypted tunnel according to the time interval of presetting.
For device embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Those skilled in the art should understand, the embodiment of the embodiment of the present application can be provided as method, device or computer program.Therefore, the embodiment of the present application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the embodiment of the present application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
In one typically configuration, described computer equipment comprises one or more processor (CPU), input/output interface, network interface and internal memory.Internal memory may comprise the volatile memory in computer-readable medium, and the forms such as random access memory (RAM) and/or Nonvolatile memory, as ROM (read-only memory) (ROM) or flash memory (flash RAM).Internal memory is the example of computer-readable medium.Computer-readable medium comprises permanent and impermanency, removable and non-removable media can be stored to realize information by any method or technology.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computing machine comprises, but be not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic RAM (DRAM), the random access memory (RAM) of other types, ROM (read-only memory) (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc ROM (read-only memory) (CD-ROM), digital versatile disc (DVD) or other optical memory, magnetic magnetic tape cassette, tape magnetic rigid disk stores or other magnetic storage apparatus or any other non-transmitting medium, can be used for storing the information can accessed by computing equipment.According to defining herein, computer-readable medium does not comprise the computer readable media (transitory media) of non-standing, as data-signal and the carrier wave of modulation.
The embodiment of the present application describes with reference to according to the process flow diagram of the method for the embodiment of the present application, terminal device (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminal equipment to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing terminal equipment produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing terminal equipment, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded on computing machine or other programmable data processing terminal equipment, make to perform sequence of operations step to produce computer implemented process on computing machine or other programmable terminal equipment, thus the instruction performed on computing machine or other programmable terminal equipment is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although described the preferred embodiment of the embodiment of the present application, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the embodiment of the present application scope.
Finally, also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or terminal device and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or terminal device.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the terminal device comprising described key element and also there is other identical element.
The device that the method that a kind of host node provided the application above and slave node switch and a kind of host node and slave node switch, be described in detail, apply specific case herein to set forth the principle of the application and embodiment, the explanation of above embodiment is just for helping method and the core concept thereof of understanding the application; Meanwhile, for one of ordinary skill in the art, according to the thought of the application, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application.
Claims (14)
1. a method for host node and slave node switching, it is characterized in that, described host node and slave node run simultaneously and share same floating IP address, and described floating IP address associates with host node, and described method comprises:
According to the host node testing conditions preset, judge described host node whether operation exception;
If so, then described slave node is switched to new host node, and former host node is switched to new slave node, and, the data message of described host node and slave node and version file are carried out synchronously;
If not, then the data message of described host node and slave node and version file are carried out synchronously.
2. method according to claim 1, is characterized in that, described host node testing conditions obtains from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf is generated by shell script.
3. method according to claim 1, is characterized in that, the data message of described host node and slave node is carried out synchronous step and comprises:
By the data information transfer of described host node to described slave node;
And/or,
By the data information transfer of described slave node to described host node.
4. method according to claim 3, is characterized in that, describedly the data information transfer of described host node to the sub-step of described slave node is comprised further:
Obtain the daily record of the log event in the daily record of described host node to slave node; Described log event comprises the step generating data message;
To reform described log event, obtain the data message that described log event is corresponding.
5. method according to claim 4, is characterized in that, the log event in the daily record of the described host node of described acquisition comprises further to the sub-step of the daily record of slave node:
Whether the daily record of monitoring described host node exists newly-increased log event;
If so, the daily record of described newly-increased log event to slave node is then obtained.
6. method according to claim 1, is characterized in that, the version file of described host node and slave node is carried out synchronous step and comprises:
According to the time interval of presetting, the version file of described host node is transferred to described slave node by safety shell protocol SSH encrypted tunnel.
7. method according to claim 1, is characterized in that, described host node and slave node have priority, described described slave node is switched to new host node, and switches to the step of new slave node to comprise former host node:
Described slave node is sorted according to priority;
Slave node the highest for priority is switched to new host node, sets up associating of described floating IP address and described new host node;
Former host node is switched to new slave node, disconnects associating of described floating IP address and described former host node.
8. a device for host node and slave node switching, it is characterized in that, described host node and slave node run simultaneously and share same floating IP address, and described floating IP address associates with host node, and described device comprises:
Judge module, for according to the host node testing conditions preset, judges described host node whether operation exception; If so, handover module and synchronization module is then called; If not, then invoke synchronous module;
Handover module, for described slave node is switched to new host node, and switches to new slave node by former host node;
Synchronization module, for being undertaken the data message of described host node and slave node and version file synchronously.
9. device according to claim 8, is characterized in that, described host node testing conditions obtains from the configuration file keepalived.cnf preset, and described configuration file keepalived.cnf is generated by shell script.
10. device according to claim 8, is characterized in that, described synchronization module comprises:
The synchronous submodule of first data message, for by the data information transfer of described host node to described slave node;
And/or,
The synchronous submodule of second data message, for by the data information transfer of described slave node to described host node.
11. devices according to claim 10, is characterized in that, the synchronous submodule of described first data message comprises further:
Log event acquiring unit, for obtaining the daily record of the log event in the daily record of described host node to slave node; Described log event comprises the step generating data message;
Log event is reformed unit, for described log event of reforming, obtains the data message that described log event is corresponding.
12. devices according to claim 11, is characterized in that, described log event acquiring unit comprises further:
Monitor subelement, whether there is newly-increased log event for the daily record of monitoring described host node; If so, acquisition subelement is then called;
Obtain subelement, for obtaining the daily record of described newly-increased log event to slave node.
13. devices according to claim 8, is characterized in that, described synchronization module comprises:
The synchronous submodule of version file, for transferring to described slave node by the version file of described host node by safety shell protocol SSH encrypted tunnel according to the time interval of presetting.
14. devices according to claim 8, is characterized in that, described handover module comprises:
Prioritization submodule, for sorting described slave node according to priority;
Slave node switching submodule, for slave node the highest for priority is switched to new host node, sets up associating of described floating IP address and described new host node;
Host node switching submodule, for former host node is switched to new slave node, disconnects associating of described floating IP address and described former host node.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510076881.XA CN104679604A (en) | 2015-02-12 | 2015-02-12 | Method and device for switching between master node and standby node |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510076881.XA CN104679604A (en) | 2015-02-12 | 2015-02-12 | Method and device for switching between master node and standby node |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104679604A true CN104679604A (en) | 2015-06-03 |
Family
ID=53314694
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510076881.XA Pending CN104679604A (en) | 2015-02-12 | 2015-02-12 | Method and device for switching between master node and standby node |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104679604A (en) |
Cited By (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105338078A (en) * | 2015-10-26 | 2016-02-17 | 北京百度网讯科技有限公司 | Data storage method and device used for storing system |
CN105389213A (en) * | 2015-10-26 | 2016-03-09 | 珠海格力电器股份有限公司 | Data center system and configuration method thereof |
CN106254100A (en) * | 2016-07-27 | 2016-12-21 | 腾讯科技(深圳)有限公司 | A kind of data disaster tolerance methods, devices and systems |
CN106331098A (en) * | 2016-08-23 | 2017-01-11 | 东方网力科技股份有限公司 | A server cluster system |
CN106557543A (en) * | 2016-10-14 | 2017-04-05 | 深圳前海微众银行股份有限公司 | Node switching method and system |
CN107204934A (en) * | 2017-06-14 | 2017-09-26 | 北京凤凰理理它信息技术有限公司 | Automatic switchover method of flow, device, storage medium and electronic equipment |
CN107391320A (en) * | 2017-03-10 | 2017-11-24 | 阿里巴巴集团控股有限公司 | One kind common recognition method and device |
CN107590032A (en) * | 2017-09-06 | 2018-01-16 | 郑州云海信息技术有限公司 | The method and storage cluster system of storage cluster failure transfer |
CN107818027A (en) * | 2017-10-17 | 2018-03-20 | 北京京东尚科信息技术有限公司 | The method, apparatus and distributed system of namenode active-standby switch |
CN108769961A (en) * | 2018-04-28 | 2018-11-06 | 上海与德科技有限公司 | Host node switching method, child node, blueteeth network based on blueteeth network |
CN109104333A (en) * | 2018-08-21 | 2018-12-28 | 杭州安恒信息技术股份有限公司 | The synchronous method and device of distributed type assemblies based on GIT |
CN109542627A (en) * | 2018-11-30 | 2019-03-29 | 北京金山云网络技术有限公司 | Node switching method, device, supervisor, node device and distributed system |
CN109753387A (en) * | 2018-01-24 | 2019-05-14 | 比亚迪股份有限公司 | The double hot standby method and system of rail traffic multimedia system |
CN110417599A (en) * | 2019-08-01 | 2019-11-05 | 青岛聚看云科技有限公司 | The switching method and node server of main-standby nodes |
CN110417600A (en) * | 2019-08-02 | 2019-11-05 | 秒针信息技术有限公司 | Node switching method, device and the computer storage medium of distributed system |
CN111209265A (en) * | 2018-11-22 | 2020-05-29 | 华为技术有限公司 | Database switching method and terminal equipment |
CN112437119A (en) * | 2020-11-05 | 2021-03-02 | 新华三大数据技术有限公司 | Distributed system upgrading method, device and node |
CN112988335A (en) * | 2021-05-13 | 2021-06-18 | 深圳市安软科技股份有限公司 | High-availability virtualization management system, method and related equipment |
CN113515574A (en) * | 2021-05-17 | 2021-10-19 | 聚好看科技股份有限公司 | Data synchronization method and device |
CN113900858A (en) * | 2021-10-09 | 2022-01-07 | 深信服科技股份有限公司 | Database fault processing method, system and device and readable storage medium |
CN114513402A (en) * | 2020-10-23 | 2022-05-17 | 大唐移动通信设备有限公司 | High availability implementation method and device of network equipment and storage medium |
CN115242615A (en) * | 2022-06-29 | 2022-10-25 | 北京聚通达科技股份有限公司 | Server operation management method and device, electronic equipment and storage medium |
CN117149905A (en) * | 2023-08-16 | 2023-12-01 | 上海沄熹科技有限公司 | Time sequence data copying method and device |
CN117785568A (en) * | 2024-02-27 | 2024-03-29 | 广东保伦电子股份有限公司 | Dual-master dual-machine hot standby method and device |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1366242A (en) * | 2001-01-19 | 2002-08-28 | 华为技术有限公司 | Method for implementing dual-system standby |
CN1607772A (en) * | 2003-10-14 | 2005-04-20 | 华为技术有限公司 | Method for realizing data transfer backup through address interpretation protocol messages |
US20050237926A1 (en) * | 2004-04-22 | 2005-10-27 | Fan-Tieng Cheng | Method for providing fault-tolerant application cluster service |
CN101150439A (en) * | 2007-09-25 | 2008-03-26 | 华为技术有限公司 | A method, system and device for realizing active/standby switching |
CN101526950A (en) * | 2009-04-09 | 2009-09-09 | 酷派软件技术(深圳)有限公司 | Method and system of automatic synchronization of data and terminal |
CN101876924A (en) * | 2009-04-30 | 2010-11-03 | 升东网络科技发展(上海)有限公司 | Database fault automatic detection and transfer method |
CN102663017A (en) * | 2012-03-21 | 2012-09-12 | 互动在线(北京)科技有限公司 | Implementation system and implementation method for enhancing availability of MySQL database |
CN102810111A (en) * | 2012-05-07 | 2012-12-05 | 互动在线(北京)科技有限公司 | Implementation method and system for keeping high availability of Oracle database service |
CN102855163A (en) * | 2011-06-27 | 2013-01-02 | 华为软件技术有限公司 | Memory database hot-standby method and host |
-
2015
- 2015-02-12 CN CN201510076881.XA patent/CN104679604A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1366242A (en) * | 2001-01-19 | 2002-08-28 | 华为技术有限公司 | Method for implementing dual-system standby |
CN1607772A (en) * | 2003-10-14 | 2005-04-20 | 华为技术有限公司 | Method for realizing data transfer backup through address interpretation protocol messages |
US20050237926A1 (en) * | 2004-04-22 | 2005-10-27 | Fan-Tieng Cheng | Method for providing fault-tolerant application cluster service |
CN101150439A (en) * | 2007-09-25 | 2008-03-26 | 华为技术有限公司 | A method, system and device for realizing active/standby switching |
CN101526950A (en) * | 2009-04-09 | 2009-09-09 | 酷派软件技术(深圳)有限公司 | Method and system of automatic synchronization of data and terminal |
CN101876924A (en) * | 2009-04-30 | 2010-11-03 | 升东网络科技发展(上海)有限公司 | Database fault automatic detection and transfer method |
CN102855163A (en) * | 2011-06-27 | 2013-01-02 | 华为软件技术有限公司 | Memory database hot-standby method and host |
CN102663017A (en) * | 2012-03-21 | 2012-09-12 | 互动在线(北京)科技有限公司 | Implementation system and implementation method for enhancing availability of MySQL database |
CN102810111A (en) * | 2012-05-07 | 2012-12-05 | 互动在线(北京)科技有限公司 | Implementation method and system for keeping high availability of Oracle database service |
Cited By (43)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105338078A (en) * | 2015-10-26 | 2016-02-17 | 北京百度网讯科技有限公司 | Data storage method and device used for storing system |
CN105389213A (en) * | 2015-10-26 | 2016-03-09 | 珠海格力电器股份有限公司 | Data center system and configuration method thereof |
CN105338078B (en) * | 2015-10-26 | 2019-01-01 | 北京百度网讯科技有限公司 | Date storage method and device for storage system |
US10713135B2 (en) | 2016-07-27 | 2020-07-14 | Tencent Technology (Shenzhen) Company Limited | Data disaster recovery method, device and system |
WO2018019023A1 (en) * | 2016-07-27 | 2018-02-01 | 腾讯科技(深圳)有限公司 | Data disaster recovery method, apparatus and system |
EP3493471A4 (en) * | 2016-07-27 | 2019-06-05 | Tencent Technology (Shenzhen) Company Limited | SYSTEM, APPARATUS AND METHOD FOR RECOVERING DATA AFTER LOSS |
CN106254100A (en) * | 2016-07-27 | 2016-12-21 | 腾讯科技(深圳)有限公司 | A kind of data disaster tolerance methods, devices and systems |
CN106254100B (en) * | 2016-07-27 | 2019-04-16 | 腾讯科技(深圳)有限公司 | A kind of data disaster tolerance methods, devices and systems |
WO2018036148A1 (en) * | 2016-08-23 | 2018-03-01 | 东方网力科技股份有限公司 | Server cluster system |
CN106331098B (en) * | 2016-08-23 | 2020-01-21 | 东方网力科技股份有限公司 | Server cluster system |
CN106331098A (en) * | 2016-08-23 | 2017-01-11 | 东方网力科技股份有限公司 | A server cluster system |
CN106557543A (en) * | 2016-10-14 | 2017-04-05 | 深圳前海微众银行股份有限公司 | Node switching method and system |
US10684925B2 (en) | 2017-03-10 | 2020-06-16 | Alibaba Group Holding Limited | Method for view switching in a blockchain network |
CN107391320A (en) * | 2017-03-10 | 2017-11-24 | 阿里巴巴集团控股有限公司 | One kind common recognition method and device |
CN107391320B (en) * | 2017-03-10 | 2020-07-10 | 创新先进技术有限公司 | Consensus method and device |
CN107204934A (en) * | 2017-06-14 | 2017-09-26 | 北京凤凰理理它信息技术有限公司 | Automatic switchover method of flow, device, storage medium and electronic equipment |
CN107590032A (en) * | 2017-09-06 | 2018-01-16 | 郑州云海信息技术有限公司 | The method and storage cluster system of storage cluster failure transfer |
CN107818027B (en) * | 2017-10-17 | 2021-07-30 | 北京京东尚科信息技术有限公司 | Method and device for switching main name node and standby name node and distributed system |
CN107818027A (en) * | 2017-10-17 | 2018-03-20 | 北京京东尚科信息技术有限公司 | The method, apparatus and distributed system of namenode active-standby switch |
CN109753387B (en) * | 2018-01-24 | 2019-12-20 | 比亚迪股份有限公司 | Dual-computer hot standby method and system of rail transit multimedia system |
CN109753387A (en) * | 2018-01-24 | 2019-05-14 | 比亚迪股份有限公司 | The double hot standby method and system of rail traffic multimedia system |
CN108769961A (en) * | 2018-04-28 | 2018-11-06 | 上海与德科技有限公司 | Host node switching method, child node, blueteeth network based on blueteeth network |
CN109104333A (en) * | 2018-08-21 | 2018-12-28 | 杭州安恒信息技术股份有限公司 | The synchronous method and device of distributed type assemblies based on GIT |
CN109104333B (en) * | 2018-08-21 | 2020-09-04 | 杭州安恒信息技术股份有限公司 | Synchronization method and device for distributed cluster based on GIT |
CN111209265A (en) * | 2018-11-22 | 2020-05-29 | 华为技术有限公司 | Database switching method and terminal equipment |
CN111209265B (en) * | 2018-11-22 | 2023-11-17 | 华为技术有限公司 | Database switching method and terminal equipment |
CN109542627A (en) * | 2018-11-30 | 2019-03-29 | 北京金山云网络技术有限公司 | Node switching method, device, supervisor, node device and distributed system |
CN110417599A (en) * | 2019-08-01 | 2019-11-05 | 青岛聚看云科技有限公司 | The switching method and node server of main-standby nodes |
CN110417599B (en) * | 2019-08-01 | 2022-07-05 | 青岛聚看云科技有限公司 | Main/standby node switching method and node server |
CN110417600A (en) * | 2019-08-02 | 2019-11-05 | 秒针信息技术有限公司 | Node switching method, device and the computer storage medium of distributed system |
CN110417600B (en) * | 2019-08-02 | 2022-10-25 | 秒针信息技术有限公司 | Node switching method and device of distributed system and computer storage medium |
CN114513402B (en) * | 2020-10-23 | 2023-11-10 | 大唐移动通信设备有限公司 | High availability implementation method, device and storage medium of network equipment |
CN114513402A (en) * | 2020-10-23 | 2022-05-17 | 大唐移动通信设备有限公司 | High availability implementation method and device of network equipment and storage medium |
CN112437119B (en) * | 2020-11-05 | 2022-03-22 | 新华三大数据技术有限公司 | Distributed system upgrading method, device and node |
CN112437119A (en) * | 2020-11-05 | 2021-03-02 | 新华三大数据技术有限公司 | Distributed system upgrading method, device and node |
CN112988335A (en) * | 2021-05-13 | 2021-06-18 | 深圳市安软科技股份有限公司 | High-availability virtualization management system, method and related equipment |
CN113515574A (en) * | 2021-05-17 | 2021-10-19 | 聚好看科技股份有限公司 | Data synchronization method and device |
CN113900858A (en) * | 2021-10-09 | 2022-01-07 | 深信服科技股份有限公司 | Database fault processing method, system and device and readable storage medium |
CN115242615B (en) * | 2022-06-29 | 2023-04-14 | 北京聚通达科技股份有限公司 | Server operation management method, device, electronic device and storage medium |
CN115242615A (en) * | 2022-06-29 | 2022-10-25 | 北京聚通达科技股份有限公司 | Server operation management method and device, electronic equipment and storage medium |
CN117149905A (en) * | 2023-08-16 | 2023-12-01 | 上海沄熹科技有限公司 | Time sequence data copying method and device |
CN117149905B (en) * | 2023-08-16 | 2024-05-24 | 上海沄熹科技有限公司 | Time sequence data copying method and device |
CN117785568A (en) * | 2024-02-27 | 2024-03-29 | 广东保伦电子股份有限公司 | Dual-master dual-machine hot standby method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104679604A (en) | Method and device for switching between master node and standby node | |
US11907561B2 (en) | Data backup method and apparatus | |
CN111865632B (en) | Switching method of distributed data storage cluster and switching instruction sending method and device | |
CN106933843B (en) | Database heartbeat detection method and device | |
WO2016183967A1 (en) | Failure alarm method and apparatus for key component, and big data management system | |
WO2018054079A1 (en) | Method for storing file, first virtual machine and namenode | |
CN106874142B (en) | Real-time data fault-tolerant processing method and system | |
CN104239156A (en) | External service call method and system | |
CN107729515B (en) | Data synchronization method, device and storage medium | |
US20250103450A1 (en) | Database disaster recovery system, method, and apparatus, storage medium, and electronic device | |
CN112256477A (en) | Virtualization fault-tolerant method and device | |
CN117874141A (en) | Management method, system and storage medium for data in cloud primary environment | |
CN107239235B (en) | A multi-control multi-active RAID synchronization method and system | |
CN116302352A (en) | Cluster disaster recovery processing method and device, electronic equipment and storage medium | |
US20250110926A1 (en) | Establishing method of remote replication relationship and related apparatus | |
CN112000735A (en) | A data processing method, device and system | |
CN108647112A (en) | The method, apparatus and distributing real time system system of data backup | |
CN110018986B (en) | Abnormal snapshot identification method and device | |
CN106055397A (en) | Control method and apparatus of lock | |
CN107528703B (en) | Method and equipment for managing node equipment in distributed system | |
CN116743550B (en) | Processing method of fault storage nodes of distributed storage cluster | |
CN111488247B (en) | High availability method and equipment for managing and controlling multiple fault tolerance of nodes | |
CN107342905A (en) | A kind of node scheduling method and system of cluster storage system failure transfer | |
CN115237674A (en) | Data backup method, device and medium for SDN controller based on opennaylight | |
CN118796566B (en) | Distributed service system, instance splitting method, device, medium and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20150603 |