CN104516966A - High-availability solving method and device of database cluster - Google Patents

High-availability solving method and device of database cluster Download PDF

Info

Publication number
CN104516966A
CN104516966A CN201410818093.9A CN201410818093A CN104516966A CN 104516966 A CN104516966 A CN 104516966A CN 201410818093 A CN201410818093 A CN 201410818093A CN 104516966 A CN104516966 A CN 104516966A
Authority
CN
China
Prior art keywords
database
master data
data base
base
new master
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
CN201410818093.9A
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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410818093.9A priority Critical patent/CN104516966A/en
Publication of CN104516966A publication Critical patent/CN104516966A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a high-availability solving method and device of a database cluster and belongs to the field of computers. The method comprises the following steps: when a main database of the database cluster cannot provide services, obtaining a list of all sub-databases in the database cluster; screening one sub-database in all the sub-databases recorded by the list as a new main database; switching the main database of the database cluster to the new main database; and automatically selecting one sub-database and switching the sub-database into the new main database when the main database of the database cluster cannot provide services due to reasons including failures and the like, guaranteeing complete data and recovering the services in extremely short time.

Description

A kind of High Availabitity solution of data-base cluster and device
Technical field
The present invention relates to computer realm, be specifically related to a kind of High Availabitity solution and device of data-base cluster.
Background technology
At present, the application of relevant database widely, such as Mysql database.At present, the framework adopting one master and multiple slaves in relevant database cluster more.As shown in Figure 1, be the configuration diagram of a mysql data-base cluster, it comprises: master data base master and three from database, three are respectively from database:
Slave-1, Slave-2 and Slave3.
Such as shown in Fig. 1, Slave-1 and Slave-2 is positioned at machine room 1, Slave3 and is positioned at machine room 2.Master data base master is connected respectively with from database Slave-1, Slave-2 and Slave3.
In reality in the use of mysql database, master data base master is the machine because a variety of causes is delayed likely, the such as system failure, hardware fault etc., master data base master is all likely caused to delay machine, thus cause whole mysql data-base cluster to use, and in prior art, there are not the effective technology means addressed this problem.
Summary of the invention
In view of the above problems, the present invention is proposed to provide a kind of overcoming the problems referred to above or a kind of High Availabitity solution of data-base cluster solved the problem at least in part and correspondingly device.
According to one aspect of the present invention, provide a kind of High Availabitity solution of data-base cluster, described data-base cluster adopts primary and secondary structure, and described method comprises:
When the master data base of described data-base cluster cannot provide service, obtain all lists from database of described data-base cluster;
According to pre-conditioned, described all from database in described list records, screening obtains one from database using as new master data base; And
The master data base of described data-base cluster is switched to described new master data base.
Alternatively, all IP addresses corresponding from database are recorded in described list.
Alternatively, according to pre-conditioned, described all from database in described list records, screening obtains one from database to comprise further as the step of new master data base:
Described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.
Alternatively, described all from database in described list records, select to possess vitality from database to comprise further as the step of new master data base:
Selection mode be designated alive state from database using as new master data base; And/or
Select deferred transaction quantity be less than predetermined number from database using as new master data base.
Alternatively, selection mode be designated alive state from database to comprise further as the step of new master data base:
By performing ping operation to described from database, obtain the described time delay from database;
Judge whether described time delay is less than Preset Time;
When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And
Select described from database using as new master data base.
Alternatively, select deferred transaction quantity be less than predetermined number from database to comprise further as the step of new master data base:
Obtain the described information from database to determine the described transactions postponed from database;
Judge whether the described transactions postponed is less than predetermined number; And
When the described transactions postponed is less than described predetermined number, select described from database using as new master data base.
Alternatively, described method comprises further:
Before the described master data base by described data-base cluster is switched to described new master data base, completion is carried out to the data of described new master data base.
Alternatively, described method comprises further:
After the described master data base by described data-base cluster is switched to described new master data base, by every config update of the described new master data base after switching to middle layer, to recover business.
Alternatively, all master data base in described data-base cluster and all open gtid (global transaction identifier, global transaction indications) from database.
According to one aspect of the present invention, additionally provide a kind of High Availabitity solving device of data-base cluster, described data-base cluster adopts primary and secondary structure, comprising:
List acquisition module, is suitable for, when the master data base of described data-base cluster cannot provide service, obtaining all lists from database of described data-base cluster;
Master library screening module, is suitable for according to pre-conditioned, described all from database in described list records, and screening obtains one from database using as new master data base;
Handover module, is suitable for the master data base of described data-base cluster to be switched to described new master data base.
Alternatively, all IP addresses corresponding from database are recorded in described list.
Alternatively, described master library screening module is further adapted for, described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.
Alternatively, described master library screening module is further adapted for:
Selection mode be designated alive state from database using as new master data base; And/or
Select deferred transaction quantity be less than predetermined number from database using as new master data base.
Alternatively, described master library screening module be further adapted for selection mode be in the following manner designated alive state from database using as new master data base:
By performing ping operation to described from database, obtain the described time delay from database;
Judge whether described time delay is less than Preset Time;
When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And
Select described from database using as new master data base.
Alternatively, described master library screening module be further adapted for select in the following manner deferred transaction quantity be less than predetermined number from database using as new master data base:
Obtain the described information from database to determine the described transactions postponed from database;
Judge whether the described transactions postponed is less than predetermined number; And
When the described transactions postponed is less than described predetermined number, select described from database using as new master data base.
Alternatively, described device comprises further:
Completion module, is suitable for, before the master data base of described data-base cluster is switched to described new master data base, the data of described new master data base being carried out completion.
Alternatively, described device comprises further:
Configuration module, is suitable for after the master data base of described data-base cluster is switched to described new master data base, by every config update of the described new master data base after switching to middle layer, to recover business.
Alternatively, all master data base in described data-base cluster and all open gtid from database.
The invention provides a kind of High Availabitity solution and device of data-base cluster, when the master data base of data-base cluster cannot provide service, by obtaining all lists from database of data-base cluster, all from database in this list records, screening obtains one from database as new master data base, the master data base of data-base cluster is switched to this new master data base, can when the master data base of data-base cluster cannot provide service due to reasons such as the machines of delaying, automatic selection one switches to new master data base from database, what ensure data also can allow business be restored within the extremely short time comprehensively.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to technological means of the present invention can be better understood, and can be implemented according to the content of instructions, and can become apparent, below especially exemplified by the specific embodiment of the present invention to allow above and other objects of the present invention, feature and advantage.
According to hereafter by reference to the accompanying drawings to the detailed description of the specific embodiment of the invention, those skilled in the art will understand above-mentioned and other objects, advantage and feature of the present invention more.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit will become cheer and bright for those of ordinary skill in the art.Accompanying drawing only for illustrating the object of preferred implementation, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts by identical reference symbol.In the accompanying drawings:
Fig. 1 is a kind of configuration diagram of existing relevant database mysql data-base cluster;
Fig. 2 is the schematic flow sheet of the High Availabitity solution of a kind of data-base cluster that one embodiment of the invention provides;
Fig. 3 is the High Availabitity solution idiographic flow schematic diagram of a kind of mysql data-base cluster that one embodiment of the invention provides;
Fig. 4 is that judging of providing of one embodiment of the invention is all from a certain method flow schematic diagram whether meeting the screening conditions as new master data base from database database;
Fig. 5 is the configuration diagram being switched to the mysql data-base cluster of new master data base that one embodiment of the invention provides;
Fig. 6 is the High Availabitity solving device structural representation of a kind of data-base cluster that one embodiment of the invention provides.
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Embodiment one
Embodiments provide a kind of High Availabitity solution of data-base cluster, it can be implemented in data-base cluster, when the master data base in data-base cluster cannot provide service, can select at once one alternative from database as new master data base, ensure the normal operation of data-base cluster.
Fig. 2 is the schematic flow sheet of the High Availabitity solution of a kind of data-base cluster that the present embodiment provides, and the method comprising the steps of S202 is to step S206.
S202: when the master data base of data-base cluster cannot provide service, obtain all lists from database of this data-base cluster.
S204: according to pre-conditioned, all from database in list records, screening obtains one from database using as new master data base.
S206: the master data base of data-base cluster is switched to above-mentioned new master data base.
The invention provides a kind of High Availabitity solution of data-base cluster, when the master data base of data-base cluster cannot provide service, by obtaining all lists from database of data-base cluster, all from database in this list records, screening obtains one from database as new master data base, the master data base of data-base cluster is switched to this new master data base, can when the master data base of data-base cluster cannot provide service due to reasons such as the machines of delaying, automatic selection one switches to new master data base from database, what ensure data also can allow business be restored within the extremely short time comprehensively.
Embodiment two
The present embodiment is a kind of embody rule scene of above-described embodiment one, by the present embodiment, can set forth method provided by the present invention clearly, particularly.
Should understand, the present invention does not limit the type of database, as long as can apply following proposal of the present invention be all applicable to this with the database reaching High Availabitity object.In addition, described connection control device is also not limited to and is realized by server, and those skilled in the art other modes can also implement described connection control device on reading basis of the present invention, and it all should be contained within the scope of the invention.
Below, with Mysql data instance, technical scheme of the present invention will be described:
In order to the method that can provide the embodiment of the present invention carries out clearer explanation, in the present embodiment two, still for the mysql data-base cluster in background technology shown in Fig. 1, the master data base master of current database cluster cannot provide service due to the machine of delaying, and to comprise 3 in mysql data-base cluster altogether from database be example, illustrate how to solve master data base delay machine time solution.
As shown in Figure 3, be the High Availabitity solution of a kind of mysql data-base cluster that the embodiment of the present invention provides, the method comprises step S301 to S305 altogether.
In step S301, when the master data base of Mysql data-base cluster cannot provide service, what obtain in current mysql database is whole in database, and forms list;
Wherein, in the present embodiment, mysql comprises three altogether from database:
Slave-1, Slave-2 and Slave-3.
Therefore, all lists from database of mysql database can be formed by above-mentioned three from database, above-mentioned three can be used in the list to carry out record from the IP address of database.
Further, can will form a circulation from database in this list, screen from database in step below.
Obtain all after the list of database, perform step S302, in lists screening meet the condition of new master data base from database, and using screening obtain from database as new master data base.
Wherein, can be pre-conditioned as follows as should meeting from database of new master data base:
Be alive state from the state of database;
Deferred transaction quantity is less than predetermined number;
Open gtid information.
It should be noted that, from the state of database be alive state, to open gtid information be first-selected condition as new master data base, the requirement for deferred transaction quantity then can be selected as the case may be.
When carrying out the screening of new master data base from database, following three kinds of modes at least can be comprised:
(1) successively all are judged from database in a circulating manner, if obtain any one meet as new master data base condition from database, can using this from database as new master data base, stop other judgements from database.
(2) successively all are judged from database in a circulating manner, after all judging to terminate, meet new master data base condition from database, choose best one of its conditional from database as new master data base.
Such as, time delay minimum, deferred transaction minimum number etc.
(3) successively all are judged from database in a circulating manner, after all judging to terminate, meet new master data base condition from database, choose arbitrarily one from database as new master data base.
Below to being specifically described all processes of screening from database in a circulating manner, as shown in Figure 4, provide and judge all from a certain method flow diagram whether meeting the screening conditions as new master data base from database database, comprise the steps:
In step S302-1, judge whether current be alive state from database, if so, then performs step S302-2, if not, then current screening conditions not meeting new master data base from database, jump to next judgement from database.
Wherein, judge that the current method being whether alive state from database can be:
Perform ping operation to current from database, judge that it returns and whether exceed Preset Time (can be such as 0.5ms) corresponding time delay, if not, then determine that it is alive state, if so, then judge that it is not alive state.
In step S302-2, judge whether the information such as current gtid, binlog from database open, if, then perform step S302-3, if not, then current screening conditions not meeting new master data base from database, jump to next judgement from database.
Wherein, the affairs of gtid on former master data base master are created when submitting to, because gtid needs to keep uniqueness in the master-standby topological structure of the overall situation, therefore by GTID, we can promote new master data base when automatically switching to the replication topology of some complexity very easily, such as, copy coordinate by pointing to specific gtid to determine new standby storehouse.
Gtid is generally made up of two parts:
gtid=source_id:transaction_id
Source_id, for indicating source server, represents with server_uuid, and this value generates when first time starts, and is written in the configuration file data/auto.cnf of mysql database;
Transaction_id according to which affairs submitted on source server determines.
Generally, gtid is recorded in the binlog of mysql database, and the event type that it shows in binlog can be:
GTID_LOG_EVENT: for representing the GTID of affairs subsequently;
ANONYMOUS_GTID_LOG_EVENT: anonymous GTID event type;
PREVIOUS_GTIDS_LOG_EVENT: for the GTID set performed before representing current binlog file.
It is generally recorded in the file header of binlog.
When inquiring about, can the information such as gtid, binlog be inquired about by performing check_candidate_eligibility function and guarantee that it is opened.
In step S302-3, judge whether the current transactions postponed from database is less than predetermined number, if, the then current screening conditions meeting new master data base from database, if not, the then current screening conditions not meeting new master data base from database, jump to next judgement from database.
It should be noted that, if too much from the transactions of database delay, then illustrate that its situation is bad, can not be used as new master data base, in order to avoid affect the operational efficiency of whole mysql database, predetermined number can be 100.
After screening obtains new master data base, perform step S303, Supplementing Data is carried out to new master data base.
Wherein, in the host-guest architecture of mysql database, require that master data base has data the most up-to-date in whole mysql cluster, and new master data base obtains by screening from database, therefore also need to be carried out Supplementing Data, to make it have the switching that the most complete up-to-date data just can carry out master data base.
Supplementing Data for new master data base operates, can in the following manner:
By new master data base and other all comparisons carrying out successively from database, if newer from the data of database, then by from the data syn-chronization in database in new master data base, until complete all comparisons from database and synchronously, now can ensure that new master data base has the most complete up-to-date data.
After completing the Supplementing Data to new master data base, perform step S304, the master data base of mysql database is switched to new for database.
Wherein, for the switching of master data base, can be completed by the configuration file of amendment mysql database.
In the present embodiment, for new master data base for Slave-1, as shown in Figure 5, for being switched to the configuration diagram of the mysql data-base cluster of new master data base, new master data base is Slave-1, is Slave-2 and Slave-3 from database.
After the switching completing master data base, then perform step S305, the Reconfigurations of new master data base is updated to middle layer, to recover business.
Embodiments provide a kind of High Availabitity solution of data-base cluster, when the master data base of data-base cluster cannot provide service, by obtaining all lists from database of data-base cluster, all from database in this list records, screening obtains one from database as new master data base, the master data base of data-base cluster is switched to this new master data base, can when the master data base of data-base cluster cannot provide service due to reasons such as the machines of delaying, automatic selection one switches to new master data base from database, what ensure data also can allow business be restored within the extremely short time comprehensively.
Embodiment three
Fig. 6 is the High Availabitity solving device structured flowchart of a kind of data-base cluster that one embodiment of the invention provides, and this data-base cluster adopts host-guest architecture, and this device 600 comprises:
List acquisition module 610, is suitable for, when the master data base of described data-base cluster cannot provide service, obtaining all lists from database of described database;
Master library screening module 620, is suitable for according to pre-conditioned, described all from database in above-mentioned list records, and screening obtains one from database using as new master data base;
Handover module 630, is suitable for the master data base of this data-base cluster to be switched to above-mentioned new master data base.
Alternatively, all IP addresses corresponding from database are recorded in above-mentioned list.
Alternatively, master library screening module 620 is further adapted for, all from database in above-mentioned list records, select to possess vitality from database using as new master data base, wherein, possess vitality from database and refer to that this can provide data and/or business support from database.
Alternatively, master library screening module 620 is further adapted for:
Selection mode be designated alive state from database using as new master data base; And/or
Select deferred transaction quantity be less than predetermined number from database using as new master data base.
Alternatively, master library screening module 620 be further adapted for selection mode be in the following manner designated alive state from database using as new master data base:
By performing ping operation to from database, obtain the time delay from database;
Judge whether time delay is less than Preset Time;
When being less than Preset Time time delay, judge from the status indicator of database be alive state; And
Select this from database using as new master data base.
Alternatively, master library screening module 620 be further adapted for select in the following manner deferred transaction quantity be less than predetermined number from database using as new master data base:
Obtain from the information of database to determine the transactions postponed from database;
Judge whether the transactions postponed is less than predetermined number; And
When the transactions postponed is less than predetermined number, select this from database using as new master data base.
Alternatively, said apparatus 600 also comprises:
Completion module 640, is suitable for, before the master data base of data-base cluster is switched to new master data base, the data of this new master data base being carried out completion.
Alternatively, said apparatus 600 also comprises:
Configuration module 650, is suitable for after the master data base of data-base cluster is switched to new master data base, by every config update of the new master data base after switching to middle layer, to recover business.
Embodiments provide a kind of High Availabitity solving device of data-base cluster, when the master data base of data-base cluster cannot provide service, by obtaining all lists from database of data-base cluster, all from database in this list records, screening obtains one from database as new master data base, the master data base of data-base cluster is switched to this new master data base, can when the master data base of data-base cluster cannot provide service due to reasons such as the machines of delaying, automatic selection one switches to new master data base from database, what ensure data also can allow business be restored within the extremely short time comprehensively.
In instructions provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in detail in the claims, the one of any of embodiment required for protection can use with arbitrary array mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the some or all parts in the High Availabitity solving device of the data-base cluster of the embodiment of the present invention.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.
So far, those skilled in the art will recognize that, although multiple exemplary embodiment of the present invention is illustrate and described herein detailed, but, without departing from the spirit and scope of the present invention, still can directly determine or derive other modification many or amendment of meeting the principle of the invention according to content disclosed by the invention.Therefore, scope of the present invention should be understood and regard as and cover all these other modification or amendments.
Embodiments provide the High Availabitity solution of an A1. data-base cluster, described data-base cluster adopts primary and secondary structure, described method comprises: when the master data base of described data-base cluster cannot provide service, obtain all lists from database of described data-base cluster; According to pre-conditioned, described all from database in described list records, screening obtains one from database using as new master data base; And, the master data base of described data-base cluster is switched to described new master data base.A2. the method according to A1, wherein, records all IP addresses corresponding from database in described list.A3. the method according to A1 or A2, wherein, according to pre-conditioned, described all from database in described list records, screening obtains one from database to comprise further as the step of new master data base: described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.A4. the method according to A3, wherein, described all from database in described list records, select to possess vitality from database to comprise further as the step of new master data base: selection mode be designated alive state from database using as new master data base; And/or select deferred transaction quantity be less than predetermined number from database using as new master data base.A5. the method according to A4, wherein, selection mode be designated alive state from database to comprise further as the step of new master data base: by performing ping operation to described from database, obtain the described time delay from database; Judge whether described time delay is less than Preset Time; When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And, select described from database using as new master data base.A6. the method according to A4, wherein, select deferred transaction quantity be less than predetermined number from database to comprise further as the step of new master data base: obtain the described information from database to determine the described transactions postponed from database; Judge whether the described transactions postponed is less than predetermined number; And, when the described transactions postponed is less than described predetermined number, select described from database using as new master data base.A7. the method according to any one of A1 to A6, wherein, described method comprises further: before the described master data base by described data-base cluster is switched to described new master data base, carries out completion to the data of described new master data base.A8. the method according to any one of A1 to A7, wherein, described method comprises further: after the described master data base by described data-base cluster is switched to described new master data base, by every config update of the described new master data base after switching to middle layer, to recover business.A9. the method according to any one of A1 to A8, wherein, all master data base in described data-base cluster and all open global transaction indications gtid from database.
Embodiments provide the High Availabitity solving device of a B10. data-base cluster, described data-base cluster adopts primary and secondary structure, comprise: list acquisition module, be suitable for, when the master data base of described data-base cluster cannot provide service, obtaining all lists from database of described data-base cluster; Master library screening module, is suitable for according to pre-conditioned, described all from database in described list records, and screening obtains one from database using as new master data base; Handover module, is suitable for the master data base of described data-base cluster to be switched to described new master data base.B11. the device according to B10, wherein, records all IP addresses corresponding from database in described list.B12. the device according to B10 or B11, wherein, described master library screening module is further adapted for, described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.B13. the device according to B12, wherein, described master library screening module is further adapted for: selection mode be designated alive state from database using as new master data base; And/or select deferred transaction quantity be less than predetermined number from database using as new master data base.B14. the device according to B13, wherein, described master library screening module be further adapted for selection mode be in the following manner designated alive state from database using as new master data base: by performing ping operation to described from database, obtain the described time delay from database; Judge whether described time delay is less than Preset Time; When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And, select described from database using as new master data base.B15. the device according to B13, wherein, described master library screening module be further adapted for select in the following manner deferred transaction quantity be less than predetermined number from database using as new master data base: obtain the described information from database to determine the described transactions postponed from database; Judge whether the described transactions postponed is less than predetermined number; And, when the described transactions postponed is less than described predetermined number, select described from database using as new master data base.B16. the device according to any one of B10 to B15, wherein, described device comprises further: completion module, is suitable for, before the master data base of described data-base cluster is switched to described new master data base, the data of described new master data base being carried out completion.B17. the device according to any one of B10 to B16, wherein, described device comprises further: configuration module, be suitable for after the master data base of described data-base cluster is switched to described new master data base, by every config update of the described new master data base after switching to middle layer, to recover business.B18. the device according to any one of B10 to B17, wherein, all master data base in described data-base cluster and all open global transaction indications gtid from database.

Claims (10)

1. a High Availabitity solution for data-base cluster, described data-base cluster adopts primary and secondary structure, and described method comprises:
When the master data base of described data-base cluster cannot provide service, obtain all lists from database of described data-base cluster;
According to pre-conditioned, described all from database in described list records, screening obtains one from database using as new master data base; And
The master data base of described data-base cluster is switched to described new master data base.
2. method according to claim 1, wherein, records all IP addresses corresponding from database in described list.
3. method according to claim 1 and 2, wherein, according to pre-conditioned, described all from database in described list records, screening obtains one from database to comprise further as the step of new master data base:
Described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.
4. method according to claim 3, wherein, described all from database in described list records, select to possess vitality from database to comprise further as the step of new master data base:
Selection mode be designated alive state from database using as new master data base; And/or
Select deferred transaction quantity be less than predetermined number from database using as new master data base.
5. method according to claim 4, wherein, selection mode be designated alive state from database to comprise further as the step of new master data base:
By performing ping operation to described from database, obtain the described time delay from database;
Judge whether described time delay is less than Preset Time;
When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And
Select described from database using as new master data base.
6. a High Availabitity solving device for data-base cluster, described data-base cluster adopts primary and secondary structure, comprising:
List acquisition module, is suitable for, when the master data base of described data-base cluster cannot provide service, obtaining all lists from database of described data-base cluster;
Master library screening module, is suitable for according to pre-conditioned, described all from database in described list records, and screening obtains one from database using as new master data base;
Handover module, is suitable for the master data base of described data-base cluster to be switched to described new master data base.
7. device according to claim 6, wherein, records all IP addresses corresponding from database in described list.
8. the device according to claim 6 or 7, wherein, described master library screening module is further adapted for, described all from database in described list records, select to possess vitality from database using as new master data base, wherein, described possess vitality from database and refer to that this can provide data and/or business support from database.
9. device according to claim 8, wherein, described master library screening module is further adapted for:
Selection mode be designated alive state from database using as new master data base; And/or
Select deferred transaction quantity be less than predetermined number from database using as new master data base.
10. device according to claim 9, wherein, described master library screening module be further adapted for selection mode be in the following manner designated alive state from database using as new master data base:
By performing ping operation to described from database, obtain the described time delay from database;
Judge whether described time delay is less than Preset Time;
When being less than described Preset Time described time delay, judge described from the status indicator of database be alive state; And
Select described from database using as new master data base.
CN201410818093.9A 2014-12-24 2014-12-24 High-availability solving method and device of database cluster Pending CN104516966A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410818093.9A CN104516966A (en) 2014-12-24 2014-12-24 High-availability solving method and device of database cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410818093.9A CN104516966A (en) 2014-12-24 2014-12-24 High-availability solving method and device of database cluster

Publications (1)

Publication Number Publication Date
CN104516966A true CN104516966A (en) 2015-04-15

Family

ID=52792265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410818093.9A Pending CN104516966A (en) 2014-12-24 2014-12-24 High-availability solving method and device of database cluster

Country Status (1)

Country Link
CN (1) CN104516966A (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866556A (en) * 2015-05-15 2015-08-26 北京奇虎科技有限公司 Database fault handling method and apparatus, and database system
CN105095486A (en) * 2015-08-17 2015-11-25 浪潮(北京)电子信息产业有限公司 Cluster database disaster recovery method and device
CN105262835A (en) * 2015-10-30 2016-01-20 北京奇虎科技有限公司 Data storage method and device of multiple machine rooms
CN106407356A (en) * 2016-09-07 2017-02-15 网易(杭州)网络有限公司 Data backup method and device
CN106713487A (en) * 2017-01-16 2017-05-24 腾讯科技(深圳)有限公司 Data synchronization method and device
CN107071189A (en) * 2016-11-28 2017-08-18 深圳市潮流网络技术有限公司 A kind of connection method of communication apparatus physical interface
CN107870830A (en) * 2016-09-23 2018-04-03 北京京东尚科信息技术有限公司 A kind of method and apparatus for lifting database availability
CN108322358A (en) * 2017-12-15 2018-07-24 北京奇艺世纪科技有限公司 Strange land distributed message transmission, processing, consuming method and device mostly living
CN108647113A (en) * 2018-03-30 2018-10-12 阿里巴巴集团控股有限公司 A kind of Disaster Recovery Method and server
CN108900572A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Primary database domain name method for handover control, computer equipment and storage medium
CN108959604A (en) * 2018-07-13 2018-12-07 浙江彩虹鱼科技有限公司 Safeguard the method, apparatus and computer readable storage medium of data-base cluster
CN111464580A (en) * 2019-01-22 2020-07-28 阿里巴巴集团控股有限公司 Method and device for selecting main server
CN112199356A (en) * 2020-12-09 2021-01-08 北京顺达同行科技有限公司 Fault processing method, device, server and storage medium
WO2021072967A1 (en) * 2019-10-17 2021-04-22 厦门网宿有限公司 Method and device for managing configuration information
CN113761075A (en) * 2020-09-01 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and computer readable medium for switching databases
CN113761051A (en) * 2020-07-01 2021-12-07 北京沃东天骏信息技术有限公司 Message pushing method, data acquisition method, device, system, equipment and medium
WO2022082475A1 (en) * 2020-10-21 2022-04-28 Paypal, Inc. Access consistency in high-availability databases

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189340A1 (en) * 2007-02-01 2008-08-07 David Randall Blea Apparatus, system, and method for synchronizing a remote database
CN101706795A (en) * 2009-11-30 2010-05-12 上海世范软件技术有限公司 Method for synchronizing data of database in active/standby server
CN103019875A (en) * 2012-12-19 2013-04-03 北京世纪家天下科技发展有限公司 Method and device for realizing double main reconstruction of database
CN104199957A (en) * 2014-09-17 2014-12-10 合一网络技术(北京)有限公司 Redis universal agent implementation method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189340A1 (en) * 2007-02-01 2008-08-07 David Randall Blea Apparatus, system, and method for synchronizing a remote database
CN101706795A (en) * 2009-11-30 2010-05-12 上海世范软件技术有限公司 Method for synchronizing data of database in active/standby server
CN103019875A (en) * 2012-12-19 2013-04-03 北京世纪家天下科技发展有限公司 Method and device for realizing double main reconstruction of database
CN104199957A (en) * 2014-09-17 2014-12-10 合一网络技术(北京)有限公司 Redis universal agent implementation method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
(美)布拉德福 等: "《Effective MySQL之深入解析复制技术》", 31 January 2014 *
SLVHER: ""【Redis笔记】第5篇:redis监控工具-redissentinel使用说明及注意事项"", 《HTTP://WWW.2CTO.COM/DATABASE/201312/269019.HTML》 *
邯郸人: ""redis sentinel模式下,如何选举新的master"", 《HTTP://WWW.TUICOOL.COM/ARTICLES/YIENUJ》 *

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866556A (en) * 2015-05-15 2015-08-26 北京奇虎科技有限公司 Database fault handling method and apparatus, and database system
CN104866556B (en) * 2015-05-15 2019-07-23 北京奇虎科技有限公司 Fault handling method, device and the Database Systems of database
CN105095486A (en) * 2015-08-17 2015-11-25 浪潮(北京)电子信息产业有限公司 Cluster database disaster recovery method and device
CN105262835A (en) * 2015-10-30 2016-01-20 北京奇虎科技有限公司 Data storage method and device of multiple machine rooms
CN105262835B (en) * 2015-10-30 2019-08-02 北京奇虎科技有限公司 Date storage method and device in a kind of multimachine room
CN106407356A (en) * 2016-09-07 2017-02-15 网易(杭州)网络有限公司 Data backup method and device
CN107870830A (en) * 2016-09-23 2018-04-03 北京京东尚科信息技术有限公司 A kind of method and apparatus for lifting database availability
CN107870830B (en) * 2016-09-23 2021-07-20 北京京东尚科信息技术有限公司 Method and device for improving availability of database
CN107071189A (en) * 2016-11-28 2017-08-18 深圳市潮流网络技术有限公司 A kind of connection method of communication apparatus physical interface
CN106713487A (en) * 2017-01-16 2017-05-24 腾讯科技(深圳)有限公司 Data synchronization method and device
CN106713487B (en) * 2017-01-16 2020-10-09 腾讯科技(深圳)有限公司 Data synchronization method and device
CN108322358A (en) * 2017-12-15 2018-07-24 北京奇艺世纪科技有限公司 Strange land distributed message transmission, processing, consuming method and device mostly living
CN108647113A (en) * 2018-03-30 2018-10-12 阿里巴巴集团控股有限公司 A kind of Disaster Recovery Method and server
CN108900572A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Primary database domain name method for handover control, computer equipment and storage medium
CN108900572B (en) * 2018-05-31 2022-08-09 康键信息技术(深圳)有限公司 Main database domain name switching control method, computer equipment and storage medium
CN108959604B (en) * 2018-07-13 2020-11-10 浙江彩虹鱼科技有限公司 Method, apparatus and computer readable storage medium for maintaining database cluster
CN108959604A (en) * 2018-07-13 2018-12-07 浙江彩虹鱼科技有限公司 Safeguard the method, apparatus and computer readable storage medium of data-base cluster
CN111464580A (en) * 2019-01-22 2020-07-28 阿里巴巴集团控股有限公司 Method and device for selecting main server
CN111464580B (en) * 2019-01-22 2022-04-22 阿里巴巴集团控股有限公司 Method and device for selecting main server
WO2021072967A1 (en) * 2019-10-17 2021-04-22 厦门网宿有限公司 Method and device for managing configuration information
CN113761051A (en) * 2020-07-01 2021-12-07 北京沃东天骏信息技术有限公司 Message pushing method, data acquisition method, device, system, equipment and medium
CN113761075A (en) * 2020-09-01 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and computer readable medium for switching databases
WO2022082475A1 (en) * 2020-10-21 2022-04-28 Paypal, Inc. Access consistency in high-availability databases
US11704182B2 (en) 2020-10-21 2023-07-18 Paypal, Inc. Access consistency in high-availability databases
CN112199356A (en) * 2020-12-09 2021-01-08 北京顺达同行科技有限公司 Fault processing method, device, server and storage medium

Similar Documents

Publication Publication Date Title
CN104516966A (en) High-availability solving method and device of database cluster
CN104537046A (en) Method and device for complementing data
US9842126B2 (en) Automatic repair of corrupt HBases
CN109766330B (en) Data slicing method and device, electronic equipment and storage medium
CN105550229A (en) Method and device for repairing data of distributed storage system
CN104462517A (en) Data synchronizing method and device
CN105515872B (en) The update method of configuration information, apparatus and system
CN104216724B (en) A kind of method and system of web application interface upgrade
CN105721200A (en) Master-slave server system application method and system thereof
CN110673941B (en) Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium
CN105553738A (en) Heat loading method and device of configuration information and distributed cluster system
CN106605217B (en) For the method and system for being moved to another website from a website will to be applied
CN105205182A (en) System deployed in multiple computer rooms and cross-computer-room business data processing method
CN105550306A (en) Multi-copy data reading/writing method and system
CN105528454A (en) Log treatment method and distributed cluster computing device
CN106648933A (en) Consuming method and device of message queue
CN111147605B (en) Service registration method, device and equipment
CN112702195A (en) Gateway configuration method, electronic device and computer readable storage medium
CN103647811A (en) A method and an apparatus for application's accessing backstage service
CN102880473A (en) Method and device for task execution based on quartz framework
CN105550230A (en) Method and device for detecting failure of node of distributed storage system
US10671482B2 (en) Providing consistency in a distributed data store
CN105389394A (en) Data request processing method and device based on a plurality of database clusters
CN107547605B (en) message reading and writing method based on node queue and node equipment
CN104506353A (en) Authentication management method, equipment and system

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: 20150415