CN106909568A - A kind of changing method and device of data-base cluster MDL - Google Patents

A kind of changing method and device of data-base cluster MDL Download PDF

Info

Publication number
CN106909568A
CN106909568A CN201510981264.4A CN201510981264A CN106909568A CN 106909568 A CN106909568 A CN 106909568A CN 201510981264 A CN201510981264 A CN 201510981264A CN 106909568 A CN106909568 A CN 106909568A
Authority
CN
China
Prior art keywords
data
database
mdl
base cluster
new
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
CN201510981264.4A
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 CN201510981264.4A priority Critical patent/CN106909568A/en
Publication of CN106909568A publication Critical patent/CN106909568A/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
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Abstract

The embodiment of the invention discloses a kind of changing method and device of data-base cluster MDL, the method includes:The running status of monitor database cluster;When the MDL in monitoring data-base cluster cannot provide service, in data-base cluster is switched to the new MDL of data-base cluster from database;By the superstructure of the information updating of new MDL to data-base cluster.By the switching method and apparatus of data-base cluster MDL provided in an embodiment of the present invention, during so that front end browsing the MDL of layer or intermediate treatment layer in access data-base cluster, the MDL that service cannot be provided in data-base cluster originally will not be had access to, but the new MDL after switching is accessed, so as to ensure that business is restored within the extremely short time.

Description

A kind of changing method and device of data-base cluster MDL
Technical field
The present invention relates to computer realm, more particularly to a kind of data-base cluster MDL changing method and Device.
Background technology
Current, the application of relevant database widely, such as Mysql databases.At present, relation Many frameworks using one master and multiple slaves in type data-base cluster.As shown in figure 1, being a mysql data-base clusters Configuration diagram, it includes:, from database, three are distinguished from database for MDL master and three For:Slave-1, Slave-2 and Slave3.
For example shown in Fig. 1, Slave-1 and Slave-2 is located at computer room 1, and Slave3 is located at computer room 2.Main number It is connected with from database Slave-1, Slave-2 and Slave3 respectively according to storehouse master.
In reality to mysql databases when using, MDL master is possible to because a variety of causes is delayed Machine, such as system failure, hardware fault etc., are likely to result in MDL master and delay machine, so as to lead Causing whole mysql data-base clusters cannot use, and not there are problems that solving having for this in the prior art Effect technological means.
Therefore, needing one kind badly in the prior art can automatically switch master data in the case where MDL delays machine The method or apparatus in storehouse.
The content of the invention
In view of the above problems, it is proposed that the present invention overcomes above mentioned problem or at least in part to provide one kind The changing method and device of a kind of data-base cluster MDL for solving the above problems.
Embodiment of the present invention first aspect provides a kind of changing method of data-base cluster MDL, described Data-base cluster be a main N from formula structure, wherein N is the integer more than or equal to 1, and methods described includes:
Monitor the running status of the data-base cluster;
When the MDL in monitoring the data-base cluster cannot provide service, by the data base set One in the group new MDL that the data-base cluster is switched to from database;
By the superstructure of the information updating of the new MDL to the data-base cluster.
Alternatively, the information updating by the new MDL is tied to the upper strata of the data-base cluster Structure, specifically includes:
By the information updating of the new MDL to the corresponding front end of the data-base cluster browse layer or Intermediate treatment layer.
Alternatively, by the data-base cluster switches to the data-base cluster from database New MDL, specifically include:
Obtain all lists from database of the data-base cluster;
According to pre-conditioned, in the described all from database of the list records, screening obtain one from Database is as new MDL;And
The MDL of the data-base cluster is switched to the new MDL.
Alternatively, it is described according to pre-conditioned, in the described all from database of the list records, sieve Choosing obtains one from database as new MDL, including:
In the described all from database of the list records, selection possess vitality from database to make It is new MDL, wherein, it is described that to possess vitality from database refer to that this can provide number from database According to and/or business support.
Alternatively, it is described select possess vitality from database as new MDL, including:
Selection status indicator is for alive states from database as new MDL;And/or
Selection deferred transaction quantity is less than predetermined number from database as new MDL.
Alternatively, the selection status indicator for alive states from database as new MDL, Including:
Ping operations are performed from database by described, the time delay from database is obtained;
Judge the time delay whether less than Preset Time;
When the time delay Preset Time is less than, it is from the status indicator of database described in judgement Alive states;And
From database as new MDL described in selection.
Alternatively, the selection deferred transaction quantity less than predetermined number from database as new main number According to storehouse, including:Obtain it is described from the information of database to determine the transactions postponed from database; Judge the transactions for postponing whether less than predetermined number;And, when the transactions for postponing are small When the predetermined number, from database as new MDL described in selection.
Alternatively, the MDL by the data-base cluster be switched to the new MDL it Before, methods described also includes:Data to the new MDL carry out completion.
Alternatively, in the data-base cluster all MDLs and global transaction is all opened from database Indications gtid.
Alternatively, tied on the upper strata of the information updating by the new MDL to the data-base cluster After structure, methods described also includes:
Monitor with running status that the new MDL is main wide area information server cluster.
Embodiment of the present invention second aspect provides a kind of switching device of data-base cluster MDL, described Data-base cluster be a main N from formula structure, wherein N is the integer more than or equal to 1, and described device includes:
Monitoring modular, the running status for monitoring the data-base cluster;
Handover module, for cannot to the MDL in the data-base cluster in the monitoring module monitors When service is provided, in the data-base cluster is switched into the new of the data-base cluster from database MDL;
Update module, for by the information updating of the new MDL to the upper strata of the data-base cluster Structure.
Alternatively, the update module is specifically for by the information updating of the new MDL to the number Layer or intermediate treatment layer are browsed according to the corresponding front end of storehouse cluster.
Alternatively, all row from database of the handover module specifically for the acquisition data-base cluster Table, and according to pre-conditioned, in the described all from database of the list records, screen and obtain one From database as the new MDL, and the MDL of the data-base cluster is switched to The new MDL.
Alternatively, the handover module is specifically in the described all from database of the list records, Selection possess vitality from database as new MDL, wherein, it is described to possess life from database Life power refers to that this can provide data and/or business support from database.
Alternatively, the handover module specifically for selection status indicator for alive states from database with As new MDL, and/or selection deferred transaction quantity less than predetermined number from database as new MDL.
Alternatively, the handover module is obtained specifically for performing ping operations from database by described The time delay from database, and whether the time delay is judged less than Preset Time, and when described Time delay be less than the Preset Time when, judge described in from the status indicator of database be alive states, And selection it is described from database as new MDL.
Alternatively, the handover module is described described from number to determine from the information of database specifically for obtaining According to the transactions that storehouse postpones, and whether the transactions for postponing are judged less than predetermined number, and work as When the transactions for postponing are less than the predetermined number, from database as new main number described in selection According to storehouse.
Alternatively, described device also includes:Completion module, in the handover module by the database Before the MDL of cluster is switched to the new MDL, the data of the new MDL are entered Row completion.
Alternatively, in the data-base cluster all MDLs and global transaction is all opened from database Indications gtid.
Alternatively, the monitoring modular is specifically additionally operable to the letter of the new MDL in the update module Breath is updated to after the superstructure of the data-base cluster, is monitored with the new MDL as master data The running status of the data-base cluster in storehouse.
One or more technical schemes provided in the embodiment of the present invention, at least have the following technical effect that or excellent Point:
By the switching method and apparatus of data-base cluster MDL provided in an embodiment of the present invention, in monitoring When MDL in data-base cluster cannot provide service, by data-base cluster from database Switch to the new MDL of data-base cluster, and by the information updating of new MDL to data base set The superstructure of group so that front end browses the MDL of layer or intermediate treatment layer in data-base cluster is accessed When, the MDL that service cannot be provided in data-base cluster originally will not be had access to, but after accessing switching New MDL, so as to ensure that business is restored within the extremely short time.
Brief description of the drawings
Fig. 1 is the configuration diagram of the relevant database mysql data-base clusters of prior art;
Fig. 2 is that the flow of the changing method of data-base cluster MDL provided in an embodiment of the present invention is illustrated Figure;
Fig. 3 is the configuration diagram of the mysql data-base clusters of the MDL for being switched to new;
Fig. 4 is the functional module of the switching device of data-base cluster MDL provided in an embodiment of the present invention Figure.
Specific embodiment
The embodiment of the present invention is used to by providing a kind of changing method and device of data-base cluster MDL Meet in the prior art to can in the case where MDL delays machine the method for automatic switchover MDL or The demand of device.
Embodiment one
A kind of changing method of data-base cluster MDL is the embodiment of the invention provides, Fig. 2 is refer to, Fig. 2 is the schematic flow sheet of the changing method of data-base cluster MDL provided in an embodiment of the present invention, such as Shown in Fig. 2, the method includes:
101:The running status of monitor database cluster;
For example, by each database in default access frequency access data-base cluster, it is corresponding obtaining Can then determine that the database is normal after accessing result, if as in multiple access cycles in preset time period The corresponding result that accesses cannot be obtained can then determine the database for abnormal condition, or can be according to preceding End browses the access result of layer or intermediate treatment layer to be judged, is not limited herein.
102:When the MDL in monitoring data-base cluster cannot provide service, by data-base cluster In a new MDL for switching to data-base cluster from database;
For example, it may be by data-base cluster meet condition switch to data-base cluster from database New MDL, with alternate data storehouse cluster it is original that the MDL of service cannot be provided.
103:By the superstructure of the information updating of new MDL to data-base cluster;For example, can be with Be by switching after new MDL information updating to front end browse layer or intermediate treatment layer so that front end Layer or intermediate treatment layer are browsed in the MDL in accessing data-base cluster, data base set will not be had access to The MDL of service cannot be provided originally in group, but accessed the new MDL after switching, so as to protect Card business is restored within the extreme time.
It can thus be seen that by the switching side of data-base cluster MDL provided in an embodiment of the present invention Method, when the MDL in monitoring data-base cluster cannot provide service, by data-base cluster The individual new MDL for switching to data-base cluster from database, and by the information updating of new MDL To the superstructure of data-base cluster so that front end browses layer or intermediate treatment layer in data-base cluster is accessed MDL when, the MDL that service cannot be provided in data-base cluster originally will not be had access to, but The new MDL after switching is accessed, so as to ensure that business is restored within the extremely short time.
Embodiment two
The present embodiment is a kind of concrete application scene of above-described embodiment one, by the present embodiment, can be more It is clear, specifically illustrate method provided by the present invention.
, it is to be appreciated that the present invention does not limit the type of database, as long as following proposal of the present invention can be applied This is suitable for the database for reaching High Availabitity purpose.Additionally, connection control device is also not limited to pass through Server realizes, those skilled in the art read it is of the invention on the basis of can also other modes implement Connection control device, it should all cover within the scope of the invention.
Hereinafter, technical scheme will be illustrated with Mysql data instances:
Method in order to be provided the embodiment of the present invention carries out clearer explanation, in the present embodiment two In, still by taking the mysql data-base clusters in background technology shown in Fig. 1 as an example, the master of current database cluster Database master cannot be provided due to the machine of delaying include altogether in service, and mysql data-base clusters 3 from As a example by database, illustrate how solve MDL delay machine when solution.
Please continue to refer to Fig. 1 and Fig. 2, in the present embodiment, data-base cluster includes MDL master With three from database, three are respectively from database:Slave-1, Slave-2 and Slave3.
Please continue to refer to Fig. 2, in the present embodiment, the implementation procedure of step 101 is consistent with embodiment one, Just repeat no more herein.
In the present embodiment, step 102 can include:
1021:Obtain all lists from database of data-base cluster;
For example, obtaining three lists from database, three are respectively from database:Slave-1、Slave-2 And Slave3, specifically, all from data of mysql databases can be constituted from database by above three The list in storehouse, can be recorded using above three from the IP address of database in the list, so, Can will in the list from database constitute one circulation, in below step to being sieved from database Choosing.
When the screening of new MDL is carried out from database, can at least include following three kinds of modes:
(1) judge from database all of successively in a circulating manner, if obtaining any one symbol Cooperate condition for new MDL from database, you can using this from database as new master data Storehouse, stops to other from the judgement of database.
(2) judge from database all of successively in a circulating manner, after all judging to terminate, Meet the condition of new MDL chosen from database its conditional best one from database As new MDL.
For example, time delay minimum, deferred transaction minimum number etc..
(3) judge from database all of successively in a circulating manner, after all judging to terminate, One is chosen from database as new master any from database of the condition of new MDL is met Database.
1022:According to pre-conditioned, in all from database of list records, screen and obtain one from number According to storehouse as new MDL;Wherein it is possible to as new MDL from database should meet as Under it is pre-conditioned:It is alive states from the state of database;Deferred transaction quantity is less than predetermined number;Open Gtid (global transaction identifier, global transaction indications) information is opened.
It should be noted that from the state of database be alive states, to open gtid information be as new MDL first-selected condition, the requirement for deferred transaction quantity can then select as the case may be Select.
Wherein, judge it is current from database whether be that the method for alive states can be:
To currently performing ping operations from database, judge that whether it returns to corresponding time delay more than default Time (for example can be 0.5ms), if it is not, then alive states are determined that it is, if it is, sentencing Breaking, it is not alive states.
Judge whether the information such as current gtid, binlog from database open, if it is, current from number The screening conditions of new MDL are not met according to storehouse, if it is not, then not met from database currently new The screening conditions of MDL, jump to next judgement from database.
Wherein, it is created when affairs of the gtid on former MDL master are submitted to, because gtid needs Keep uniqueness in global master-standby topological structure, therefore we can be when automatically switching pair by gtid Some complicated replication topologies very easily lift new MDL, such as by pointing to specific gtid come really Replicate coordinate in fixed new standby storehouse.
Gtid is typically made up of two parts:
Gtid=source_id:transaction_id
Source_id is used to indicate source server, is represented with server_uuid, and this value is opened in first time Generated when dynamic, and be written in the configuration file data/auto.cnf of mysql databases;
Transaction_id is determined according to which affairs submitted on source server.
Generally, gtid is recorded in the binlog of mysql databases, and it is showed in binlog Event type can be:
GTID_LOG_EVENT:GTID for representing subsequent affairs;
ANONYMOUS_GTID_LOG_EVENT:Anonymous GTID event types;
PREVIOUS_GTIDS_LOG_EVENT:For having been held before representing current binlog files The GTID set gone.
It is typically recorded in the file header of binlog.
When being inquired about, can be inquired about by performing check_candidate_eligibility functions gtid, The information such as binlog simultaneously ensure that it is opened.
Judge whether the current transactions postponed from database are less than predetermined number, if it is, it is current from Database meets the screening conditions of new MDL, if it is not, then not met from database currently new The screening conditions of MDL, jump to next judgement from database.
If it should be noted that the transactions postponed from database are excessive, illustrating that its situation is bad, no New MDL is can serve as, in order to avoid influenceing the operational efficiency of whole mysql databases, predetermined number is for example It can be 100.
After screening obtains new MDL, Supplementing Data is carried out to new MDL.
Wherein, in the host-guest architecture of mysql databases, it is desirable to which MDL has whole mysql clusters In most complete newest data, and new MDL is obtained by being screened from database, therefore is also needed to it Supplementing Data is carried out, the switching of MDL can be just carried out to make it have newest most full data.
For the Supplementing Data operation of new MDL, can be as follows:
By new MDL and other all comparisons for being carried out from database successively, if from the data of database It is relatively new, then by from the data syn-chronization in database to new MDL, until completing to all from data The comparison and synchronization in storehouse, can now ensure that new MDL has newest most full data.
1023:The MDL of data-base cluster is switched to new MDL.
After the Supplementing Data to new MDL is completed, i.e., can be by the MDL of mysql databases It is switched to new from database.
Wherein, for the switching of MDL, can be completed by changing the configuration file of mysql databases.
In the present embodiment, so that new MDL is as Slave-1 as an example, as shown in figure 3, Fig. 3 is to cut The configuration diagram of the mysql data-base clusters of new MDL is changed to, new MDL is Slave-1, is Slave-2 and Slave-3 from database.
After the switching for completing MDL, that is, step 103 is able to carry out, by the information of new MDL The superstructure of data-base cluster is updated, for example, it is two to browse interacting for layer in data-base cluster and front end During Rotating fields, the information updating of new MDL to the corresponding front end of data-base cluster is browsed into layer, or Data-base cluster and front end browse the interacting during for three-decker of layer, and the information updating of new MDL is arrived The corresponding intermediate treatment layer of data-base cluster, so that front end browses layer or intermediate treatment layer is accessing data During MDL in the cluster of storehouse, the master data that service cannot be provided in data-base cluster originally will not be had access to Storehouse, but the new MDL after switching is accessed, so as to ensure that business is restored within the extremely short time.
After by the superstructure of the information updating of new MDL to data-base cluster, you can to continue To being monitored with the running status that new MDL is main wide area information server cluster, if finding data The MDL of storehouse cluster can not provide service, then abovementioned steps are performed again, so as to ensure business energy It is enough to be restored within the extremely short time.
It can thus be seen that by the switching side of data-base cluster MDL provided in an embodiment of the present invention Method, when the MDL in monitoring data-base cluster cannot provide service, by data-base cluster The individual new MDL for switching to data-base cluster from database, and by the information updating of new MDL To the superstructure of data-base cluster so that front end browses layer or intermediate treatment layer in data-base cluster is accessed MDL when, the MDL that service cannot be provided in data-base cluster originally will not be had access to, but The new MDL after switching is accessed, so as to ensure that business is restored within the extremely short time.
Embodiment three
To implement the changing method of the data-base cluster MDL provided in embodiment one or embodiment two, this Embodiment provides a kind of switching device of data-base cluster MDL, refer to Fig. 4, and Fig. 4 is the present invention The functional block diagram of the switching device of the data-base cluster MDL that embodiment is provided, as shown in figure 4, should The switching device of data-base cluster MDL includes:
Detection module 401, for the running status of monitor database cluster;
Handover module 402, cannot for the MDL in monitoring data-base cluster in detection module 401 When service is provided, in data-base cluster is switched to the new master data of data-base cluster from database Storehouse;
Update module 403, for by the superstructure of the information updating of new MDL to data-base cluster.
Further, update module 403 is specifically for by the information updating of new MDL to data base set The corresponding front end of group browses layer or intermediate treatment layer.
Further, handover module 402 specifically for obtain data-base cluster all lists from database, And according to pre-conditioned, in all from database of list records, screen and obtain one from database to make It is new MDL, and the MDL of data-base cluster is switched to new MDL.
Further, handover module 402 is specifically in all from database of list records, selection tool For vitality from database as new MDL, wherein, it refers to this to possess vitality from database Data and/or business support can be provided from database.
Further, handover module 402 is alive states from database specifically for selection status indicator As new MDL, and/or selection deferred transaction quantity less than predetermined number from database as New MDL.
Further, handover module 402 specifically for by from database perform ping operate, obtain from The time delay of database, and whether time delay is judged less than Preset Time, and when time delay is less than pre- If during the time, judge that from the status indicator of database be alive states, and selection from database as New MDL.
Further, handover module 402 is specifically for obtaining the information from database to determine to prolong from database Slow transactions, and whether the transactions for postponing are judged less than predetermined number, and when the affairs for postponing When quantity is less than predetermined number, selection is from database as new MDL.
Further, device also includes:Completion module 404, in handover module 402 by data base set Before the MDL of group is switched to new MDL, the data of new MDL are carried out into completion.
Further, in data-base cluster all MDLs and gtid is all opened from database.
Further, detection module 401 is specifically additionally operable to the information of new MDL in update module 403 Update after the superstructure of data-base cluster, it is main wide area information server to monitor with new MDL The running status of cluster.
The switching device of the data-base cluster MDL in the present embodiment, with the database in previous embodiment The changing method of cluster MDL is based on two aspects under same inventive concept, in above other side The implementation process of method is described in detail, thus those skilled in the art can according to it is described above clearly The structure and implementation process of the device in solution the present embodiment, it is succinct for specification, just repeat no more herein .
By the changing method of data-base cluster MDL provided in an embodiment of the present invention, data are being monitored When MDL in the cluster of storehouse cannot provide service, in data-base cluster is switched to from database The new MDL of data-base cluster, and by the information updating of new MDL to the upper of data-base cluster Rotating fields so that front end browses layer or intermediate treatment layer in the MDL in accessing data-base cluster, no The MDL that service cannot be provided in data-base cluster originally can be had access to, but accesses new after switching MDL, so as to ensure that business is restored within the extremely short time.
Technical scheme in the embodiments of the present invention, at least has the following technical effect that or advantage:
By the changing method of data-base cluster MDL provided in an embodiment of the present invention, data are being monitored When MDL in the cluster of storehouse cannot provide service, in data-base cluster is switched to from database The new MDL of data-base cluster, and by the information updating of new MDL to the upper of data-base cluster Rotating fields so that front end browses layer or intermediate treatment layer in the MDL in accessing data-base cluster, no The MDL that service cannot be provided in data-base cluster originally can be had access to, but accesses new after switching MDL, so as to ensure that business is restored within the extremely short time.
The embodiment of the invention discloses:
A1, a kind of changing method of data-base cluster MDL, the data-base cluster be a main N from Formula structure, wherein N are the integer more than or equal to 1, it is characterised in that methods described includes:
Monitor the running status of the data-base cluster;
When the MDL in monitoring the data-base cluster cannot provide service, by the data base set One in the group new MDL that the data-base cluster is switched to from database;
By the superstructure of the information updating of the new MDL to the data-base cluster.
A2, the method according to A1, it is characterised in that the information by the new MDL is more The superstructure of the data-base cluster is newly arrived, is specifically included:
By the information updating of the new MDL to the corresponding front end of the data-base cluster browse layer or Intermediate treatment layer.
A3, the method according to A1, it is characterised in that by the data-base cluster The new MDL of the data-base cluster is switched to from database, is specifically included:
Obtain all lists from database of the data-base cluster;
According to pre-conditioned, in the described all from database of the list records, screening obtain one from Database is as new MDL;And
The MDL of the data-base cluster is switched to the new MDL.
A4, the method according to A3, it is characterised in that described according to pre-conditioned, in the list What is recorded is described all from database, and screening obtains one from database as new MDL, bag Include:
In the described all from database of the list records, selection possess vitality from database to make It is new MDL, wherein, it is described that to possess vitality from database refer to that this can provide number from database According to and/or business support.
A5, the method according to A4, it is characterised in that the selection possess vitality from database As new MDL, including:
Selection status indicator is for alive states from database as new MDL;And/or
Selection deferred transaction quantity is less than predetermined number from database as new MDL.
A6, the method according to A5, it is characterised in that the selection status indicator is alive states From database as new MDL, including:
Ping operations are performed from database by described, the time delay from database is obtained;
Judge the time delay whether less than Preset Time;
When the time delay Preset Time is less than, it is from the status indicator of database described in judgement Alive states;And
From database as new MDL described in selection.
A7, the method according to A5, it is characterised in that the selection deferred transaction quantity is less than default Quantity from database as new MDL, including:Obtain it is described from the information of database to determine The transactions postponed from database;Judge the transactions for postponing whether less than predetermined number; And, when the transactions for postponing are less than the predetermined number, selection it is described from database as New MDL.
A8, the method according to any one of A1 to A7, it is characterised in that described by the number Before being switched to the new MDL according to the MDL of storehouse cluster, methods described also includes:To described The data of new MDL carry out completion.
A9, the method according to any one of A1 to A7, it is characterised in that the data-base cluster In all MDLs and global transaction indications gtid is all opened from database.
A10, the method according to any one of A1 to A7, it is characterised in that it is described will be described new To after the superstructure of the data-base cluster, methods described also includes for the information updating of MDL:
Monitor with running status that the new MDL is main wide area information server cluster.
B11, a kind of switching device of data-base cluster MDL, the data-base cluster be a main N from Formula structure, wherein N are the integer more than or equal to 1, it is characterised in that described device includes:
Monitoring modular, the running status for monitoring the data-base cluster;
Handover module, for cannot to the MDL in the data-base cluster in the monitoring module monitors When service is provided, in the data-base cluster is switched into the new of the data-base cluster from database MDL;
Update module, for by the information updating of the new MDL to the upper strata of the data-base cluster Structure.
B12, the device according to B11, it is characterised in that the update module is specifically for by described in The information updating of new MDL browses layer or intermediate treatment layer to the corresponding front end of the data-base cluster.
B13, the device according to B11, it is characterised in that the handover module is specifically for obtaining institute All lists from database of data-base cluster are stated, and according to pre-conditioned, in the institute of the list records State all from database, screening obtains one from database as the new MDL, and will The MDL of the data-base cluster is switched to the new MDL.
B14, the device according to B13, it is characterised in that the handover module is specifically for described List records it is described all from database, selection possess vitality from database as new main number According to storehouse, wherein, it is described that to possess vitality from database refer to that this can provide data and/or business from database Support.
B15, the device according to B14, it is characterised in that the handover module is specifically for selection shape State be designated alive states from database as new MDL, and/or selection deferred transaction quantity Less than predetermined number from database as new MDL.
B16, the device according to B15, it is characterised in that the handover module is specifically for by right It is described to perform ping operations from database, obtain described from the time delay of database, and judge the delay Whether the time is less than Preset Time, and when the time delay Preset Time is less than, judge it is described from The status indicator of database is alive states, and selection it is described from database as new MDL.
B17, the device according to B15, it is characterised in that the handover module is specifically for obtaining institute The information from database is stated to determine the transactions postponed from database, and judges the thing for postponing Whether business quantity is less than predetermined number, and when the transactions for postponing are less than the predetermined number, From database as new MDL described in selection.
B18, the device according to any one of B11 to B17, it is characterised in that described device is also wrapped Include:Completion module, it is described for being switched to the MDL of the data-base cluster in the handover module Before new MDL, the data of the new MDL are carried out into completion.
B19, the device according to any one of B11 to B17, it is characterised in that the data base set Group in all MDLs and global transaction indications gtid is all opened from database.
B20, the device according to any one of B11 to B17, it is characterised in that the monitoring modular Specifically it is additionally operable to the information updating of the new MDL to the data-base cluster in the update module Superstructure after, monitoring is with operation shape that the new MDL is main wide area information server cluster State.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or meter Calculation machine program product.Therefore, the present invention can be using complete hardware embodiment, complete software embodiment or knot Close the form of the embodiment in terms of software and hardware.And, the present invention can be used and wherein wrapped at one or more Containing computer usable program code computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) on implement computer program product form.
The present invention is produced with reference to method according to embodiments of the present invention, equipment (system) and computer program The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions realize flow chart and / or block diagram in each flow and/or the flow in square frame and flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions to all-purpose computer, special-purpose computer, insertion can be provided The processor of formula processor or other programmable data processing devices is producing a machine so that by calculating The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device of the function of being specified in individual flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or the treatment of other programmable datas to set In the standby computer-readable memory for working in a specific way so that storage is in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow of flow chart or multiple The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and series of operation steps is performed on computer or other programmable devices to produce computer implemented place Reason, so as to the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
Obviously, those skilled in the art can carry out various changes and modification without deviating from this hair to the present invention Bright spirit and scope.So, if it is of the invention these modification and modification belong to the claims in the present invention and Within the scope of its equivalent technologies, then the present invention is also intended to comprising these changes and modification.

Claims (10)

1. a kind of changing method of data-base cluster MDL, the data-base cluster is a main N from formula Structure, wherein N are the integer more than or equal to 1, it is characterised in that methods described includes:
Monitor the running status of the data-base cluster;
When the MDL in monitoring the data-base cluster cannot provide service, by the data base set One in the group new MDL that the data-base cluster is switched to from database;
By the superstructure of the information updating of the new MDL to the data-base cluster.
2. method according to claim 1, it is characterised in that described by the new MDL Information updating is specifically included to the superstructure of the data-base cluster:
By the information updating of the new MDL to the corresponding front end of the data-base cluster browse layer or Intermediate treatment layer.
3. method according to claim 1, it is characterised in that described by the data-base cluster A new MDL for switching to the data-base cluster from database, specifically include:
Obtain all lists from database of the data-base cluster;
According to pre-conditioned, in the described all from database of the list records, screening obtain one from Database is as new MDL;And
The MDL of the data-base cluster is switched to the new MDL.
4. method according to claim 3, it is characterised in that described according to pre-conditioned, in institute The described all from database of list records are stated, screening obtains one from database as new master data Storehouse, including:
In the described all from database of the list records, selection possess vitality from database to make It is new MDL, wherein, it is described that to possess vitality from database refer to that this can provide number from database According to and/or business support.
5. method according to claim 4, it is characterised in that the selection possess vitality from Database as new MDL, including:
Selection status indicator is for alive states from database as new MDL;And/or
Selection deferred transaction quantity is less than predetermined number from database as new MDL.
6. method according to claim 5, it is characterised in that the selection status indicator is alive State from database as new MDL, including:
Ping operations are performed from database by described, the time delay from database is obtained;
Judge the time delay whether less than Preset Time;
When the time delay Preset Time is less than, it is from the status indicator of database described in judgement Alive states;And
From database as new MDL described in selection.
7. method according to claim 5, it is characterised in that the selection deferred transaction quantity is small In predetermined number from database as new MDL, including:Obtain the information from database To determine the transactions postponed from database;Judge the transactions for postponing whether less than default Quantity;And, when the transactions for postponing are less than the predetermined number, selection is described from database As new MDL.
8. method according to any one of claim 1 to 7, it is characterised in that described by institute State data-base cluster MDL be switched to the new MDL before, methods described also includes:It is right The data of the new MDL carry out completion.
9. method according to any one of claim 1 to 7, it is characterised in that the database All MDLs in cluster and global transaction indications gtid is all opened from database.
10. a kind of switching device of data-base cluster MDL, the data-base cluster is a main N from formula Structure, wherein N are the integer more than or equal to 1, it is characterised in that described device includes:
Monitoring modular, the running status for monitoring the data-base cluster;
Handover module, for cannot to the MDL in the data-base cluster in the monitoring module monitors When service is provided, in the data-base cluster is switched into the new of the data-base cluster from database MDL;
Update module, for by the information updating of the new MDL to the upper strata of the data-base cluster Structure.
CN201510981264.4A 2015-12-23 2015-12-23 A kind of changing method and device of data-base cluster MDL Pending CN106909568A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510981264.4A CN106909568A (en) 2015-12-23 2015-12-23 A kind of changing method and device of data-base cluster MDL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510981264.4A CN106909568A (en) 2015-12-23 2015-12-23 A kind of changing method and device of data-base cluster MDL

Publications (1)

Publication Number Publication Date
CN106909568A true CN106909568A (en) 2017-06-30

Family

ID=59199805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510981264.4A Pending CN106909568A (en) 2015-12-23 2015-12-23 A kind of changing method and device of data-base cluster MDL

Country Status (1)

Country Link
CN (1) CN106909568A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632906A (en) * 2017-09-30 2018-01-26 北京九桥同步软件有限公司 Database data backup method and device
CN108599996A (en) * 2018-04-03 2018-09-28 武汉斗鱼网络科技有限公司 Fault handling method, device and the terminal of data-base cluster
CN108897658A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Primary database monitoring method, device, computer equipment and storage medium
CN108900572A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Primary database domain name method for handover control, computer equipment and storage medium
CN109388630A (en) * 2018-09-29 2019-02-26 北京京东金融科技控股有限公司 Database switching method, system, electronic equipment and computer-readable medium
CN110019500A (en) * 2017-08-21 2019-07-16 东软集团股份有限公司 A kind of copy group method for monitoring state, device, equipment and storage medium
CN113296804A (en) * 2020-09-01 2021-08-24 阿里云计算有限公司 Method and device for upgrading database
CN113761075A (en) * 2020-09-01 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and computer readable medium for switching databases

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102945195A (en) * 2012-11-26 2013-02-27 国电南瑞科技股份有限公司 Master-standby redundancy replication method based on SQLite databases
CN104537046A (en) * 2014-12-24 2015-04-22 北京奇虎科技有限公司 Method and device for complementing data
CN104765889A (en) * 2015-04-30 2015-07-08 北京奇虎科技有限公司 Switching method and device of high-availability frame based on database
CN104965850A (en) * 2015-04-29 2015-10-07 云南电网有限责任公司 Database high-available implementation method based on open source technology

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102945195A (en) * 2012-11-26 2013-02-27 国电南瑞科技股份有限公司 Master-standby redundancy replication method based on SQLite databases
CN104537046A (en) * 2014-12-24 2015-04-22 北京奇虎科技有限公司 Method and device for complementing data
CN104965850A (en) * 2015-04-29 2015-10-07 云南电网有限责任公司 Database high-available implementation method based on open source technology
CN104765889A (en) * 2015-04-30 2015-07-08 北京奇虎科技有限公司 Switching method and device of high-availability frame based on database

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019500A (en) * 2017-08-21 2019-07-16 东软集团股份有限公司 A kind of copy group method for monitoring state, device, equipment and storage medium
CN107632906A (en) * 2017-09-30 2018-01-26 北京九桥同步软件有限公司 Database data backup method and device
CN108599996A (en) * 2018-04-03 2018-09-28 武汉斗鱼网络科技有限公司 Fault handling method, device and the terminal of data-base cluster
CN108897658A (en) * 2018-05-31 2018-11-27 康键信息技术(深圳)有限公司 Primary database monitoring method, device, computer equipment and storage medium
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
CN108897658B (en) * 2018-05-31 2023-03-21 康键信息技术(深圳)有限公司 Method and device for monitoring master database, computer equipment and storage medium
CN109388630A (en) * 2018-09-29 2019-02-26 北京京东金融科技控股有限公司 Database switching method, system, electronic equipment and computer-readable medium
WO2020063197A1 (en) * 2018-09-29 2020-04-02 京东数字科技控股有限公司 Database switching method and system, and electronic device and computer-readable medium
CN109388630B (en) * 2018-09-29 2020-09-29 京东数字科技控股有限公司 Database switching method, system, electronic device and computer readable medium
CN113296804A (en) * 2020-09-01 2021-08-24 阿里云计算有限公司 Method and device for upgrading database
CN113761075A (en) * 2020-09-01 2021-12-07 北京沃东天骏信息技术有限公司 Method, device, equipment and computer readable medium for switching databases

Similar Documents

Publication Publication Date Title
CN106909568A (en) A kind of changing method and device of data-base cluster MDL
CN105573660B (en) Method and apparatus for improving the performance of sub-clustering disk array
US9772906B2 (en) Disaster recovery systems and methods
KR101231563B1 (en) Real time data replication
US11269902B2 (en) Time series data management method, device, and apparatus
US20170031613A1 (en) Disaster recovery systems and methods
CN104516966A (en) High-availability solving method and device of database cluster
CN105653630A (en) Data migration method and apparatus for distributed database
CN104866556B (en) Fault handling method, device and the Database Systems of database
CN104850394B (en) The management method and distributed system of distributed application program
CN109391655A (en) Service gray scale dissemination method, device, system and storage medium
CN110048896A (en) A kind of company-data acquisition methods, device and equipment
CN104516796B (en) A kind of network element backup and restoration methods and device based on command set
CN108958991A (en) Clustered node failure business quick recovery method, device, equipment and storage medium
CN110427371A (en) Server FRU field management method, device, equipment and readable storage medium storing program for executing
CN111125065A (en) Visual data synchronization method, system, terminal and computer readable storage medium
CN113343039A (en) Stock right structure diagram display method and device and electronic equipment
CN104717276A (en) Method and system for allocating data storage in network
CN115048254A (en) Simulation test method, system, equipment and readable medium of data distribution strategy
CN109684033B (en) Cloud platform bare metal management method, storage medium, electronic device and system
CN104346210B (en) The online moving method of virtual machine and system based on temporal and spatial correlations
CN105975295A (en) Application updating method and apparatus used for host cluster and server device
CN108363727A (en) A kind of date storage method and device based on ZFS file system
CN108845767B (en) Method, system, device and storage medium for cache acceleration management of volume in storage
CN109144403A (en) A kind of method and apparatus for cloud disk pattern switching

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170630

RJ01 Rejection of invention patent application after publication