A kind of health detecting method and deviceTechnical field
The application relates to network communication technology field, particularly relates to a kind of health detecting method and device.
Background technology
The management of application delivery gateway device main charge server cluster, is calculated by selected load balancingThe service request of user is balancedly distributed to service server by method.But, selected by load-balancing algorithmThe server selected is likely to be due to various reasons cannot process the service request of user, and the business causing user pleaseTry to achieve less than response, it is impossible to carry out normal Business Processing.
In order to solve the problems referred to above, on application delivery gateway device, generally enable health detection process to clothesService node on business device detects, to guarantee that server is properly functioning.Prior art is for oftenOne service node is set up corresponding Socket (socket) and is connected, and is connected by Socket and initiates to access,And the response of waiting for server, thus obtain the health status of server.But, in actual applications,The multiple identical service node of same server possible configuration, if carried out for each service nodeHealth detection will result in unnecessary system resource waste.
Summary of the invention
In view of this, the application provides a kind of health detecting method and device.
Specifically, the application is achieved by the following technical solution:
The application provides a kind of health detecting method, is applied on gateway device, and described gateway device is to manyStation server carries out health detection, and described server configures multiple identical service node, the method bagInclude:
Obtain the nodal information of each service node;
According to nodal information, service node is classified;
A service node is selected to carry out health detection from each class service node;
By health detection result-sharing to other service node in same class service node.
The application also provides for a kind of health test apparatus, is applied on gateway device, described gateway device pairMultiple servers carries out health detection, and described server configures multiple identical service node, this deviceIncluding:
Acquiring unit, for obtaining the nodal information of each service node;
Taxon, for classifying to service node according to nodal information;
Detector unit, for selecting a service node to carry out health detection from each class service node;
Shared cell, for saving health detection result-sharing to other service in same class service nodePoint.
By above description it can be seen that the application is by classifying to service node, service from each classNode selects a service node carry out health detection, testing result is shared to its in same classificationIts service node, thus reduce the quantity that Socket connects, reduce system consumption, also mitigate meanwhileThe performance pressures of server end.
Accompanying drawing explanation
Fig. 1 is that server cluster manages system schematic;
Fig. 2 is a kind of health detecting method flow chart shown in the application one exemplary embodiment;
Fig. 3 is the basis of a kind of health test apparatus place equipment shown in the application one exemplary embodimentHardware architecture diagram;
Fig. 4 is the structural representation of a kind of health test apparatus shown in the application one exemplary embodiment.
Detailed description of the invention
Here will illustrate exemplary embodiment in detail, its example represents in the accompanying drawings.FollowingWhen description relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represents same or analogousKey element.Embodiment described in following exemplary embodiment does not represent the institute consistent with the applicationThere is embodiment.On the contrary, they only with as appended claims describes in detail, the one of the applicationThe example of the apparatus and method that a little aspects are consistent.
It is only merely for describing the purpose of specific embodiment at term used in this application, and is not intended to be limitingThe application." a kind of " of singulative used in the application and appended claims, " instituteState " and " being somebody's turn to do " be also intended to include most form, unless context clearly shows that other implications.Also shouldWork as understanding, term "and/or" used herein refer to and comprise one or more be associated list itemAny or all possible combination of purpose.
Although should be appreciated that may use term first, second, third, etc. various to describe in the applicationInformation, but these information should not necessarily be limited by these terms.These terms only be used for by same type of information thatThis distinguishes.Such as, in the case of without departing from the application scope, the first information can also be referred to asTwo information, similarly, the second information can also be referred to as the first information.Depend on linguistic context, as in this instituteUse word " if " can be construed to " and ... time " or " when ... time " or " responseIn determining ".
Fig. 1 show server cluster management system schematic.Wherein, PC is subscriber's main station, is used for visitingAsk server;GW is application delivery gateway device (hereinafter referred to as gateway device), is mainly responsible for serviceThe management of device cluster;Server1 and Server 2 is server, and each station server is configured with multiple phaseSame service node.Such as, the service node 1 on Server1 is identical with service node 2, and port numbers is equalBeing 80, subordinate server IP address is 1.1.1.1.In like manner, the service node 3 on Server 2, serviceNode 4 and service node 5 are identical.
In server set cluster management system, gateway device is responsible for using according to selected load-balancing algorithmThe service request at family balancedly distributes to server.In order to ensure that the server of distribution can be properly functioning,Gateway device to carry out health detection to each station server.
Prior art, when carrying out health detection, is set up with each service node by gateway deviceSocket connects, and is connected by each Socket and initiates to access, obtains the health detection result of correspondence.But, under the collocation method shown in Fig. 1, each server has multiple identical service node, asEach service node is set up Socket connection and is carried out health detection by fruit, will consume substantial amounts of system undoubtedlySystem resource.
For the problems referred to above, the embodiment of the present application proposes a kind of health detecting method, and the method is by clothesBusiness node is classified, and selects a service node to carry out health detection from each class service node, willTesting result shares to other service node in same classification, thus reduces the quantity that Socket connects,Reduce system consumption, meanwhile, also mitigate the performance pressures of server end.
Seeing Fig. 2, for an embodiment flow chart of the application health detecting method, this embodiment is to strongHealth detection process is described.
Step 201, obtains the nodal information of each service node.
Gateway device configures corresponding health detection rule for each service node in advance, and such as, this is good forHealth detected rule can be: uses TCP (Transmission Control Protocol, transmission control protocol)Mode detects.The most also other detection mode, such as UDP (User Datagram Protocol,User Datagram Protocol) mode, SLP (Service Location Protocol, Service Location Protocol) sideFormulas etc., can according to the actual requirements, the health detection rule differently configured to different service nodes.
After completing the configuration of the health detection rule to all service nodes, start health detection process, obtainTaking the nodal information of each server node, this nodal information can include health detection rule, serviceThe IP address of node subordinate server and port numbers etc..Nodal information according to the service node obtained entersRow subsequent treatment.
Step 202, classifies to service node according to nodal information.
The service node with same node point information is classified as a class, particularly as follows:
Perform following sort operation: order selects a unlabelled service node, by these unlabelled clothesBusiness vertex ticks is the execution node of current class.
Perform following vertex ticks of sharing to operate: order selects next unlabelled service node, it is judged thatThis next unlabelled service node is the most identical with the nodal information performing node of current class, ifIdentical, then this next unlabelled service node is labeled as the shared node of current class.
Judge whether that vertex ticks operation is shared in all equal executeds of unlabelled service node, if it is not, thenReturn and perform to share vertex ticks operation;The most then complete the classification to a class service node.
Judge whether the most unlabelled service node;If having, then return and perform sort operation;If nothing,Then complete the classification of all service nodes.
Step 203, selects a service node to carry out health detection from each class service node.
The service node with same node point information is classified as a class by step 202, will be configured withThe service node of identical health detection rule, same server IP address and same side slogan is classified as a class,Now, select wherein any one service node to carry out health monitoring, all can get the healthy shape of serverCondition.In a preferred embodiment, holding in each class service node after gateway device selects to sort outRow node carries out health monitoring.
Step 204, by health detection result-sharing to other service node in same class service node.
Got the health detection result of execution node by step 203 after, by each class service nodePerform node health detection result share to other service node in same class service node respectively.In a preferred embodiment, gateway device will perform the health detection result-sharing of node to sameShared node in class service node.
By foregoing description it can be seen that the application does not carry out health detection to each service node,But be first according to nodal information and sort out, then it is subordinated in multiple service nodes of same classification selectOne service node carries out health detection, and other service node in same classification shares detected serviceThe testing result of node.Thus decrease between gateway device and server the Socket for health detectionConnect quantity, reduce the system resources consumption of gateway device and server.
The most still as a example by Fig. 1, health detection process is discussed in detail.
It is assumed that gateway device GW is respectively service node 1~service node 5 configures health detection rule,Wherein, the health detection rule of service node 1 and service node 2 is TCP detection;Service node 3,The health detection rule of service node 4 and service node 5 is SLP detection.
Gateway device GW starts health detection process, obtains the nodal information of each service node, asShown in table 1.
| Nodename | Health detection rule | IP address | Port numbers |
| Service node 1 | TCP detects | 1.1.1.1 | 80 |
| Service node 2 | TCP detects | 1.1.1.1 | 80 |
| Service node 3 | SLP detects | 2.2.2.2 | 8080 |
| Service node 4 | SLP detects | 2.2.2.2 | 8080 |
| Service node 5 | SLP detects | 2.2.2.2 | 8080 |
Table 1
Above-mentioned service node is sorted out by gateway device.First, it is labeled as performing joint by service node 1Point, it is judged that service node 2 whether with the nodal information of service node 1 (health detection rule, IP address,Port numbers) identical, as shown in Table 1, service node 2 is identical with the nodal information of service node 1, because ofThis, be labeled as service node 2 sharing node.
Order judges that service node 3 is the most identical with the nodal information of service node 1, as shown in Table 1,Service node 3 differs with the nodal information of service node 1, and therefore, service node 3 cannot function as clothesThe shared node of business node 1, is not belonging to same class service node.In like manner, service node 4, service jointPoint 5 is not the shared node of service node 1.
After classifying the first time of above-mentioned service node, service node 1 and service node 2 are sameClass service node, and service node 1 is for performing node, service node 2 is for sharing node.
Starting second time classification, from table 1, order selects a unlabelled service node, i.e. services jointPoint 3, is labeled as service node 3 the execution node of current class, selects next unlabelled serviceNode, i.e. service node 4, it is judged that service node 4 is the most identical with the nodal information of service node 3,As shown in Table 1, service node 4 is identical with the nodal information of service node 3, therefore, by service nodeThe 4 shared nodes being labeled as current class.In like manner, service node 5 is labeled as sharing of current classNode.
After completing above-mentioned double classification, all service nodes are the most marked, wherein, and service node 1 HeService node 3 is for performing node, and gateway device is only set up Socket with execution node and is connected, and sends healthProbe messages carries out health detection, if server normal operation, will respond the detection of gateway device, fromAnd make gateway device confirmed service device normal operation.
Health detection result-sharing, after obtaining the health detection result performing node, is given same by gateway deviceShared node in one classification.Such as, by the health detection result-sharing of service node 1 to service node2, by the health detection result-sharing of service node 3 to service node 4 and service node 5.
Corresponding with the embodiment of aforementioned health detecting method, present invention also provides health test apparatusEmbodiment.
The embodiment of the application health test apparatus can be applied on gateway device.Device embodiment is permissibleRealized by software, it is also possible to realize by the way of hardware or software and hardware combining.Implemented in software it isExample, as the device on a logical meaning, is by the processor run memory of its place equipmentCorresponding computer program instructions is formed.For hardware view, as it is shown on figure 3, be good for for the applicationA kind of hardware structure diagram of health detection device place equipment, except the processor shown in Fig. 3, network interface,And outside memorizer, in embodiment, the equipment at device place is generally according to the actual functional capability of this equipment, alsoOther hardware can be included, this is repeated no more.
Refer to Fig. 4, for the structural representation of the health test apparatus in one embodiment of the application.ShouldHealth test apparatus includes acquiring unit 401, taxon 402, detector unit 403 and shared cell404, wherein:
Acquiring unit 401, for obtaining the nodal information of each service node;
Taxon 402, for classifying to service node according to nodal information;
Detector unit 403, for selecting a service node to carry out healthy inspection from each class service nodeSurvey;
Shared cell 404, for taking health detection result-sharing to other in same class service nodeBusiness node.
Further, described taxon 402, including:
Perform vertex ticks module, for sequentially selecting a unlabelled service node;Do not mark describedThe service node of note is labeled as the execution node of current class;
Share vertex ticks module, for sequentially selecting next unlabelled service node;Judge describedNext unlabelled service node is the most identical with the nodal information performing node of described current class;If identical, then unlabelled for described next one service node is labeled as the shared node of described current class;
Service node judge module, is used for judging whether that all equal executeds of unlabelled service node are sharedVertex ticks operates, and shares vertex ticks module if it is not, then return;The most then complete a class serviceThe classification of node;Judge whether the most unlabelled service node;If having, then return and perform vertex ticksModule;If nothing, then complete the classification of all service nodes.
Further,
Described detector unit 403, specifically for selecting the execution node in each class service node to be good forHealth detects.
Described shared cell 404, same specifically for the health detection result-sharing of described execution node is givenShared node in one class service node.
Further,
Described nodal information includes health detection rule, the IP address of service node subordinate server and endSlogan.
In said apparatus, the function of unit and the process that realizes of effect specifically refer in said method correspondingStep realize process, do not repeat them here.
For device embodiment, owing to it corresponds essentially to embodiment of the method, so relevant part ginsengSee that the part of embodiment of the method illustrates.Device embodiment described above is only schematically,The wherein said unit illustrated as separating component can be or may not be physically separate, makeesThe parts shown for unit can be or may not be physical location, i.e. may be located at a place,Or can also be distributed on multiple NE.Can select according to the actual needs part therein orThe whole module of person realizes the purpose of the application scheme.Those of ordinary skill in the art are not paying creativenessIn the case of work, i.e. it is appreciated that and implements.
The foregoing is only the preferred embodiment of the application, not in order to limit the application, all at thisWithin the spirit of application and principle, any modification, equivalent substitution and improvement etc. done, should be included inWithin the scope of the application protection.