CN110442650A - Database switching method, device, system, electronic equipment and storage medium - Google Patents
Database switching method, device, system, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110442650A CN110442650A CN201910732853.7A CN201910732853A CN110442650A CN 110442650 A CN110442650 A CN 110442650A CN 201910732853 A CN201910732853 A CN 201910732853A CN 110442650 A CN110442650 A CN 110442650A
- Authority
- CN
- China
- Prior art keywords
- database
- primary database
- standby
- data
- handover operation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Abstract
The invention discloses a kind of database switching method, device, system, electronic equipment and storage mediums, wherein, this method comprises: obtaining the status information of primary database and at least one standby database respectively, status information includes: data information and executive capability information;Judged whether to execute master/slave data library handover operation according to the status information of primary database;It is to execute master/slave data library handover operation in response to judging result, new primary database is selected from least one standby database according to predetermined switchover policy;According to the status information of at least one standby database of acquisition, compensation data operation is carried out to new primary database;Handover operation is executed to primary database and new primary database.By the invention it is possible to the suitably new primary database of flexible choice according to the actual situation, and pass through compensation data and operate, it is ensured that the integrality of data after handover operation.
Description
Technical field
The present invention relates to field of information processing, and in particular to a kind of database switching method, device, system, electronic equipment
And storage medium.
Background technique
With the continuous development of modern science and technology, we enter big data era.Currently, for the various daily of the record mankind
Data volume that is movable and generating is very huge, and the following data storage and processing problem also becomes increasingly conspicuous.Database, as
The electronic file cabinet of data is the indispensable important component of scientific and technological industry.
There is database to store, handle data, it is essential to consider asking for the maintainabilities such as data safety, complete
Topic.In order to ensure the integrality of data, it is usually to build at least one while establishing master library for library, utilizes Data Replication Technology in Mobile
To guarantee the consistency of active and standby library data.Do so the benefit mainly there are two aspect: first is that retaining at least a Backup Data;
Second is that possessed the standby library of partial data or most data when master library can enable when something goes wrong and continue to service, it is right
Outer service is unaffected.
With the development of electronic information hardware and software platform, magnanimity Platform Server bring is that failure occurs at any time.Therefore,
Database active-standby switch technology is always times concerned by the industry priority and difficulty, is the key that solve the problems, such as database disaster tolerance institute
In.The technology develops to and can automatically switch of today from incipient switching by hand, reduce manual intervention, reduce error rate,
It improves work efficiency.When in a set of database environment including multiple standby libraries, automation switching can face one and select standby library
The problem of, i.e., select some as new master library in multiple standby libraries.Current automatic switchover technology is in the original for selecting standby library
It is most usually then all standard with data, the automation switching method of this single solution for diverse problems can not meet simultaneously different industries, difference is answered
Demand.
Summary of the invention
In view of this, the present invention provides a kind of database switching method, device, system, electronic equipment and storage medium, with
Solve the problems, such as at least one above-mentioned referred to.
According to the first aspect of the invention, a kind of database switching method is provided, which comprises obtain main number respectively
According to the status information in library and at least one standby database, the status information includes: data information and executive capability information;Root
Judge whether to execute master/slave data library handover operation according to the status information of the primary database;It is to execute master in response to judging result
Standby database handover operation, selects new primary database from least one described standby database according to predetermined switchover policy;
The status information of at least one standby database according to acquisition carries out compensation data behaviour to the new primary database
Make;Handover operation is executed to the primary database and the new primary database.
According to the second aspect of the invention, a kind of database switching device is provided, described device includes: state information acquisition
Unit, for obtaining the status information of primary database He at least one standby database respectively, the status information includes: data
Information and executive capability information;Judging unit executes active and standby number for judging whether according to the status information of the primary database
According to library handover operation;Selecting unit, for being to execute master/slave data library handover operation in response to judging result, according to predetermined switching
Strategy selects new primary database from least one described standby database;Compensation data operating unit, for according to acquisition
At least one standby database status information, compensation data operation is carried out to the new primary database;Execute list
Member, for executing handover operation to the primary database and the new primary database.
According to the third aspect of the invention we, a kind of database switching system is provided, the system comprises: primary database, extremely
A few standby database and above-mentioned database switching device.
According to the fourth aspect of the invention, a kind of electronic equipment is provided, including memory, processor and is stored in memory
Computer program that is upper and can running on a processor, the processor realize above-mentioned database switching side when executing described program
The step of method.
According to the fifth aspect of the invention, the present invention provides a kind of computer readable storage medium, is stored thereon with calculating
The step of machine program, which realizes above-mentioned database switching method when being executed by processor.
As shown from the above technical solution, by the status information according to primary database to determine whether needing to be implemented active and standby number
According to library handover operation, when needing to be implemented handover operation, selected from standby database according to predetermined switchover policy one it is new
Primary database, also, compensation data operation is carried out to the new primary database according to the status information of standby database, compared to existing
The standby database for having the only selection data in technology most complete switches over operation, and the embodiment of the present invention can be according to the actual situation
The suitably new primary database of flexible choice, and operated by compensation data, it is ensured that the integrality of data after handover operation.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention
Some embodiments for those of ordinary skill in the art without creative efforts, can also basis
These attached drawings obtain other attached drawings.
Fig. 1 is the flow chart of database switching method according to an embodiment of the present invention;
Fig. 2 is the structural block diagram of database switching system according to an embodiment of the present invention;
Fig. 3 is the detailed block diagram of database switching system according to an embodiment of the present invention;
Fig. 4 is the structural block diagram of database switching device 3 according to an embodiment of the present invention;
Fig. 5 is the structural block diagram of compensation data operating unit 34 according to an embodiment of the present invention;
Fig. 6 is the detailed block diagram of database switching device 3 according to an embodiment of the present invention;
Fig. 7 is the exemplary diagram of database switching system according to an embodiment of the present invention;
Fig. 8 is the flow chart that example system according to an embodiment of the present invention executes handover operation;
Fig. 9 is the schematic diagram of electronic equipment according to an embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, the technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
It is usually most to be all standard with data since current master/slave data library automatic switchover technology selects the principle in standby library,
The automation switching method of this single solution for diverse problems can not meet the needs of different industries, different application simultaneously.For example, in financial row
Industry, it is various using type and its scene, therefore data safety seems particularly important, it is past for the safety and integrality for guaranteeing data
It is past to have multiple standby databases (be referred to as library), and the mode disposed is had nothing in common with each other.For different application scenarios,
Database deployment way is different, and different requirements is also had in the selection in standby library, different establish a capital is preferential selection data
Most complete standby library.
Based on this, the embodiment of the invention provides a kind of database handover schemes, to solve the above problems.
Fig. 1 is the flow chart of database switching method according to an embodiment of the present invention, as shown in Figure 1, this method comprises:
Step 101, primary database (master library can be referred to as) and the state letter of at least one standby database are obtained respectively
Breath, the status information includes: data information and executive capability information.
Step 102, judged whether to execute master/slave data library handover operation according to the status information of the primary database.
It step 103, is to execute master/slave data library handover operation in response to judging result, according to predetermined switchover policy from described
New primary database is selected at least one standby database.
Here predetermined switchover policy may include one of following: (1) selecting the one of computer room identical as the primary database
A standby database is the new primary database;(2) standby database with the primary database same city is selected
For the new primary database;Or (3) select a standby database for the new master data according to pre-set priority
Library.
Specifically, for tactful (1), in large enterprise, to prevent server from damage suddenly, powering off, suspension etc. outside
Database caused by power can not provide the problem of normal service, it will usually dispose simultaneously in same computer room and different computer rooms multiple
Standby database.With computer room, for library, all maximum probability is to possess that data are most complete, required switching for the various aspects such as network, configuration
Time shortest standby library.But the data volume for being also possible to occur a certain moment situation fewer than the standby library data volume of non-same computer room,
If just master library breaks down at this moment, automating handover mechanism according to existing default can select non-same computer room standby
Library is new master library, and this is possible to cause required switching time too long due to network speed etc. and influence externally service.For solution
The certainly problem, thus settable same computer room preferentially is switched to for library.
For tactful (2), in large enterprise, to prevent some computer room from integrally powering off, caused by the external force such as suspension
Database can not provide the problem of normal service, it will usually dispose again in the computer room of same city difference computer room and different cities multiple
Standby library.After setting preferentially switches to same city for the switchover policy in library, when master library will switch over, preferential selection is the same as city difference machine
The standby library in room is as new master library.
For tactful (3), when disposing multiple standby libraries, priority can be set to each standby library according to the actual situation,
When switching over, standby library can be selected according to the height of priority, using the standby library of highest priority as new master library.
Step 104, the status information of at least one standby database according to acquisition, to the new primary database
Carry out compensation data operation.
Specifically, the status information of at least one standby database according to acquisition, from described at least one
The database for selecting data most complete in a standby database;According to the database that the data are most complete, pass through compensation data technology
Compensation data operation is carried out to the new primary database.
Step 105, handover operation is executed to the primary database and the new primary database.
By to determine whether need to be implemented master/slave data library handover operation, working as needs according to the status information of primary database
When executing handover operation, a new primary database is selected from standby database according to predetermined switchover policy, also, according to standby
Compensation data operation is carried out to the new primary database with the status information of database, compared with the prior art in only selection data
Most full standby database switches over operation, and the embodiment of the present invention can the suitable new main number of flexible choice according to the actual situation
It is operated according to library, and by compensation data, it is ensured that the integrality of data after handover operation.
In actual operation, Agent components can also be respectively configured for primary database and at least one standby database, it should
Agent components can be used for obtaining the status information of its affiliated database.
In one embodiment, before needing to be implemented master/slave data library handover operation, handover operation can also be instructed
The affiliated Agent components of the new primary database of primary database and selection are respectively sent to, so that the help of affiliated Agent components executes
Handover operation.
In one embodiment, above-mentioned executive capability information may include the current process quantity of primary database, according to this
The current process quantity of primary database can decide whether to execute master/slave data library handover operation.Specifically, working as primary database
Current process quantity be 0 or there is currently no when process, it can be determined that need to be implemented handover operation.
In another embodiment, standard Structured Query language (SQL, Structured can be carried out to primary database
Query Language) sentence detection operation, result of that probe information also may be embodied in status information;According to the detection knot
Fruit information also can decide whether to execute master/slave data library handover operation.Specifically, when detection result information is unavailable,
Then judgement needs to be implemented handover operation.
In embodiments of the present invention, three kinds of switchover policy are provided, different scenes is applicable to, meets different need
It asks, can solve the problem of current automation handover operation is imposed uniformity without examining individual cases, also, pass through compensation data method, it is ensured that switching
The integrality of data in the process.
The embodiment of the present invention also provides a kind of database switching system, and Fig. 2 is the structural block diagram of the system, as shown in Fig. 2,
The system includes: primary database 1, at least one standby database 2 (two standby databases are shown as in figure) and database
Switching device 3.The database switching device is preferably used for realizing the method in above-described embodiment.
In actual operation, as shown in figure 3, primary database 1, at least one standby database 2 are each configured with and act on behalf of group
Part 4, the Agent components are used to obtain the status information of affiliated database, receive the switching command that database switching device is sent,
To help its affiliated database to complete handover operation.
Fig. 4 is the structural block diagram of database switching device 3, as shown in figure 4, the device includes: state information acquisition unit
31, judging unit 32, selecting unit 33, compensation data operating unit 34 and execution unit 35, in which:
State information acquisition unit 31, the state for obtaining primary database and at least one standby database respectively are believed
Breath, the status information includes: data information and executive capability information;
Judging unit 32 executes master/slave data library switching behaviour for judging whether according to the status information of the primary database
Make;
Selecting unit 33, for being to execute master/slave data library handover operation in response to judging result, according to predetermined switching plan
New primary database is slightly selected from least one described standby database, strategy specifically includes one of following:
Select a standby database of computer room identical as the primary database for the new primary database;
It selects with a standby database of the primary database same city to be the new primary database;
Selected a standby database for the new primary database according to pre-set priority.
Compensation data operating unit 34, it is right for the status information of at least one standby database according to acquisition
The new primary database carries out compensation data operation;
Execution unit 35, for executing handover operation to the primary database and the new primary database.
As seen from the above description, judging unit 32 passes through the shape of the primary database obtained according to state information acquisition unit 31
State information is to determine whether need to be implemented master/slave data library handover operation, when needing to be implemented handover operation, selecting unit 33
A new primary database, also, 34 basis of compensation data operating unit are selected from standby database according to predetermined switchover policy
The status information of standby database carries out compensation data operation to the new primary database, compared with the prior art in only selection number
Operation is switched over according to most full standby database, the embodiment of the present invention flexible choice suitably can newly be led according to the actual situation
Database, and operated by compensation data, it is ensured that the integrality of data after handover operation.
In one embodiment, executive capability information includes: the current process quantity of primary database, and judging unit 32 is specific
It can be according to the current process quantity of the primary database to determine whether executing master/slave data library handover operation.Specifically,
When the current process quantity of primary database is 0 or there is currently no when process, it can be determined that need to be implemented handover operation.
As shown in figure 5, compensation data operating unit 34 includes: selecting module 341 and data compensating operation module 342,
In:
Selecting module 341, for the status information of at least one standby database according to acquisition, from it is described at least
The database for selecting data most complete in one standby database;
Compensation data operation module 342, for the database most complete according to the data, by compensation data technology to institute
It states new primary database and carries out compensation data operation.
As shown in fig. 6, above-mentioned apparatus further include: configuration unit 36, instruction sending unit 37 and probe unit 38, in which:
Configuration unit 36, for Agent components to be respectively configured for the primary database and at least one standby database.
Instruction sending unit 37, for handover operation instruction to be respectively sent to the primary database and the new main number
According to the affiliated Agent components in library, so that affiliated Agent components execute handover operation.
Probe unit 38, for carrying out the detection operation of standard Structured Query language (SQL) sentence to the primary database,
The status information further include: detection result information.At this point, judging unit 32 is also used to: being sentenced according to the detection result information
It is disconnected whether to execute master/slave data library handover operation, be in response to the detection result information it is unavailable, then judging result is to execute
Master/slave data library handover operation.
Above-mentioned each unit, each module single can be arranged or unify setting, and the invention is not limited thereto.
Above-mentioned each unit, the specific implementation procedure of each module, may refer to the description in above method embodiment, herein not
It repeats again.
An example is given below in embodiment for a better understanding of the present invention.
Fig. 7 is the exemplary diagram of database switching system according to an embodiment of the present invention, as shown in fig. 7, the system uses one
The deployment framework of main prepare more, shows a master library (Master) in figure, three standby library (Slave).It is also provided in the system
Data harmonization center collects the relevant information for summarizing all databases, and stores the switchover policy of all customizations.It is led establishing
After standby database, before turn-on data library automation handoff functionality, first according to actual needs, select its right for each group of database
The switchover policy answered, and map information is stored in data harmonization center.
To each database, deployment acts on behalf of (Agent) component to detect its state and all relevant informations, and will visit
It surveys collection and is sent to data harmonization center.Management assembly (Manager) can obtain related from principal and subordinate's data harmonization center
All monitoring (watch) information of database, according to the state of master library to determine whether needing to carry out automation switching;When need to be into
When row automation switching, select corresponding standby library as new master library according to the state of the switchover policy of user preset and each standby library
Choice.After completing decision, Manager is sent to related Agent by far call and executes.
Fig. 8 is the flow chart that the example system executes handover operation, as shown in figure 8, the process includes:
Step 81, information is collected.
To each database, deployment Agent component detects its state and all relevant informations, and by detection result
Collection is sent to data harmonization center.Management assembly (Manager) can obtain Relational database from principal and subordinate's data harmonization center
All monitoring informations.
Step 82, active and standby library status data is obtained, database availability is judged according to master library state.
Whether management assembly (Manager) judges master library state according to the information of collection and carries out automating to cut
It changes.Specifically judgment method includes:
(1) database current process whether there is, if current process is not present, then it is assumed that database is unavailable;
(2) it periodically executes stsndard SQL sentence to database to detect, if detection result is unavailable, then it is assumed that number
It is unavailable according to library.Specific detection times, look-in frequency, detection sentence, sentence execution time can preset when program starts,
Also user's dynamic is supported to adjust.
When above-mentioned (1) and (2) both think that database is unavailable, then it is assumed that database is unavailable.
Step 83, decision switchover policy.
When that need to carry out automation switching, management assembly (Manager) obtains the switchover policy information of user preset.
Step 84, new master library is selected according to switchover policy, includes the following steps 841-844, this, which is sentenced, preferentially switches to together
For computer room is for library strategy 1.
Step 841, management assembly (Manager) is judged according to computer room for library state, if with computer room for library shape
State is good, then selects this for library as new master library.If abnormal for library state with computer room, step 842 is carried out.
Step 842, when same computer room is abnormal for library state, management assembly (Manager) automatically switches strategy to strategy
2: switching to same city for library.Management assembly (Manager) is judged according to city for library state at this time, if with city for library shape
State is good, then selects this for library as new master library.If abnormal for library state with city, step 843 is carried out.
Step 843, management assembly (Manager) selects priority most according to the priority in the good standby library of residual state
High standby library is as new master library.
Step 844, prepare to switch new master library.
Step 85, compensation data.
The new master library selected by the decision problem incomplete there may be data.At this point, management assembly (Manager) passes through
Compensation data is complete come the data for guaranteeing new master library, ensures that handoff procedure ensures that data are not lost.
Detailed process is as follows for compensation data method:
(1) database uses the deployment framework of a main prepare more.
(2) before database master library write-in affairs are submitted, it is ensured that database journal has been synchronized to multiple (for example, N/2+1)
Standby library.
(3) when database master library failure, when needing to be switched to some for library, Manager is (for example, according to maximum transaction sequence
Number) all available most total evidences for libraries of retrieval.
(4) it if to be switched standby library has lacked partial data, is copied by database journal synchronization mechanism or by file
Shellfish mode obtains the partial data of missing from the standby library for possessing most total evidence.
Step 86, switching action is executed.
After the data backoff end of new master library, management assembly (Manager) sends out the result of decision by far call
It send to the Agent component of the database, and completes by Agent component the movement that the database is promoted to new master library.It executes
After, master library switches to the database by cause barrier master library, and so far entire active-standby switch process is finished, and new master library can be right
Outer offer service.
The embodiment of the present invention can guarantee the cluster being made of N number of database instance, tolerate N-1 platform server delay machine or clothes
Business is interrupted, which still can externally provide service, will not be affected.It is monitored using Agent detection and Manager, decision
Design method may be implemented being switched fast for second grade, meet financial industry to the high request of service continuity.Also, by mentioning
For the switchover policy of customizable, the database quick automatic switching requirement of the more scenes of financial industry can satisfy.
Fig. 9 is the schematic diagram of electronic equipment according to an embodiment of the present invention.Electronic equipment shown in Fig. 9 is at general data
Manage device comprising general computer hardware structure includes at least processor 901 and memory 902.901 He of processor
Memory 902 is connected by bus 903.Memory 902 is suitable for one or more instruction or journey that storage processor 901 can be performed
Sequence.The step of one or more instruction or program are executed by processor 901 to realize above-mentioned database switching method.
Above-mentioned processor 901 can be independent microprocessor, be also possible to one or more microprocessor set.By
This, the order that processor 901 is stored by executing memory 902, thereby executing the side of embodiment present invention as described above
Method process realizes the processing for data and the control for other devices.Bus 903 links together above-mentioned multiple components,
Said modules are connected to display controller 904 and display device and input/output (I/O) device 905 simultaneously.Input/defeated
Out (I/O) device 905 can be mouse, keyboard, modem, network interface, touch-control input device, body-sensing input unit,
Printer and other devices well known in the art.Typically, input/output (I/O) device 905 passes through input/output (I/O)
Controller 906 is connected with system.
Wherein, memory 902 can store component software, such as operating system, communication module, interactive module and application
Program.Above-described each module and application program are both corresponded to complete one or more functions and be retouched in inventive embodiments
One group of executable program instructions of the method stated.
The embodiment of the present invention also provides a kind of computer readable storage medium, is stored thereon with computer program, the calculating
The step of when machine program is executed by processor to realize above-mentioned database switching method.
In conclusion the database that the embodiment of the present invention proposes a kind of customizable switchover policy automatically switches scheme, together
When additionally provide three kinds of switchover policy, be applicable to different scenes, meet the needs of different, solve current automation switching
The problem of single solution for diverse problems, still, this mode, are also encountered by the problem of not can guarantee data integrity, are based on this, and the present invention is implemented
Example also proposed compensation data scheme, with this come guarantee handoff procedure ensure data do not lose, guarantee the integrality of data.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for hardware+
For program class embodiment, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to side
The part of method embodiment illustrates.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
Although this application provides the method operating procedure as described in embodiment or flow chart, based on conventional or noninvasive
The labour for the property made may include more or less operating procedure.The step of enumerating in embodiment sequence is only numerous steps
One of execution sequence mode, does not represent and unique executes sequence.It, can when device or client production in practice executes
To execute or parallel execute (such as at parallel processor or multithreading according to embodiment or method shown in the drawings sequence
The environment of reason).
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.It is a kind of typically to realize that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, vehicle-mounted human-computer interaction device, cellular phone, camera phone, smart phone, individual
Digital assistants, media player, navigation equipment, electronic mail equipment, game console, tablet computer, wearable device or
The combination of any equipment in these equipment of person.
The terms "include", "comprise" or its any other variant in this specification embodiment are intended to nonexcludability
Include so that include a series of elements process, method, product or equipment not only include those elements, but also
Including other elements that are not explicitly listed, or further include for this process, method, product or equipment intrinsic want
Element.In the absence of more restrictions, being not precluded in process, method, product or the equipment for including the element also
There are other identical or equivalent elements.
For convenience of description, it is divided into various modules when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each module can be realized in the same or multiple software and or hardware when specification embodiment, it can also be by reality
Show the module of same function by the combination realization etc. of multiple submodule or subelement.Installation practice described above is only
Schematically, for example, the division of the unit, only a kind of logical function partition, can there is other draw in actual implementation
The mode of dividing, such as multiple units or components can be combined or can be integrated into another system, or some features can be ignored,
Or it does not execute.Another point, shown or discussed mutual coupling, direct-coupling or communication connection can be by one
The indirect coupling or communication connection of a little interfaces, device or unit can be electrical property, mechanical or other forms.
It is also known in the art that other than realizing controller in a manner of pure computer readable program code, it is complete
Entirely can by by method and step carry out programming in logic come so that controller with logic gate, switch, specific integrated circuit, programmable
Logic controller realizes identical function with the form for being embedded in microcontroller etc..Therefore this controller is considered one kind
Hardware component, and the structure that the device for realizing various functions that its inside includes can also be considered as in hardware component.Or
Person even, can will be considered as realizing the device of various functions either the software module of implementation method can be hardware again
Structure in component.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, in terms of this specification embodiment can be used complete hardware embodiment, complete software embodiment or combine software and hardware
Embodiment form.Moreover, it wherein includes computer available programs that this specification embodiment, which can be used in one or more,
Implement in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of code
The form of computer program product.
This specification embodiment can describe in the general context of computer-executable instructions executed by a computer,
Such as program module.Generally, program module includes routines performing specific tasks or implementing specific abstract data types, journey
Sequence, object, component, data structure etc..This specification embodiment can also be practiced in a distributed computing environment, in these points
Cloth calculates in environment, by executing task by the connected remote processing devices of communication network.In distributed computing ring
In border, program module can be located in the local and remote computer storage media including storage equipment.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example
Point is contained at least one embodiment or example of this specification embodiment.In the present specification, to the signal of above-mentioned term
Property statement be necessarily directed to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described
It may be combined in any suitable manner in any one or more of the embodiments or examples.In addition, without conflicting with each other, this
The technical staff in field can be by the spy of different embodiments or examples described in this specification and different embodiments or examples
Sign is combined.
The foregoing is merely the embodiments of this specification embodiment, are not limited to this specification embodiment.It is right
For those skilled in the art, this specification embodiment can have various modifications and variations.It is all in this specification embodiment
Any modification, equivalent replacement, improvement and so within spirit and principle, the right that should be included in this specification embodiment are wanted
Within the scope of asking.
Claims (20)
1. a kind of database switching method, which is characterized in that the described method includes:
The status information of primary database and at least one standby database is obtained respectively, and the status information includes: data information
With executive capability information;
Judged whether to execute master/slave data library handover operation according to the status information of the primary database;
It is to execute master/slave data library handover operation in response to judging result, according to predetermined switchover policy, at least one is spare from described
New primary database is selected in database;
The status information of at least one standby database according to acquisition carries out compensation data to the new primary database
Operation;
Handover operation is executed to the primary database and the new primary database.
2. database switching method according to claim 1, which is characterized in that at least one is spare according to acquisition
The status information of database, carrying out compensation data operation to the new primary database includes:
The status information of at least one standby database according to acquisition is selected from least one described standby database
The most full database of data;
According to the database that the data are most complete, compensation data operation is carried out to the new primary database.
3. database switching method according to claim 1, which is characterized in that the method also includes:
Agent components are respectively configured for the primary database and at least one standby database, the Agent components are for obtaining institute
Belong to the status information of database.
4. database switching method according to claim 3, which is characterized in that the primary database and the new master
Before database executes handover operation, the method also includes:
Handover operation instruction is respectively sent to the affiliated Agent components of the primary database and the new primary database, so that
Affiliated Agent components execute handover operation.
5. database switching method according to claim 1, which is characterized in that according to the status information of the primary database
Judge whether that executing master/slave data library handover operation includes:
Judged whether to execute master/slave data library handover operation, the executive capability according to the executive capability information of the primary database
Information includes: the current process quantity of the primary database.
6. database switching method according to claim 1, which is characterized in that the method also includes:
The detection operation of standard Structured Query language statement, the status information further include: detection are carried out to the primary database
Result information.
7. database switching method according to claim 6, which is characterized in that according to the status information of the primary database
Judge whether that executing master/slave data library handover operation includes:
Judged whether to execute master/slave data library handover operation according to the detection result information,
In response to the detection result information be it is unavailable, then judging result be execute master/slave data library handover operation.
8. database switching method according to claim 1, which is characterized in that according to predetermined switchover policy from it is described at least
It includes one of following that new primary database is selected in one standby database:
Select a standby database of computer room identical as the primary database for the new primary database;
It selects with a standby database of the primary database same city to be the new primary database;
Selected a standby database for the new primary database according to pre-set priority.
9. a kind of database switching device, which is characterized in that described device includes:
State information acquisition unit, it is described for obtaining the status information of primary database He at least one standby database respectively
Status information includes: data information and executive capability information;
Judging unit executes master/slave data library handover operation for judging whether according to the status information of the primary database;
Selecting unit, for being to execute master/slave data library handover operation in response to judging result, according to predetermined switchover policy from institute
It states and selects new primary database at least one standby database;
Compensation data operating unit, for the status information of at least one standby database according to acquisition, to described new
Primary database carry out compensation data operation;
Execution unit, for executing handover operation to the primary database and the new primary database.
10. database switching device according to claim 9, which is characterized in that the compensation data operating unit includes:
Selecting module, for the status information of at least one standby database according to acquisition, at least one is standby from described
With the database for selecting data most complete in database;
Compensation data operation module carries out data to the new primary database for the database most complete according to the data
Compensating operation.
11. database switching device according to claim 9, which is characterized in that described device further include:
Configuration unit, for Agent components, the agency to be respectively configured for the primary database and at least one standby database
Component is used to obtain the status information of affiliated database.
12. database switching device according to claim 11, which is characterized in that described device further include:
Instruction sending unit, for handover operation instruction to be respectively sent to the primary database and the new primary database
Affiliated Agent components, so that affiliated Agent components execute handover operation.
13. database switching device according to claim 9, which is characterized in that the judging unit is specifically used for:
Judged whether to execute master/slave data library handover operation, the executive capability according to the executive capability information of the primary database
Information includes: the current process quantity of the primary database.
14. database switching device according to claim 9, which is characterized in that described device further include:
Probe unit, for carrying out the detection operation of standard Structured Query language statement, the state letter to the primary database
Breath further include: detection result information.
15. database switching device according to claim 14, which is characterized in that the judging unit also particularly useful for:
Judged whether to execute master/slave data library handover operation according to the detection result information,
In response to the detection result information be it is unavailable, then judging result be execute master/slave data library handover operation.
16. database switching device according to claim 9, which is characterized in that the selecting unit is as follows for executing
One of:
Select a standby database of computer room identical as the primary database for the new primary database;
It selects with a standby database of the primary database same city to be the new primary database;
Selected a standby database for the new primary database according to pre-set priority.
17. a kind of database switching system, which is characterized in that the system comprises: primary database, at least one preliminary data
Database switching device described in any one of library and claim 9 to 16.
18. database switching system according to claim 17, which is characterized in that the system also includes:
The Agent components of the respectively described primary database and the configuration of at least one standby database.
19. a kind of electronic equipment including memory, processor and stores the calculating that can be run on a memory and on a processor
Machine program, which is characterized in that the processor realizes data described in any item of the claim 1 to 8 when executing described program
The step of library switching method.
20. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt
The step of processor realizes database switching method described in any item of the claim 1 to 8 when executing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910732853.7A CN110442650A (en) | 2019-08-09 | 2019-08-09 | Database switching method, device, system, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910732853.7A CN110442650A (en) | 2019-08-09 | 2019-08-09 | Database switching method, device, system, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110442650A true CN110442650A (en) | 2019-11-12 |
Family
ID=68434159
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910732853.7A Pending CN110442650A (en) | 2019-08-09 | 2019-08-09 | Database switching method, device, system, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110442650A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111125060A (en) * | 2019-12-17 | 2020-05-08 | 中国联合网络通信集团有限公司 | Database management method, system, device and storage medium |
CN111260227A (en) * | 2020-01-19 | 2020-06-09 | 深圳华锐金融技术股份有限公司 | Service data source processing method and device, computer equipment and storage medium |
CN111966520A (en) * | 2020-08-10 | 2020-11-20 | 上海中通吉网络技术有限公司 | Database high-availability switching method, device and system |
CN113452766A (en) * | 2021-06-22 | 2021-09-28 | 青岛海尔科技有限公司 | Node switching method and device, storage medium and electronic device |
CN114661827A (en) * | 2022-05-23 | 2022-06-24 | 武汉四通信息服务有限公司 | Database taking-over method and device, electronic equipment and storage medium |
CN115544147A (en) * | 2022-10-18 | 2022-12-30 | 山东水发紫光大数据有限责任公司 | Machine room data reading method, device, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066480A (en) * | 2016-12-20 | 2017-08-18 | 阿里巴巴集团控股有限公司 | Management method, system and its equipment in master/slave data storehouse |
CN108932295A (en) * | 2018-05-31 | 2018-12-04 | 康键信息技术(深圳)有限公司 | Primary database method for handover control, device, computer equipment and storage medium |
CN108984569A (en) * | 2017-06-05 | 2018-12-11 | 中兴通讯股份有限公司 | Database switching method, system and computer readable storage medium |
CN109783468A (en) * | 2018-12-04 | 2019-05-21 | 网联清算有限公司 | Database switching method and system, medium and computer system |
CN109871369A (en) * | 2018-12-24 | 2019-06-11 | 天翼电子商务有限公司 | Database switching method, system, medium and device |
-
2019
- 2019-08-09 CN CN201910732853.7A patent/CN110442650A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066480A (en) * | 2016-12-20 | 2017-08-18 | 阿里巴巴集团控股有限公司 | Management method, system and its equipment in master/slave data storehouse |
CN108984569A (en) * | 2017-06-05 | 2018-12-11 | 中兴通讯股份有限公司 | Database switching method, system and computer readable storage medium |
CN108932295A (en) * | 2018-05-31 | 2018-12-04 | 康键信息技术(深圳)有限公司 | Primary database method for handover control, device, computer equipment and storage medium |
CN109783468A (en) * | 2018-12-04 | 2019-05-21 | 网联清算有限公司 | Database switching method and system, medium and computer system |
CN109871369A (en) * | 2018-12-24 | 2019-06-11 | 天翼电子商务有限公司 | Database switching method, system, medium and device |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111125060A (en) * | 2019-12-17 | 2020-05-08 | 中国联合网络通信集团有限公司 | Database management method, system, device and storage medium |
CN111125060B (en) * | 2019-12-17 | 2023-10-31 | 中国联合网络通信集团有限公司 | Database management method, system, equipment and storage medium |
CN111260227A (en) * | 2020-01-19 | 2020-06-09 | 深圳华锐金融技术股份有限公司 | Service data source processing method and device, computer equipment and storage medium |
CN111260227B (en) * | 2020-01-19 | 2024-03-26 | 深圳华锐分布式技术股份有限公司 | Service data source processing method, device, computer equipment and storage medium |
CN111966520A (en) * | 2020-08-10 | 2020-11-20 | 上海中通吉网络技术有限公司 | Database high-availability switching method, device and system |
CN113452766A (en) * | 2021-06-22 | 2021-09-28 | 青岛海尔科技有限公司 | Node switching method and device, storage medium and electronic device |
CN113452766B (en) * | 2021-06-22 | 2023-10-24 | 青岛海尔科技有限公司 | Node switching method and device, storage medium and electronic device |
CN114661827A (en) * | 2022-05-23 | 2022-06-24 | 武汉四通信息服务有限公司 | Database taking-over method and device, electronic equipment and storage medium |
CN115544147A (en) * | 2022-10-18 | 2022-12-30 | 山东水发紫光大数据有限责任公司 | Machine room data reading method, device, equipment and storage medium |
CN115544147B (en) * | 2022-10-18 | 2023-12-08 | 山东水发紫光大数据有限责任公司 | Machine room data reading method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110442650A (en) | Database switching method, device, system, electronic equipment and storage medium | |
EP3694148B1 (en) | Configuration modification method for storage cluster, storage cluster and computer system | |
CN109033109B (en) | Data processing method and system | |
CN106557364A (en) | A kind of method of data synchronization and system | |
CN110532278B (en) | High availability method of declarative MySQL database system | |
CN105468717A (en) | Database operation method and device | |
CN110708196B (en) | Data processing method and device | |
CN111459724B (en) | Node switching method, device, equipment and computer readable storage medium | |
CN113744064B (en) | Method and apparatus for performing transactions in block link points | |
CN105745585A (en) | Offloading human-machine-interaction tasks | |
CN105337780A (en) | Server node configuration method and physical nodes | |
US20230244578A1 (en) | Managing data center failure events | |
CN111381931A (en) | Disaster recovery method, device and system | |
CN115510156A (en) | Cloud native high-availability database service providing system and method | |
CN113051110A (en) | Cluster switching method, device and equipment | |
CN109783468A (en) | Database switching method and system, medium and computer system | |
CN108958991A (en) | Clustered node failure business quick recovery method, device, equipment and storage medium | |
CN110489494A (en) | Distributed data base on-line rapid estimation method and device | |
CN115168322A (en) | Database system, main library election method and device | |
CN108390914A (en) | A kind of service update method and device, system | |
CN115203226B (en) | Distributed meter lock operation method, device and equipment | |
CN114666201B (en) | High-availability distributed micro-service architecture | |
CN115378800A (en) | Distributed fault-tolerant system, method, apparatus, device and medium without server architecture | |
CN108681558A (en) | A kind of data rewind method, apparatus and terminal | |
CN107644035B (en) | Database system and deployment method thereof |
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: 20191112 |
|
RJ01 | Rejection of invention patent application after publication |