Summary of the invention
The embodiment of the invention provides a kind of method that connects, is redirected the method and the relevant device that connect, can reduce the data process load of single cluster controller relatively, promotes the performance of whole system.
For achieving the above object, embodiment of the invention specific implementation by the following technical programs:
The embodiment of the invention provides a kind of method that connects, and comprising: send connection request message to the cluster locator; Receive the connection request response message, described connection request response message carries the address information of cluster controller, and described cluster controller belongs to the highest server cluster of current health degree that described cluster locator compares; Utilize the address and the described cluster controller of described cluster controller to connect.
Preferably, described connection request response message also carries protocol type information, described address that utilizes described cluster controller and described cluster controller connect and are specially: utilize the address of described cluster controller, set up being connected of the protocol type that carries based on described connection request response message with described cluster controller.
Preferably, the corresponding transmission control protocol of the protocol type information that described connection request response message carries, described and described cluster controller is set up being specially being connected of protocol type of carrying based on described connection request response message: set up being connected based on transmission control protocol with described cluster controller.
Preferably, the corresponding HTML (Hypertext Markup Language) of the protocol type information that described connection request response message carries, described and described cluster controller is set up being specially being connected of protocol type of carrying based on described connection request response message: set up being connected based on HTML (Hypertext Markup Language) with described cluster controller.
In addition, the embodiment of the invention also provides a kind of method of redirected connection, comprising: receive the connection request message that client sends; Relatively be registered to the current health degree of the server cluster under several cluster controllers of local terminal; Send the connection request response message to described client, described connection request response message carries the address information of the cluster controller of the highest server cluster of the current health degree that compares.
Preferably, the current health degree of the server cluster under described several cluster controllers that relatively are registered to local terminal also comprises: the current health degree that obtains the server cluster under several cluster controllers that are registered to local terminal.
Preferably, described connection request response message also carries protocol type information, makes described client utilize the address of described cluster controller, sets up being connected of the protocol type that carries based on described connection request response message with described cluster controller.
In addition, the embodiment of the invention also provides a kind of client, comprising: sending module is used for sending connection request message to the cluster locator; Receiver module is used to receive the connection request response message, and described connection request response message carries the address information of cluster controller, and described cluster controller belongs to the highest server cluster of current health degree that described cluster locator compares; Connect and set up module, be used to utilize the address of described cluster controller, connect with described cluster controller.
Preferably, described connection request response message also carries protocol type information, described connection is set up module and specifically is used for: utilize the address of described cluster controller, set up being connected of the protocol type that carries based on described connection request response message with described cluster controller.
Preferably, the corresponding transmission control protocol of the protocol type information that described connection request response message carries, described connection is set up module and specifically is used for: utilize the address of described cluster controller, set up being connected based on transmission control protocol with described cluster controller.
In addition, the embodiment of the invention also provides a kind of cluster locator, comprising: receiver module is used to receive the connection request message that client sends; Comparison module relatively is registered to the current health degree of the server cluster under several cluster controllers of local terminal; Sending module is used for sending the connection request response message to described client, and described connection request response message carries the address information of the cluster controller of the highest server cluster of the current health degree that compares.
Preferably, described cluster locator also comprises acquisition module, is used to obtain the current health degree of server cluster under several cluster controllers that are registered to local terminal.
In addition, the embodiment of the invention provides a kind of network system, comprises the described cluster locator as above-mentioned embodiment.
As can be seen, the technical scheme that the embodiment of the invention adopts can be brought following beneficial effect, by in network system, increasing the cluster locator, utilize the cluster locator to realize being redirected of client connection request, in the network system a plurality of server clusters can be arranged; By comparing the health degree of each server cluster, realize each server cluster dynamic load balancing, can reduce the data process load of single cluster controller relatively, promote the performance of whole system.
Further, client and cluster controller can be set up based on being connected of variety of protocol, and realized versatile and flexiblely, can satisfy multiple needs; Network system has stronger autgmentability, can conveniently set up large-scale corporation's server cluster, is widely used.
Embodiment
The embodiment of the invention provides a kind of method that connects, is redirected the method and the relevant device that connect, by in network system, increasing the cluster locator, network system can have a plurality of server clusters, can reduce the data process load of single cluster controller relatively, promote the performance of whole system.
For make goal of the invention of the present invention, feature, advantage can be more obvious and understandable, below in conjunction with the drawings and specific embodiments technical solution of the present invention is further described in detail.
The embodiment of the invention based on the network architecture can be as shown in Figure 1, the shown network architecture comprises: several clients 110, cluster locator 120, and several server clusters 130, server cluster 130 comprises a cluster controller 131 and several server nodes 132.Client 110 can be connected with cluster locator 120 and cluster controller 131 by network; Cluster locator 120 can be connected with cluster controller 131 by network.
Embodiment one,
Referring to Fig. 2, be a kind of method flow diagram that connects that the embodiment of the invention one provides, specifically can comprise:
Step 210, send connection request message to the cluster locator;
Can regular data format of arranging message between client and the cluster locator.The cluster locator mainly is responsible for the address that client provides cluster controller, realizes being redirected of client connection request.
Step 220, reception connection request response message, described connection request response message carries the address information of cluster controller, and described cluster controller belongs to the highest server cluster of current health degree that described cluster locator compares;
The current health degree of server cluster is high more, illustrates that this server cluster is current idle more, and data-handling capacity is strong more, and client obtains the address of the cluster controller of the highest server cluster of current health degree.
Step 230, utilize the address of described cluster controller and described cluster controller to connect.
Client can be based on variety of protocol with being connected of cluster controller foundation, for example, can be based on transmission control protocol (TCP, Transfer Control Protocol) connection, based on HTML (Hypertext Markup Language) (HTTP, Hypertext Transfer Protocol) connection and based on the connection of proprietary protocol, and be not limited to this.Preferably, client is set up being connected based on TCP with cluster controller.
As can be seen,, utilize the cluster locator to realize being redirected of client connection request, in the network system a plurality of server clusters can be arranged simultaneously by in network system, increasing the cluster locator; By comparing the health degree of each server cluster, realize each server cluster dynamic load balancing, can reduce the data process load of single cluster controller relatively, promote the performance of whole system.
Embodiment two,
Present embodiment is comprehensive embodiment, referring to Fig. 3, is a kind of method flow diagram that connects control that the embodiment of the invention two provides, and specifically can comprise:
Step 301, client send connection request message to the cluster locator;
When client need connect with server cluster, send connection request message to the cluster locator earlier, the cluster locator mainly is responsible for the address that client provides cluster controller, realizes being redirected of connection request.Data format that can rule agreement message between client and the cluster locator, with convenient separately to the identification and the parsing of message.
Step 302, cluster locator relatively are registered to the current health degree of the server cluster under several cluster controllers of described cluster locator;
Each cluster controller in the network system can be registered on the cluster locator, and the mode of registration can be dynamic, also can be static.By registration, the address information of each cluster controller that the cluster locator can obtain to register, can also obtain each cluster controller connect based on protocol type etc.Data format that can rule agreement message between each cluster controller and the cluster locator, and communication protocol, with convenient separately to the identification and the parsing of message.
The cluster locator is receiving after client sends connection request message, relatively is registered to the current health degree of the server cluster under each cluster controller of local terminal, and determines the highest server cluster of current health degree.The current health degree of each server cluster can be that the cluster locator obtains in advance, the mode of obtaining can be arbitrarily, for example, can be the current health degree that is periodically reported the server cluster of its ownership by each cluster controller of registration, the cluster locator reports the mode of the current health degree of server cluster to obtain by receiving cycle; Also can be that the cluster locator is after receiving described connection request message, each cluster controller to registration sends the health degree request message, the current health degree of the server cluster of each cluster controller of acquisition request ownership, the mode of the current health degree of the server cluster of its ownership by receiving each cluster controller feedback is obtained.The current health degree of server cluster can be obtained by calculating by its corresponding cluster controller, the span of health degree can be set (for example, can be 0~100) as required, and the current health degree of server cluster is high more, represent that it is current idle more, data-handling capacity is strong more; Current health degree is low more, represents that it is current busy more, and data-handling capacity is weak more.
Step 303, cluster locator send the connection request response message to client;
The information that described connection request response message carries can comprise: the address of the cluster controller of the server cluster that the current health degree that the cluster locator compares is the highest, can also comprise client and this cluster controller connect based on protocol type information (for example, can corresponding TCP, HTTP), and the port information that connects, property value (for example, the size of transmits data packets) or the like.
Step 304, client utilize the address of described cluster controller and described cluster controller to connect;
Client is receiving after the cluster locator sends the connection request response message, can obtain the information of carrying in the described connection request response message by parsing.Client can be utilized the address of the cluster controller that carries in the described connection request response message, connects with described cluster controller.
Client and described cluster controller are set up is connected and can be based on variety of protocol, if described connection request response message carries protocol type information, then client and described cluster controller can be set up being connected of the protocol type that carries based on described connection request response message.For example, if the corresponding TCP of the protocol type information that described connection request response message carries, then client can be set up being connected based on TCP with described cluster controller; If the corresponding HTTP of the protocol type information that described connection request response message carries, then client can be set up being connected based on HTTP with described cluster controller; If corresponding certain proprietary protocol of the protocol type information that described connection request response message carries, then client can be set up based on being connected of this proprietary protocol with described cluster controller, and do not limit above-mentioned for example.
Certainly, default protocol type can also be set, client can connect with described cluster controller according to the protocol type of acquiescence.Preferably, client and described cluster controller were set up based on being connected of TCP, based on the connection of TCP can be bigger satisfying personalized needs, can also carry out strict control of authority, fail safe is higher.
If described connection request response message also carries port information, property value of connection or the like, then client can be according to corresponding ports and property value, connects and carries out session.Certainly, default port and default property value can be set equally also, client can be according to default port and default property value, connects and carries out session.
Step 305, client are carried out session by described cluster controller and respective server node.
After setting up in being connected of client and cluster controller, client can be set up by described cluster controller and respective server node, the guild's words of going forward side by side, realization client and server end alternately.
Further, if client need connect with a plurality of cluster controllers, can repeating step 301 to step 304, thereby realize client and a plurality of server clusters alternately.
As can be seen, in the present embodiment,, utilize the cluster locator to realize being redirected of client connection request, in the network system a plurality of server clusters can be arranged by in network system, increasing the cluster locator; By comparing the health degree of each server cluster, realize each server cluster dynamic load balancing, can reduce the data process load of single cluster controller relatively, promote the performance of whole system.
Further, client and cluster controller can be set up based on being connected of variety of protocol, and realized versatile and flexiblely, can satisfy multiple needs.
Accordingly, the embodiment of the invention also provides a kind of client.
Embodiment three,
Referring to Fig. 4, be a kind of client schematic diagram that the embodiment of the invention three provides, specifically can comprise:
Sending module 410 is used for sending connection request message to the cluster locator.
Can regular data format of arranging message between client and the cluster locator.The cluster locator mainly is responsible for the address that client provides cluster controller, realizes being redirected of client connection request.
Receiver module 420 is used to receive the connection request response message, and described connection request response message carries the address information of cluster controller, and described cluster controller belongs to the highest server cluster of current health degree that described cluster locator compares.
The current health degree of server cluster is high more, illustrates that this server cluster is current idle more, and data-handling capacity is strong more, and client obtains the address of the cluster controller of the highest server cluster of current health degree.
Connect and set up module 430, be used to utilize the address of described cluster controller, connect with described cluster controller.
Being connected that client and cluster controller are set up can be based on variety of protocol, for example, can be based on the connection of transmission control association, based on the connection of HTML (Hypertext Markup Language) or based on the connection of proprietary protocol, and is not limited to this.Preferably, client is set up being connected based on TCP with cluster controller.
Described connection request response message also carries protocol type information, the address that module 430 specifically can be used to utilize described cluster controller is set up in described connection, sets up being connected of the protocol type that carries based on described connection request response message with described cluster controller.
If the corresponding transmission control protocol of the protocol type information that described connection request response message carries, the address that module 430 specifically can be used to utilize described cluster controller is set up in described connection, sets up being connected based on transmission control protocol with described cluster controller.
If the corresponding HTML (Hypertext Markup Language) of the protocol type information that described connection request response message carries, the address that module 430 specifically can be used to utilize described cluster controller is set up in described connection, sets up being connected based on HTML (Hypertext Markup Language) with described cluster controller.
If the corresponding proprietary protocol of the protocol type information that described connection request response message carries, the address that module 430 specifically can be used to utilize described cluster controller is set up in described connection, set up based on being connected of this proprietary protocol, by that analogy with described cluster controller.
Described client can also comprise conversation module 440, is used for carrying out session by described cluster controller and respective server node.
Be understandable that the described function of each module of the described client of present embodiment can be according to embodiment two described method specific implementations.
Accordingly, the embodiment of the invention also provides a kind of cluster locator.
Embodiment four,
Referring to Fig. 5, be a kind of cluster locator schematic diagram that the embodiment of the invention four provides, specifically can comprise:receiver module 510,comparison module 520, sendingmodule 530.
Wherein,receiver module 510 is used to receive the connection request message that client sends.
Comparison module 520 relatively is registered to the current health degree of the server cluster under several cluster controllers of local terminal.
Sendingmodule 530 is used for sending the connection request response message to described client, and described connection request response message carries the address information of the cluster controller of the highest server cluster of the current health degree that compares.
Described cluster locator also comprisesacquisition module 540, is used to obtain the current health degree of server cluster under several cluster controllers that are registered to local terminal.
The mode that describedacquisition module 540 obtains the current health degree of server cluster can be arbitrarily, for example, can be the current health degree that is periodically reported the server cluster of its ownership by each cluster controller of registration, describedacquisition module 540 reports the mode of the current health degree of server cluster to obtain by receiving cycle; Also can be after describedreceiver module 510 receives described connection request message, describedacquisition module 540 sends the health degree request message to each cluster controller of registration, the current health degree of the server cluster of each cluster controller of acquisition request ownership, the mode of the current health degree of the server cluster of its ownership by receiving each cluster controller feedback is obtained.
Be understandable that the described function of each module of the described cluster locator of present embodiment can be according to embodiment two described method specific implementations.
Accordingly, the embodiment of the invention also provides a kind of network system.
Embodiment five,
Referring to Fig. 6, be a kind of network system schematic diagram that the embodiment of the invention five provides, specifically can compriseclient 610 andcluster locator 620.
Wherein,client 610 is used for sending connection request message tocluster locator 620; Receive the connection request response message, described connection request response message carries the address information of cluster controller, and described cluster controller belongs to the highest server cluster of current health degree that describedcluster locator 620 compares; Utilize the address and the described cluster controller of described cluster controller to connect.
Cluster locator 620 is used to receive the connection request message thatclient 610 sends; Relatively be registered to the current health degree of the server cluster under several cluster controllers of local terminal; Send the connection request response messages to describedclient 610, described connection request response message carries the address information of the cluster controller of the highest server cluster of the current health degree that compares.
Need to prove that the describedclient 610 of present embodiment can be as embodiment three described clients, the describedcluster locator 620 of present embodiment can be as embodiment four described cluster locators.
Be understandable that described client of present embodiment and the described function of cluster locator can be according to embodiment two described method specific implementations.
Accordingly, the embodiment of the invention also provides a kind of network system, and described network system comprises the four described cluster locators as embodiment, can also comprise several server clusters.
Need to prove, for aforesaid each method embodiment, for simple description, so it all is expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not subjected to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the specification all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, do not have the part that describes in detail among certain embodiment, can be referring to the associated description of other embodiment.
In sum, the technical scheme that the embodiment of the invention provides by increase the cluster locator in network system, utilizes the cluster locator to realize being redirected of client connection request, in the network system a plurality of server clusters can be arranged simultaneously; By comparing the health degree of each server cluster, realize each server cluster dynamic load balancing, can reduce the data process load of single cluster controller relatively, promote the performance of whole system.
Further, client and cluster controller can be set up based on being connected of variety of protocol, and realized versatile and flexiblely, can satisfy multiple needs; Network system has stronger autgmentability, can conveniently set up large-scale corporation's server cluster, is widely used.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of the foregoing description is to instruct relevant hardware to finish by program, this program can be stored in the computer-readable recording medium, and storage medium can comprise: ROM, RAM, disk or CD etc.
More than to a kind of method that connects that the embodiment of the invention provided, be redirected the method and the relevant device that connect and be described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.