Summary of the invention
For the automatic switchover for realizing cluster state, the influence in cluster state handoff procedure to business is reduced.The application mentions
Supply a kind of cluster state switching method, comprising:
Inquiry machine is elected from clustered machine using preset election logic;
The state of all machines in cluster is obtained using the inquiry machine elected;
Determine that the cluster state there is no when master library account status, for example, is switched to failure by the state of all machines in cluster
Switching state.
It is described that inquiry machine packet is elected from clustered machine using preset election logic in this specification embodiment
It includes:
Obtain the mark of all machines in cluster;
Conducted an election with preset election logic to the mark of acquisition, using the corresponding machine of the mark elected as
Enquiry machine.
In this specification embodiment, the mark of the machine includes: IP, domain name.
In this specification embodiment, described conducted an election with preset election logic to the mark of acquisition includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset tagmeme to identification list, determines the mark elected.
In this specification embodiment, described conducted an election with preset election logic to the mark of acquisition includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset marker element to identification list, determines the mark elected.
In this specification embodiment, the inquiry machine that the utilization elects obtains the book keeping operation shape of all machines in cluster
State includes:
The inquiry machine elected obtains the state of all machines by the service interface of machine each in cluster.
In this specification embodiment, the state of the machine includes: master library account status, for example, failover state and event
The pre- verification state of barrier switching.
In this specification embodiment, the method further include:
Determine that the state of the machine in cluster there are when master library account status, for example, is obtained using the inquiry machine cycles elected
The state of all machines in cluster;
Determine that the cluster state there is no when master library account status, for example, is switched to failure by the state of all machines in cluster
Switching state.
Meanwhile the application also provides a kind of cluster state switching device, comprising:
Enquiry module is elected, elects inquiry machine from clustered machine using preset election logic, using electing
Inquiry machine obtain cluster in all machines state;
Switching module, when determining that master library account status, for example is not present in the state of all machines in cluster, by the cluster state
It is switched to failover state.
In this specification embodiment, the election enquiry module includes:
Mark acquiring unit, for obtaining the mark of all machines in cluster;
Elect unit, for conducting an election with preset election logic to the mark of acquisition, the mark that will be elected
Corresponding machine is as enquiry machine.
In this specification embodiment, the election unit selects the mark of acquisition with preset election logic
Act includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset tagmeme to identification list, determines the mark elected.
In this specification embodiment, the election unit selects the mark of acquisition with preset election logic
Act includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset marker element to identification list, determines the mark elected.
In this specification embodiment, the cluster state switching device further include:
Judgment module, for judging the state of all machines in cluster;Wherein,
Determine that the state of the machine in cluster there are master library account status, for example, utilizes the inquiry machine cycles acquisition elected to collect
The state of all machines in group;
Determine that the cluster state there is no when master library account status, for example, is switched to failure by the state of all machines in cluster
Switching state.
Further, the application also provides a kind of computer equipment, including memory, processor and storage are on a memory simultaneously
The computer program that can be run on a processor, the processor realize preceding method when executing computer program.
This specification realizes the automatic switchover of clustered machine state, as far as possible reduction FO time, reduces the influence to business.
For above and other objects, features and advantages of the invention can be clearer and more comprehensible, preferred embodiment is cited below particularly,
And cooperate institute's accompanying drawings, it is described in detail below.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
A kind of cluster state switching method of this disclosure, as shown in Figure 1, cluster disclosed in this specification embodiment
The flow chart of state switching method, comprising:
Step S102 elects inquiry machine using preset election logic from clustered machine;
Step S104 obtains the state of all machines in cluster using the inquiry machine elected;
Step S106, determines whether the state of all machines in cluster is not present master library account status, for example;This specification is implemented
In example, the state of machine includes: that master library account status, for example, failover state and failover verify state in advance.
Judgement is to then follow the steps S108, the cluster state is switched to failover state, otherwise return step
S104。
In this specification embodiment, inquiry machine is elected from clustered machine using preset election logic includes:
Obtain the mark of all machines in cluster;Wherein, the mark of machine includes: IP, domain name;
Conducted an election with preset election logic to the mark of acquisition, using the corresponding machine of the mark elected as
Enquiry machine.
In this specification embodiment, being conducted an election with preset election logic to the mark of acquisition includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset tagmeme to identification list, determines the mark elected.I.e. to all clusters in cluster
IP be ranked up, select the corresponding machine of IP of default tagmeme, the machine as inquiry machine state.Or with preset mark
Know element to conduct an election to identification list, determines the mark elected.
In this specification embodiment, being conducted an election with preset election logic to the mark of acquisition includes:
The mark of acquisition is ranked up by ascending or descending order, generates identification list;
It is conducted an election with preset marker element to identification list, determines the mark elected.
In this specification embodiment, the account status, for example packet of all machines in cluster is obtained using the inquiry machine elected
It includes:
The inquiry machine elected obtains the state of all machines by the service interface of machine each in cluster.
In this specification embodiment altogether, in the state for determining the machine in cluster there are when master library account status, for example, choosing is utilized
The inquiry machine cycles enumerated obtain the state of all machines in cluster;
Until the cluster state is switched to when determining that master library account status, for example is not present in the state of all machines in cluster
Failover state.
In one embodiment of this specification, by election algorithm, ballot selects a machine in cluster, by the machine chosen
Cluster state inspection is completed, and pushes the realization of clustered machine state to FO.As shown in Fig. 2, being one embodiment party of this specification
The interaction schematic diagram of formula, key step are as follows:
1, each machine in cluster passes through DRM (Distributed Resource Manager, distributed resource configuration pipe
Manage device) background system opssla, the IP of all machines in cluster is obtained, the list for recording all IP address, the present embodiment are obtained
In each machine ascending sort carried out to the IP in the list by system iacctrans, in the present embodiment, ranked first tagmeme
IP as the mark selected, i.e., a machine in cluster if it find that sequence after IP list first IP, as the machine IP, then
This TV station server is considered as to the machine chosen in cluster.
2, the interface that the machine chosen is provided by opssla, it is organic by institute in the memory variable value cluster of inquiry DRM
The DRM state of device.
3, if it find that the state of all machines has been FOP or FO in cluster, then pushing cluster state is FO.
4, it otherwise, is constantly recycled, is looped through 20 times, until all machines are the state of FOP or FO by thread pool
Also become FO.This specification embodiment provides a set of convenience succinct clustered machine Voting Algorithm, and base is in this present embodiment
DRM very convenient can be realized:
(1) iopssla service interface is called, the clustered machine IP list for registering some DRM is obtained, obtains an IP character
Tandem table;
(2) ascending sort is carried out to above-mentioned IP list, obtains the IP address of the machine, first element with list after sequence
It is compared, is considered as the machine chosen if the same.
Fig. 3 is the schematic diagram of one embodiment of this specification, and the database of clustered machine is migrated by the master library of utw computer room
To the library FO of oc27 computer room, during switching, guarantee that the master library of utw computer room does not have write operation, in this process regardless of industry
Any which it is engaged in all writing master library taboo in the database manipulation of stage, step, it is ensured that not new snapshot message generates during being somebody's turn to do.
This specification embodiment overcomes in the prior art, when manual confirmation FOP state, since business is completely unavailable
, it is big to service impact, and have the defects that time-consuming, lead to remaining sum book keeping operation minute grade success rate decline.
In this specification embodiment, the machine elected is not limited to a machine, can lift a machine with multiselect, simply repair
Reelect and lift logic and can fast implement: for example, selecting with first element of list or the consistent IP of the last one element (i.e.
Using first element of IP or the last one element as preset marker element), two machines can be selected, can be subtracted significantly
It can not automatically switch shape probability of state caused by a few machine is unavailable, promote the availability of this method.It is also possible to logical
The mode for presetting the IP of selection first or second tagmeme is crossed, two machines are selected.
The embodiment of this specification provides in a kind of distributed treatment scene, the inventive schema of cluster vote by ballot, base
In above-mentioned vote by ballot scheme, realizes the automatic switchover of international account FO, greatly reduce traffic lost.
Meanwhile as shown in figure 4, a kind of cluster state switching device is also disclosed in this specification, comprising:
Enquiry module 401 is elected, inquiry machine is elected from clustered machine using preset election logic, utilizes election
Inquiry machine out obtains the state of all machines in cluster;
Switching module 402, when determining that master library account status, for example is not present in the state of all machines in cluster, by the cluster shape
State is switched to failover state.
In this specification embodiment, election enquiry module 401 includes:
Mark acquiring unit 4011, for obtaining the mark of all machines in cluster;
Unit 4012 is elected, for conducting an election with preset election logic to the mark of acquisition, by what is elected
Corresponding machine is identified as enquiry machine.
In this specification embodiment, cluster state switching device further include:
Judgment module 403, for judging the state of all machines in cluster;Wherein,
Determine that the state of the machine in cluster there are master library account status, for example, utilizes the inquiry machine cycles acquisition elected to collect
The state of all machines in group;
Determine that the cluster state there is no when master library account status, for example, is switched to failure by the state of all machines in cluster
Switching state.
Meanwhile a kind of computer equipment is also disclosed in this specification embodiment, computer equipment includes: memory, processor
And the computer program that can be run on a memory and on a processor is stored, the processor operation computer program executes such as
Lower step:
Inquiry machine is elected from clustered machine using preset election logic;
The state of all machines in cluster is obtained using the inquiry machine elected;
Determine that cluster state there is no when master library account status, for example, is switched to failover by the state of all machines in cluster
State.
Also a kind of computer readable storage medium of this specification embodiment, computer-readable recording medium storage have computer
Program, the computer program is for executing:
Inquiry machine is elected from clustered machine using preset election logic;
The state of all machines in cluster is obtained using the inquiry machine elected;
Determine that cluster state there is no when master library account status, for example, is switched to failover by the state of all machines in cluster
State.
The attainable technical effect of this method: the cluster that FOP state can be realized automatically to FO state switches, and subtracts as far as possible
Few customer account system reduces traffic lost in the time of FOP state.Based on truthful data, manual confirmation cluster state is FOP,
Then manually push cluster state time-consuming about 14 seconds, causes remaining sum book keeping operation minute grade success rate to drop to 60% or so to FO;
But pass through the automatic switchover scheme of this method, it can switch in 3 seconds or so completion clusters, remaining sum book keeping operation success rate drops to
95% or so, during greatly reducing customer account switching FO, the influence to business.
It should be noted that although describing the operation of the method for the present invention in the accompanying drawings with particular order, this is not required that
Or hint must execute these operations in this particular order, or have to carry out operation shown in whole and be just able to achieve the phase
The result of prestige.Additionally or alternatively, it is convenient to omit multiple steps are merged into a step and executed by certain steps, and/or will
One step is decomposed into execution of multiple steps.
Although this application provides the method operating procedure as described in embodiment or flow chart, based on conventional or noninvasive
The means 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, even distributed data processing environment).The terms "include", "comprise" or its any other variant are intended to contain
Lid non-exclusive inclusion, so that process, method, product or equipment including a series of elements are not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, product or equipment
Intrinsic element.In the absence of more restrictions, be not precluded include the process, method of the element, product or
There is also other identical or equivalent elements in person's equipment.
Unit, device or module that above-described embodiment illustrates etc. can specifically realize by computer chip or entity, or
It is realized by the product with certain function.For convenience of description, various modules point are divided into function when describing apparatus above
It does not describe.It certainly, when implementing the application can the function of each module is real in the same or multiple software and or hardware
It is existing, the module for realizing same function can also be realized by the combination of multiple submodule or subelement etc..Dress described above
Set that embodiment is only schematical, for example, the division of the unit, only a kind of logical function partition, in actual implementation
There may be another division manner, such as multiple units or components can be combined or can be integrated into another system or one
A little features can be ignored, or not execute.Another point, shown or discussed mutual coupling or direct-coupling or communication link
Connecing can be through some interfaces, the indirect coupling or communication connection of device or unit, can be electrical property, mechanical or other shapes
Formula.
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 application 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, programs, objects, group
Part, data structure, class etc..The application can also be practiced in a distributed computing environment, in these distributed computing environments,
By executing task by the connected remote processing devices of communication network.In a distributed computing environment, program module can
To be located in the local and remote computer storage media including storage equipment.
As seen through the above description of the embodiments, those skilled in the art can be understood that the application can
It realizes by means of software and necessary general hardware platform.Based on this understanding, the technical solution essence of the application
On in other words the part that contributes to existing technology can be embodied in the form of software products, the computer software product
It can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that a computer equipment
(can be personal computer, mobile terminal, server or the network equipment etc.) executes each embodiment of the application or implementation
Method described in certain parts of example.
Each embodiment in this specification is described in a progressive manner, the same or similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.The application can be used for crowd
In mostly general or special purpose computing system environments or configuration.Such as: personal computer, server computer, handheld device or
Portable device, laptop device, multicomputer system, microprocessor-based system, set top box, programmable electronics set
Standby, network PC, minicomputer, mainframe computer, distributed computing environment including any of the above system or equipment etc..
Although depicting the application by embodiment, it will be appreciated by the skilled addressee that the application there are many deformation and
Variation is without departing from spirit herein, it is desirable to which the attached claims include these deformations and change without departing from the application's
Spirit.