Message processing method, system and equipment based on load-balancing technique
Technical field
The present invention relates to a kind of communication technology, relate in particular to message processing method and system and corresponding load-balancing device and routing forwarding equipment based on load-balancing technique.
Background technology
Load-balancing technique is meant and adopts one group of server zone to replace the separate unit server, this server zone is made up of with symmetric mode multiple servers, every station server all has par, all can externally provide service separately, before this server zone, increase load-balancing device, client only need be visited virtual IP address (Virtual IP the is called for short VIP) address that load-balancing device provides, and selects a station server that the technology of service is provided for client by load-balancing device by certain rule again.This technology can the balance server zone in traffic load between the Servers-all, thereby improve the performance and the responding ability of whole website, improve the efficient of server zone, reduce investment outlay.
Be illustrated in figure 1 as the network communicating system with load-balancing device, this system comprises a plurality of clients such as client 10, is connected with load-balancing device 20 and routing forwarding equipment 30 by network; Load-balancing device 20 links to each other with the server pools 40 with a plurality of servers.The VIP address of supposing load-balancing device 20 is 2.1.1.10, and default port is 80; Comprising a plurality of servers such as server 41,42 and 43, each server has 2 addresses, and one is the VIP address 2.1.1.10 identical with load-balancing device 20, and another is to be respectively 2.1.1.1 with the corresponding IP of MAC address of server address, 2.1.1.2, and 2.1.1.3; The default gateway of the server in the server pools 40 is a routing forwarding equipment 30.When supposing by client 10 transmission request messages, step is as follows:
1, client 10 sends message 1 in network, and source address is the IP address and the port one .1.1.1:1234 of client 10, and destination address is the VIP address and the port 2.1.1.10:80 of load-balancing device 20;
2, after load-balancing device 20 receives message 1, according to the destination address 2.1.1.10:80 in the heading of this message, select one in the server from server pools 40, suppose that selecting the IP address is the server 42 of 2.1.1.2, do not revise the purpose IP address in the heading, and directly message 1 is encapsulated as Ethernet message, it is message 2, the purpose MAC of this message (Media AccessControl, media interviews control) address is the MAC Address of server 42, and source MAC is the MAC Address of load-balancing device 20. this Ethernet message is directly sent to server 42;
3, after server 42 is received message 2, because of its target MAC (Media Access Control) address and purpose IP address all belong to book server, therefore can successfully insert, the request of client 10 is provided service and replys response message, promptly message 3, the source address of this message is the VIP address and the port 2.1.1.10:80 of load-balancing device 20, destination address is the address 1.1.1.1:1234 of client 10, and particularly, server 42 is searched default gateway, be routing forwarding equipment 30, will report 3 to send to routing forwarding equipment;
4, after routing forwarding equipment 30 receives message 3, search routing table, the source address that generation message 4 is transmitted to client's message 4 is 2.1.1.10:80, and destination address is 1.1.1.1:1234.
In the prior art, the port in some communication process need carry out dynamic-configuration, i.e. the port that need dispose by control connection notice client by server, and client is set up data according to this port and is connected.Be illustrated in figure 2 as the signaling diagram of FTP Passive (passive) mode, when setting up control connection, server is monitored at fixed port 21, and client is by (syn) and affirmation control connection orders such as (ack) and server are set up control connection synchronously; User end to server sends PASV (PASsiVe, passive) order, and it is in Passive Mode announcement server; Server selects an idle port (as the p1p2 port) as FPDP, and this port is entered Passive Mode by response message (as " 227EnteringPassive Mode (h1, h2, h3, h4, p1, the p2) " order among Fig. 2) notice client; After client is received and replied, set up data according to FPDP of wherein carrying and server and be connected.The selection of visual data port is dynamic, can not learn in advance for client.
The defective of prior art is: the communication process that carries out the dynamic port configuration for above-mentioned needs, load-balancing device only handle the request message that comes from client and the response message that comes from server without load-balancing device, therefore need carry out in the protocol application of dynamic port configuration at some, because which port load-balancing device does not know to have disposed in the response message, therefore the request message that mails to these ports can be judged as illegally, cause communication to proceed.Be illustrated in figure 3 as signaling diagram based on the FTP Passive mode of load-balancing technique, as can be seen from the figure, server mails to the response message of client without load-balancing device, importantly, " 227Entering PassiveMode (h1; h2; h3; h4; p1, p2) " order is without load-balancing device, so this load-balancing device does not know that server is that client has been specified dynamic port p1p2, client is judged as illegally by load-balancing device according to the message that this port sends, thereby the data link can't be created.
Summary of the invention
The problem to be solved in the present invention is: have now and can not support the dynamic port service based on the communication system of load-balancing technique.
In order to address the above problem, one embodiment of the present of invention provide a kind of message processing method based on load-balancing technique, comprise: the dynamic port agent list is set in load-balancing device in advance, and this dynamic port agent list upgrades according to the agent list updating message that comes from routing forwarding equipment; After load-balancing device receives the request message of client, judging whether the destination interface of this request message is the serve port that this equipment disposed, is then this request message to be transmitted to the server of selecting from corresponding server pools; Otherwise this request message is transmitted to the server of from described server pools, selecting according to the dynamic port agent list; Carry the dynamic port information that described routing forwarding equipment obtains in the wherein said agent list updating message from the response message that comes from described server.
In order to address the above problem, an alternative embodiment of the invention provides a kind of message handling system based on load-balancing technique, comprise client, load-balancing device, server pools and routing forwarding equipment, wherein load-balancing device is connected with server pools with communication network respectively with routing forwarding equipment, wherein
Described load-balancing device comprises,
Port module is used to judge whether the destination interface of this request message is the serve port that this equipment disposed, and judged result is sent to forwarding module; Carry the dynamic port information that described routing forwarding equipment obtains in the wherein said agent list updating message from the response message that comes from described server;
Forwarding module is used for selecting server according to judged result and dynamic port agent list, transmits request message;
The agent list module is used to preserve the dynamic port agent list and also according to the agent list updating message that comes from routing forwarding equipment the dynamic port agent list is upgraded; Carry the dynamic port information that described routing forwarding equipment obtains in the wherein said agent list updating message from the response message that comes from described server;
Described routing forwarding equipment comprises:
Message module is used for sending to load-balancing device according to the dynamic port information generation agent list updating message of response message.
In order to address the above problem, an alternative embodiment of the invention also provides a kind of load-balancing device, comprises the agent list module, port module and forwarding module, wherein:
The agent list module is used to preserve the dynamic port agent list and also according to the agent list updating message that comes from routing forwarding equipment the dynamic port agent list is upgraded;
Port module is used to judge whether the destination interface of this request message is the serve port that this equipment disposed, and judged result is sent to forwarding module;
Forwarding module is used for selecting server according to judged result and dynamic port agent list from server pools, transmits request message;
In order to address the above problem, an alternative embodiment of the invention also provides a kind of routing forwarding equipment, comprise message module, be used for sending to load-balancing device according to the dynamic port information generation agent list updating message of response message, this agent list updating message is used for the dynamic port agent list that sets in advance at described load-balancing device is upgraded; Carry the dynamic port information that described routing forwarding equipment obtains in the wherein said agent list updating message from the response message that comes from described server.
By the present invention, routing forwarding equipment and load-balancing device cooperatively interact and have realized support to dynamic port service, have enlarged the range of application of system.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Description of drawings
Fig. 1 is for having the structural representation of the network communicating system of load-balancing device in the prior art;
Fig. 2 is the signaling diagram of FTP passive mode in the prior art;
Fig. 3 is a signaling diagram of using the FTP passive mode on network communicating system shown in Figure 1;
Fig. 4 is the flow chart of the method for the invention embodiment;
Fig. 5 is the structural representation of system embodiment of the present invention.
Embodiment
The specific embodiment of the method for the invention is as follows:
Present embodiment provides a kind of message processing method based on load-balancing technique that can realize the dynamic port configuration, as shown in Figure 4,
Step 101, client sends request message by communication network to load-balancing device.Particularly, client can be in the same subnet with load-balancing device, also can be in the different sub-network, can transmit by the forwarding unit in the communication network according to prior art if be in different sub-network.
Step 102, load-balancing device judge whether the destination interface of this request message is the serve port that this equipment disposed after receiving request message, are execution in step 110 then, otherwise execution in step 120.
It needs to be noted at first to judge whether the connection under this message exists before this step, be then this request message directly to be transmitted to this to connect pairing server and do not need the consistency of port is judged herein.This is because load-balancing device can carry out record to the server of having transmitted, when receiving when belonging to same connection requests message, directly these request messages all are transmitted to the same server in the server pools, provide service by this server unification to this connection, therefore do not need each request message is all reselected server, help improving system works efficient.
Step 110 is transmitted to this request message the server of selecting from corresponding server pools.Include purpose IP address and destination interface in the request message, server pools with identical VIP address is corresponding with it, include a plurality of servers in this server pools, from server pools, select a server to send this request message according to the destination address in the heading of this request message if the serve port that load-balancing device disposed is consistent with the destination interface of this request message.
Step 120 is transmitted to this request message the server of selecting according to the dynamic port agent list.The dynamic port agent list is preserved the configuration information of dynamic port, and the form of each service list item is as shown in table 1,
Table 1
The IP address of client |
The FPDP of client |
The protocol type of data |
The IP address of destination server |
The FPDP of destination server |
If select server according to the dynamic port agent list when serve port that load-balancing device disposed and the destination interface of this request message are inconsistent, this request message mail to this server.For example, in the request message that client sends, source address is 1.1.1.1:1234, and destination address is 2.1.1.10:5678, supposes that the serve port that this moment, load-balancing device disposed is that 80 illustration purpose ports and serve port are inconsistent.The dynamic port agent list is searched, is found a service list item as shown in table 2,
Table 2
The IP address of client |
The FPDP of client |
The protocol type of data |
The IP address of destination server |
The FPDP of destination server |
1.1.1.1? |
1234? |
TCP? |
2.1.1.2? |
5678? |
This service list item explanation IP address is that the server of 2.1.1.2 has disposed the corresponding dynamic port for this request message, and load-balancing device is the server of 2.1.1.2 according to above-mentioned information with the IP address that this request message is transmitted in the server pools that the VIP address is 2.1.1.10.If in the dynamic port agent list, do not find corresponding service list item, illustrate that then this request message is an illegal request, abandons it.In addition, can also judge,, illustrate that the data connection at this request message place has finished, then delete corresponding service list item in the dynamic port agent list, to save memory space if this request message connects message for disconnecting to the kind of this request message.
After step 130, server receive the request message that comes from load-balancing device, provide service, and send response message to routing forwarding equipment to the request of client.Wherein, routing forwarding equipment can be default routing forwarding equipment, and promptly server can only be connected to external network by this routing forwarding equipment; Perhaps also can there be a plurality of routing forwarding equipment to select for server.Routing forwarding equipment in this step can be the equipment that router or three-tier switch etc. have route forwarding function.
Step 131, after routing forwarding equipment receives this response message, this response message is transmitted to corresponding client, and judge whether carry dynamic port information in this response message, be then to send the agent list updating message that carries this dynamic port information to the pairing load-balancing device of this response message.Wherein, the agent list updating message has the every content described in the table 1, and load-balancing device receives that the dynamic port agent list to this equipment upgrades after this agent list updating message.Corresponding client receives by equal to load once more according to dynamic port information wherein behind the response message of routing forwarding device forwards
It needs to be noted that herein some response message can not carry dynamic port information certainly in the prior art, normally transmit by port 21 regularly as the control message in the File Transfer Protocol and can dynamic change.Based on this, in this step, in judging response message, whether carry before the dynamic port information, also can judge whether to check the dynamic port information in this response message earlier, if do not need then directly this response message is transmitted to corresponding client, and do not need to send the agent list updating message to load-balancing device again.Thereby further overhead improves efficiency of transmission.
By the described method of present embodiment, routing forwarding equipment and load-balancing device cooperatively interact and have realized support to dynamic port service, have enlarged the range of application of system.
The specific embodiment of system of the present invention is as follows:
Present embodiment provides a kind of message handling system based on load-balancing technique.As shown in Figure 5, comprise a plurality of clients such as client 10, load-balancing device 20 includes the server pools 40 and the routing forwarding equipment 30 of a plurality of servers such as server 41,42,43.Wherein load-balancing device 20 is connected with server pools 40 with communication network respectively with routing forwarding equipment 30.Wherein load-balancing device 20 comprises port module 21, forwarding module 23 and agent list module 22; Routing forwarding equipment 30 comprises message module 31.Routing forwarding equipment 30 in the present embodiment can have the equipment of route forwarding function for router or three-tier switch etc.Below send the message processing procedure that request message is an example explanation native system with client 10.
Client 10 sends request message by communication network to load-balancing device 20.After load-balancing device 20 receives request message, port module 21 judges whether the connection under this message exists, then judged result is sent forwarding module 23 if exist, forwarding module 23 directly is transmitted to this with this request message and connects pairing server, supposes to send to the server 42 in the server pools 40; If do not have whether the destination interface of then further judging this request message is the serve port that this equipment disposed, and judged result is sent forwarding module 23.
Forwarding module 23 is selected the server forwards request message according to the judged result that comes from port module 21.Particularly, if destination interface is consistent with serve port, the server forwards request message of the selection scheme of server being selected from corresponding server pools according to existing load-balancing device then; If destination interface and serve port are inconsistent, then select server according to the dynamic port agent list of preserving in the agent list module 22, suppose that the server of selecting is a server 42, request message is transmitted to server 42.The form of the service list item in the dynamic port agent list is referring to table 1.If in the dynamic port agent list, do not find corresponding service list item, illustrate that then this request message is an illegal request, abandons it.
In addition, forwarding module 23 can also be judged the kind of this request message, if this request message connects message for disconnecting, the data connection that this request message place is described finishes, then send delete instruction to agent list module 22, agent list module 22 receives corresponding service list item in this instruction back deletion dynamic port agent list, to save memory space.
After server 42 receives the request message that comes from load-balancing device 20, provide service, and send response messages to routing forwarding equipment 30 to the request of client 10.After routing forwarding equipment 30 receives this response message, this response message is transmitted to corresponding client 10.And message module 31 judges whether carry dynamic port information in this response message, is then to generate the agent list updating message that carries this dynamic port information to send to the pairing load-balancing device 20 of this response message.Wherein the agent list updating message has the every content described in the table 1.
After load-balancing device 20 received this agent list updating message, the dynamic port agent list of preserving in 22 pairs of these modules of agent list module upgraded.
Basis dynamic port information wherein sent request messages to load-balancing device 20 once more after client 10 received the response message of being transmitted by routing forwarding equipment 30, when load-balancing device 20 was received this request message that comes from client 10 once more, forwarding module 23 can be according to the server in the selection of the service list item after the upgrading server pools 40.
It needs to be noted that herein some response message can not carry dynamic port information certainly in the prior art, normally transmit by port 21 regularly as the control message in the File Transfer Protocol and can dynamic change.Based on this, in this step, whether message module 31 carries before the dynamic port information in judging response message, also can judge whether to check the dynamic port information in this response message earlier, if do not need then directly this response message is transmitted to corresponding client 10, and do not need to send the agent list updating message to load-balancing device 20 again.Thereby can further reduce overhead, improve efficiency of transmission.
By the described system of present embodiment, routing forwarding equipment 30 and load-balancing device 20 cooperatively interact and have realized support to dynamic port service, have enlarged the range of application of system.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit and scope of technical solution of the present invention.