[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN104765653A - Method for achieving database HA application through keepalived software - Google Patents

Method for achieving database HA application through keepalived software Download PDF

Info

Publication number
CN104765653A
CN104765653A CN201510083556.6A CN201510083556A CN104765653A CN 104765653 A CN104765653 A CN 104765653A CN 201510083556 A CN201510083556 A CN 201510083556A CN 104765653 A CN104765653 A CN 104765653A
Authority
CN
China
Prior art keywords
database
track
master
backup
keepalived
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
Application number
CN201510083556.6A
Other languages
Chinese (zh)
Inventor
周正中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HANGZHOU NO IMAGE TECHNOLOGY Co Ltd
Original Assignee
HANGZHOU NO IMAGE TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by HANGZHOU NO IMAGE TECHNOLOGY Co Ltd filed Critical HANGZHOU NO IMAGE TECHNOLOGY Co Ltd
Priority to CN201510083556.6A priority Critical patent/CN104765653A/en
Publication of CN104765653A publication Critical patent/CN104765653A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a method for achieving database HA application through keepalived software. The method is characterized by comprising the steps of switching a node to master state; synchronously calling a notify_* script, wherein * is one of master and backup; waiting until the notify_* scrip is called and the returning result is normal; triggering a track script track_script. According to the method, the node enters the master state, the notify is synchronously called, and therefore, the problem of frequently switching the keepalived software in a database HA architecture. According to the method, soft link is set, so that different track scrips can be used under different states.

Description

A kind of method using keepalived software simulating database HA to apply
Technical field
The present invention relates to a kind of fulfillment database HA(High Availabitity) method applied, especially a kind of method using keepalived software simulating database HA to apply.
Background technology
Keepalived software is generally used for the state detecting Web server, break down if having a web server to crash or work, to be detected by keepalived, and out of order web server is rejected from system, after web server is working properly, web server will join in server zone by keepalived automatically, and these work above-mentioned all complete automatically, and what need people to get involved participation is only the web server of repairing fault.
In addition, keepalived is also usually used to realize the application load balancing based on linux system and High Availabitity (HA), when keepalived service starts, logical diagram as shown in Figure 1 is generally followed in the selection of host role (comprising master, backup, fault).
When design database HA, very important point guarantees not occur the situation of fissure (fissure refers to that irreversible variance data has appearred in master library and standby storehouse).In order to prevent fissure, database, when carrying out active-standby switch, must guarantee that data can not be revised by multiple host, or must guarantee that failded host node could activate slave node after shutting down completely, for this reason, adds notify and fence mechanism.Specifically, after a node enters master state, its opposite end server of notify and fence can be triggered, activation data storehouse, but, likely appear at above-mentioned action and also do not complete the situation that front track script is just triggered, if trigger track script before notify action completes, failed state can be caused to occur, and then the node host entering master state is become fault state.As can be drawn from Figure 1, after former master state node enters fault state, other backup state node then can start to campaign for master qualification, and election contest will trigger new one and takes turns notify, so, if all appear at the situation that track script before notify completes triggers when to trigger notify subsequently at every turn, endless goes on by system, and this time switching cannot be completed, if repeatedly there is above-mentioned situation, also must cause the increase of systematic evaluation time cost, efficiency reduces.That is, when using Keepalived to build the HA of database, host role at notify_*(*) and before notify script calls end, if track(checks) there occurs, track result so may be caused to be abnormal, and then triggering master role is transformed into backup again, and current role's upset will trigger again and call notify_backup, notify script, so move in circles (above-mentioned accident occurs again), be then absorbed in the endless loop that forever cannot complete switching.
Summary of the invention
For overcoming the technical matters existed in prior art, the present invention proposes a kind of method using keepalived software simulating database HA to apply.
For achieving the above object, the technical solution adopted in the present invention is:
The method using keepalived software simulating database HA to apply, is characterized in that, comprise the steps:
After node state switches to master, synchronization call notify_* script, * is one in both master, backup; Waiting n otify_* script calls and terminates and return results as normally; Trigger and follow the tracks of script track_script.
Technique scheme can also be perfect further:
As preferably, described notify_mater performs the peer node that following steps: fence switches to master state node; Activate standby database; Track_master.sh file is pointed in soft for track_scrip.sh file link.
As preferably, described track_master.sh locally to monitor for checking, at least one checked in the read-write of this spatial surface.
As preferably, described notify_backup performs following steps: close database; Track_backup.sh file is pointed in soft for track_scrip.sh file link; Start database.
As preferably, track_backup.sh for checking that VIP monitors, check and locally to monitor, check the reading of this spatial surface, check that stream copies, at least one checked in replica delay.
As preferably, use the method for keepalived software simulating database HA application also to comprise the steps: configuration database stream copying surroundings, backup database obtains Xlog information and real-time recovery from master data base in real time; Enable keepalived host node (master), slave node (backup).
Due to the employing of technique scheme, the present invention has the following advantages:
The present invention, by entering synchronization call notify after master state at node, avoids keepalived software and run into the problem ceaselessly switched in database HA framework.In addition, the present invention, by arranging soft link, uses different track scripts under achieving different states.
Accompanying drawing explanation
When Fig. 1 is keepalived service startup, the selection logical diagram of each host role;
Fig. 2 is a kind of database trace script logic figure.
Embodiment
Below by embodiment also by reference to the accompanying drawings, explanation is further explained to technical scheme of the present invention.
Keepalived generally comprises 3 assemblies, is core component respectively, monitor check assembly and VRRP assembly, wherein:
1, core component is for resolving configuration file, FORK monitoring and VRRP subprocess, and the state of monitoring subprocess also restarts subprocess when being necessary.
2, the state monitoring load balancing main frame is responsible for by monitor check assembly.
3, VRRP Protocol Design followed by VRRP assembly, and for detecting Host Status, Interface status, be responsible for the conversion of host role, host role comprises MA STER, BACKUP, FAULT tri-kinds.
Before configuration keepalived, need to carry out systems organization to database HA environment, as configuration at least 2 main frames, the IP corresponding with host number, and (follow role transforming to drift about, which platform physical host master just floats at which platform main frame, therefore for drift to arrange at least one virtual IP address in addition, application program only needs to be linked to virtual IP address, and without the need to paying close attention to master storehouse on which physical host).During configuration keepalived, each host ip is added clean culture peer, to determine that keepalived sends and receives the scope of vrrp bag.
Below introduce a kind of embodiment, application the present embodiment, keepalived can be made for building database HA, and be applied in most database HA framework, as the HA copied based on stream, the HA, the HA based on shared storage, the HA based on distributed storage that copy based on block device.
The method using keepalived software simulating database HA to apply, comprises the steps:
(1) after node state switches to master, synchronization call notify_* script, * is one in both master, backup;
(2) waiting n otify_* script calls and terminates and return results as normally;
(3) tracking script track_script is triggered;
(4) configuration database stream copying surroundings, backup database uses stream replication protocol, obtains Xlog information and real-time recovery in real time from master data base;
(5) keepalived host node (master), slave node (backup) is enabled.
In a kind of embodiment, by the baseline using host node, slave node common, occur to avoid fissure.
In above-mentioned steps (1), as called notify_mater, then notify_mater performs the peer node that following steps: fence switches to master state node; Activate standby database; Track_master.sh file is pointed in soft for track_scrip.sh file link.
Figure 2 shows that a kind of inspection example of following the tracks of script track_master.sh, track_master.sh is for checking the local read-write of monitoring, checking this spatial surface, in one embodiment, returning check result is that 0 expression is normal, returns results non-zero expression abnormal.In more embodiment, inspection item order is not limited to shown in Fig. 2.
In above-mentioned steps (1), as called notify_backup, then notify_backup performs following steps: close database; Make recovery.done into recovery.conf; By pg_xlog rename, and a newly-built pg_xlog, to its give 700 authorities (file user can reading and writing, operation, any operation can not be performed with group user and other users); Track_backup.sh file is pointed in soft for track_scrip.sh file link; Start database.
Figure 2 shows that a kind of inspection example of following the tracks of script track_backup.sh, track_backup.sh for checking that VIP monitors, check and local to monitor, check the reading of this spatial surface, check that stream copies, check replica delay, in one embodiment, returning check result is that 0 expression is normal, returns results non-zero expression abnormal.In more embodiment, inspection item order is not limited to shown in Fig. 2.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention 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.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (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 device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device 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 device, 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 in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices 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 describe the preferred embodiments of the present invention, 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 scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from this
Bright spirit and scope.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (6)

1. the method using keepalived software simulating database HA to apply, is characterized in that, comprise the steps:
After node state switches to master, synchronization call notify_* script, * is one in both master, backup;
Waiting n otify_* script calls and terminates and return results as normally;
Trigger and follow the tracks of script track_script.
2. a kind of method using keepalived software simulating database HA to apply according to claim 1, is characterized in that, described notify_mater performs following steps:
Fence switches to the peer node of master state node;
Activate standby database;
Track_master.sh file is pointed in soft for track_scrip.sh file link.
3. a kind of method using keepalived software simulating database HA to apply according to claim 2, is characterized in that, described track_master.sh is for checking local monitoring, at least one checked in the read-write of this spatial surface.
4. a kind of method using keepalived software simulating database HA to apply according to claim 1, is characterized in that, described notify_backup performs following steps:
Close database;
Track_backup.sh file is pointed in soft for track_scrip.sh file link;
Start database.
5. a kind of method using keepalived software simulating database HA to apply according to claim 4, it is characterized in that, track_backup.sh for checking that VIP monitors, check and local to monitor, check the reading of this spatial surface, check that stream copies, at least one checked in replica delay.
6., according to a kind of method using keepalived software simulating database HA to apply in claim 1-5 described in any, it is characterized in that, also comprise the steps:
Configuration database stream copying surroundings, backup database obtains Xlog information and real-time recovery from master data base in real time;
Enable keepalived host node (master), slave node (backup).
CN201510083556.6A 2015-02-15 2015-02-15 Method for achieving database HA application through keepalived software Pending CN104765653A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510083556.6A CN104765653A (en) 2015-02-15 2015-02-15 Method for achieving database HA application through keepalived software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510083556.6A CN104765653A (en) 2015-02-15 2015-02-15 Method for achieving database HA application through keepalived software

Publications (1)

Publication Number Publication Date
CN104765653A true CN104765653A (en) 2015-07-08

Family

ID=53647498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510083556.6A Pending CN104765653A (en) 2015-02-15 2015-02-15 Method for achieving database HA application through keepalived software

Country Status (1)

Country Link
CN (1) CN104765653A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893176A (en) * 2016-03-28 2016-08-24 杭州宏杉科技有限公司 Management method and device of network storage system
CN109313579A (en) * 2016-06-20 2019-02-05 微软技术许可有限责任公司 The low load balancing distributed again
CN109873759A (en) * 2017-12-01 2019-06-11 北京京穗蓝盾信息安全技术有限公司 It is a kind of based on the intelligent double-machine standby technology for singly leading equipment
CN113746951A (en) * 2021-09-10 2021-12-03 成都高新愿景数字科技有限公司 Method for preventing keepalive virtual IP from being lost

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264381A1 (en) * 2003-06-26 2004-12-30 International Business Machines Corporation Method and apparatus for managing keepalive transmissions
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264381A1 (en) * 2003-06-26 2004-12-30 International Business Machines Corporation Method and apparatus for managing keepalive transmissions
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

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
FREELODA: "Linux高可用(HA)集群之Keepalived详解", 《LINUX公社 HTTP://WWW.LINUXIDC.COM/LINUX/2013-08/89227P6.HTM》 *
南非蚂蚁: "Keepalived中Master和Backup角色选举策略", 《51CTO博客 HTTP://IXDBA.BLOG.51CTO.COM/2895551/1544858/》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893176A (en) * 2016-03-28 2016-08-24 杭州宏杉科技有限公司 Management method and device of network storage system
CN105893176B (en) * 2016-03-28 2019-02-26 杭州宏杉科技股份有限公司 A kind of management method and device of network store system
CN109313579A (en) * 2016-06-20 2019-02-05 微软技术许可有限责任公司 The low load balancing distributed again
CN109313579B (en) * 2016-06-20 2021-11-19 微软技术许可有限责任公司 Load balancing with low redistribution
CN109873759A (en) * 2017-12-01 2019-06-11 北京京穗蓝盾信息安全技术有限公司 It is a kind of based on the intelligent double-machine standby technology for singly leading equipment
CN113746951A (en) * 2021-09-10 2021-12-03 成都高新愿景数字科技有限公司 Method for preventing keepalive virtual IP from being lost
CN113746951B (en) * 2021-09-10 2023-07-11 成都高新愿景数字科技有限公司 Method for preventing keep virtual IP from losing

Similar Documents

Publication Publication Date Title
US11243848B2 (en) Managing remote data replication
US9727429B1 (en) Method and system for immediate recovery of replicated virtual machines
EP3750066B1 (en) Protection of infrastructure-as-a-service workloads in public cloud
CN106528327B (en) A kind of data processing method and backup server
CN107885622B (en) Handling Virtual Data Mover (VDM) failover conditions
US20180276078A1 (en) Reversal of the direction of replication in a remote copy environment by tracking changes associated with a plurality of point in time copies
CN103136070B (en) A kind of method and apparatus of data disaster tolerance process
KR20110044858A (en) Maintain data indetermination in data servers across data centers
CN104391764A (en) Computer fault-tolerant method and computer fault-tolerant system
WO2016045439A1 (en) Vnfm disaster-tolerant protection method and device, nfvo and storage medium
CN109189860A (en) A kind of active and standby increment synchronization method of MySQL based on Kubernetes system
CN104765653A (en) Method for achieving database HA application through keepalived software
CN104794028A (en) Disaster tolerance processing method and device, main data center and backup data center
US10705754B2 (en) Zero-data loss recovery for active-active sites configurations
Saridakis A System of Patterns for Fault Tolerance.
CN105069160A (en) Autonomous controllable database based high-availability method and architecture
US20130013566A1 (en) Storage group synchronization in data replication environments
CN104615511A (en) Host batch recovery processing method and device based on double centers
Allspaw Fault injection in production
CN109032763A (en) A kind of virtual machine migration method and virtual machine manager
CN104516796A (en) Command set based network element backup and recovery method and device
CN105389231A (en) Database dual-computer backup method and system
CN102457400B (en) Method for preventing split brain phenomenon from occurring on distributed replicated block device (DRBD) resource
CN102521086B (en) Dual-mode redundant system based on lock step synchronization and implement method thereof
US20150317226A1 (en) Detecting data loss during site switchover

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150708

RJ01 Rejection of invention patent application after publication