WO2018233372A1 - 支持哈希调度策略的lvs调度方法、设备、装置及存储介质 - Google Patents

支持哈希调度策略的lvs调度方法、设备、装置及存储介质 Download PDF

Info

Publication number
WO2018233372A1
WO2018233372A1 PCT/CN2018/084470 CN2018084470W WO2018233372A1 WO 2018233372 A1 WO2018233372 A1 WO 2018233372A1 CN 2018084470 W CN2018084470 W CN 2018084470W WO 2018233372 A1 WO2018233372 A1 WO 2018233372A1
Authority
WO
WIPO (PCT)
Prior art keywords
key value
key
value
address
host
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.)
Ceased
Application number
PCT/CN2018/084470
Other languages
English (en)
French (fr)
Inventor
刘仁仕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2018233372A1 publication Critical patent/WO2018233372A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Definitions

  • the present application relates to the field of computer network technologies, and in particular, to a lvs scheduling method, apparatus, device, and storage medium that support a hash scheduling policy.
  • Lvs ie Linux Virtual Server, which represents the Linux virtual server
  • sh sice The address, that is, the source address scheduling method does not support source address consistent hash scheduling, and only selects the corresponding real server for scheduling according to the source address through the normal hash algorithm.
  • the server that is, the host
  • the real server needs to be deleted from the forwarding table. Otherwise, some clients will not be able to provide services.
  • adding new real When the server is used, the real server needs to be added to the forwarding table.
  • Current sh scheduling method real The deletion or addition of the server will cause a lot of session (ie, session) drift.
  • the purpose of the present application is to provide a lvs scheduling method, apparatus, device, and storage medium that support a hash scheduling policy, and aim to solve the problem of deleting a host when the sh scheduling method is used in the prior art. Adding a problem that causes a lot of session drift.
  • An lvs scheduling method supporting a hash scheduling policy comprising the following steps:
  • IP addresses of multiple hosts Obtaining IP addresses of multiple hosts, performing hash operations on each host's IP address one by one to obtain a corresponding first key value, and placing the first key value in an annular space of a specified size;
  • the data packet is sent by using a host corresponding to the minimum value among the plurality of first key values as the destination address.
  • An lvs scheduling device supporting a hash scheduling policy wherein the lvs scheduling device supporting the hash scheduling policy includes a processor, a memory, and a communication bus;
  • the communication bus is used to implement connection communication between a processor and a memory
  • the processor is configured to execute an lvs scheduler that supports a hash scheduling policy stored in the memory to implement the following steps:
  • IP addresses of multiple hosts Obtaining IP addresses of multiple hosts, performing hash operations on each host's IP address one by one to obtain a corresponding first key value, and placing the first key value in an annular space of a specified size;
  • the data packet is sent by using a host corresponding to the minimum value among the plurality of first key values as the destination address.
  • a storage medium wherein the storage medium stores one or more programs, the one or more programs may be executed by one or more processors to implement the lvs scheduling method supporting the hash scheduling policy A step of.
  • An lvs scheduling device supporting a hash scheduling policy includes:
  • the first hash module is configured to obtain the IP addresses of the multiple hosts, perform hash operations on each host, and obtain a corresponding first key value, and place the first key value in a circular space of a specified size. ;
  • a second hash module configured to obtain a source address of the data packet, and perform a hash operation on the source address of the data packet to obtain a second key value
  • a determining module configured to obtain a minimum value of the plurality of first key values stored in the annular space, and determine whether a minimum value of the plurality of first key values is greater than a second key value
  • a sending module configured to: when the minimum value of the plurality of first key values is greater than the second key value, send the data packet by using a host corresponding to the minimum value of the plurality of first key values as the destination address.
  • the beneficial effects when a host is connected to the Nginx physical server, the connection scheduled to the adjacent hash node is drifted to the joined host; When a host exits, the session scheduled to other hosts does not drift. Only the sessions on the host that is scheduled to be logged out are redistributed, which reduces session drift and improves the quality of load balancing services.
  • FIG. 1 is a flowchart of a preferred embodiment of a lvs scheduling method supporting a hash scheduling policy according to the present application.
  • FIG. 2 is a flowchart of step S100 in the lvs scheduling method supporting the hash scheduling policy according to the present application.
  • FIG. 3 is a flowchart of step S400 in the preferred embodiment of the lvs scheduling method supporting the hash scheduling policy according to the present application.
  • FIG. 4 is a schematic diagram of a running environment of a preferred embodiment of a lvs scheduling program supporting a hash scheduling policy according to the present application.
  • FIG. 5 is a functional block diagram of a preferred embodiment of a lvs scheduling program supporting a hash scheduling policy according to the present application.
  • the present application provides a lvs scheduling method, device, and storage medium that support a hash scheduling policy. To clarify the purpose, technical solutions, and effects of the present application, the present application will be further described in detail below with reference to the accompanying drawings. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
  • FIG. 1 is a flowchart of a preferred embodiment of a lvs scheduling method supporting a hash scheduling policy according to the present application.
  • the lvs scheduling method supporting a hash scheduling policy includes the following steps:
  • step S100 the IP addresses of the multiple hosts are obtained, and the IP address of each host is hashed one by one to obtain a corresponding first key value, and the first key value is placed in a circular space of a specified size.
  • the host is not selected according to the source address to perform scheduling, but the IP address of the host is hashed to obtain the first key value.
  • the IP address of Host 1 is 192.168.1.100
  • the IP address of Host 2 is 192.168.1.101
  • the IP address of Host 3 is 192.168.
  • the first key value is in the same hash space as the host.
  • the hash ring is not changed.
  • the hash value of the object is calculated, it can be quickly located in the corresponding machine, so that the real storage location of the object can be found.
  • Step S200 Obtain a source address of the data packet, and perform a hash operation on the source address of the data packet to obtain a second key value.
  • the source address of the data packet is directly hashed, that is, the operation of hash (Packet.source_ip) is performed to obtain the second key value.
  • the second key value obtained is not deployed in the ring space (ie, the hash ring), but as an intermediate value for addressing.
  • Step S300 Obtain a minimum value of the plurality of first key values stored in the annular space, and determine whether a minimum value of the plurality of first key values is greater than a second key value.
  • the minimum value of the plurality of first key values stored in the annular space is obtained first, that is, the operation of MIN ⁇ hash(RealServer.ip) ⁇ is performed, and after the MIN ⁇ hash(RealServer.ip) ⁇ is obtained, Compared with hash (Packet.source_ip) (ie, the second key value), this comparison determines the direction of the destination address.
  • Step S400 When the minimum value of the plurality of first key values is greater than the second key value, the data packet is sent by using a host corresponding to the minimum value among the plurality of first key values as the destination address.
  • step S400 if it is determined that the minimum value of the plurality of first key values is greater than the second key value, the host corresponding to MIN ⁇ hash(RealServer.ip) ⁇ is obtained, and the IP address corresponding to the host is used as the destination address. The packet is sent here according to the destination address. In this way, when a host is connected to the Nginx physical server, the connection to the neighboring hash node is drifted to the joined host, which does not cause a large amount of session drift and improves the quality of the load balancing service.
  • the step S100 includes:
  • Step S101 Obtain an IP address of multiple hosts, and perform a hash operation on each host's IP address to obtain a corresponding first key value.
  • Step S102 Obtain an address number of ipv4, and set an annular space by using twice the value of the number of addresses of ipv4 as a space size;
  • Step S103 placing the first key value in the annular space.
  • the number of acquired hosts may be 0, or may be a positive integer greater than 0.
  • the IP address of each host is obtained, and the IP address of each host is hashed to obtain the first key value.
  • the key values obtained by hashing the IP addresses of multiple hosts are different, that is, each key value is unique, ensuring that subsequent addressing is not an error.
  • step S102 in order to ensure that there are enough nodes in the annular space, it is necessary to at least ensure that the size of the annular space is twice the number of addresses of ipv4. This saves a lot of space compared with the circular space of 232-1 when sh scheduling is used in the prior art, and meets the basic requirements of scheduling with a minimum space size.
  • the double value of the number of addresses of the ipv4 is selected as the space size of the ring space, because the IP address format of the host is ipv4.
  • the double value of the number of addresses of ipv6 can also be selected as the space size of the ring space.
  • step S103 when a plurality of first key values are to be placed in the annular space, the annular space is sequentially inserted in a clockwise direction in a sequential order obtained according to the first key value.
  • the hash remainder algorithm is used.
  • the most uncomfortable place is that after the addition or deletion of the machine, a large number of object storage locations are invalidated, which greatly fails to satisfy the monotony.
  • the processing method based on the consistent hash algorithm adopted in steps S101-S103 can effectively satisfy the individuality compared with the ordinary sh scheduling method.
  • KEY4 is obtained through the corresponding hash algorithm and mapped to the hash ring.
  • object2 is migrated to NODE4, and other objects maintain the original storage location.
  • the consistency hash algorithm keeps the monotonicity while the data migration is minimal. Such an algorithm is very suitable for distributed clusters, avoiding a lot of data migration. , reducing the pressure on the server.
  • the step S400 shown includes:
  • Step S401 When the minimum value of the plurality of first key values is greater than the second key value, the minimum value of the plurality of first key values is recorded as the first minimum key value, and the host corresponding to the first minimum key value is obtained;
  • Step S402 Obtain an IP address of the host corresponding to the first minimum key value.
  • Step S403 Send the data packet to the destination address by using the IP address of the host corresponding to the first minimum key value as the destination address, and forward the data packet by the host.
  • the method further includes:
  • Step S10 The host connects to the Nginx physical server by using Http and reverse proxy mode; wherein the Nginx physical server is IMAP/POP3/SMTP Server.
  • step S10 includes:
  • LXC1-LXC8 in Nginx physical servers are connected to PF1-1 using VF1-VF8 respectively, and LXC1-LXC8 is also connected to PF1-2 using VF1-VF8 respectively;
  • LXC9- LXC16 is connected to PF2-1 by VF1-VF8 respectively.
  • LXC9-LXC16 is also connected to PF2-2 by VF1-VF8 respectively;
  • PF1-1 and PF2-1 are VLANs.
  • the External interface that is, the external virtual LAN interface
  • PF1-2, and PF2-2 are all VLAN Internal interfaces (that is, internal virtual LAN interfaces).
  • Nginx physical server and IPSV are connected through the back-end server load balancer IPVS-DR;
  • IPSV establishes BGP through Real IP and Tor Peer, and publishes the host route of the VIP, forms ECMP (ie, equivalent route) and connects with the CXP switch.
  • the CXP switch receives the connection request from the external network client. In the above manner, lvs load balancing is implemented.
  • the address of each ipv4 in the ring space corresponds to one node, and each node is copied to obtain a corresponding virtual node.
  • virtual node (virtual Node) is the actual node (machine) in the hash
  • an actual node corresponds to a number of "virtual nodes”
  • the corresponding number also becomes the number of "copy”
  • the "virtual node” is in the hash Spaces are arranged in hash values.
  • the hash calculation of the virtual node can adopt the manner of the IP address of the corresponding node plus a digital suffix. For example, suppose the IP address of NODE1 is 192.168.1.100. Calculate before introducing "virtual node” The hash value of cache A: Hash ("192.168.1.100");
  • the present application further provides an lvs scheduling device that supports a hash scheduling policy.
  • the lvs scheduling device supporting the hash scheduling policy includes a processor 11, a memory 12, and a communication bus;
  • the communication bus is used to implement connection communication between a processor and a memory
  • the processor is configured to execute an lvs scheduler that supports a hash scheduling policy stored in the memory to implement the following steps:
  • IP addresses of multiple hosts Obtaining IP addresses of multiple hosts, performing hash operations on each host's IP address one by one to obtain a corresponding first key value, and placing the first key value in an annular space of a specified size;
  • the data packet is sent by using a host corresponding to the minimum value among the plurality of first key values as the destination address.
  • the lvs scheduler 10 supporting the hash scheduling policy is installed and runs in the electronic device 1.
  • the electronic device 1 may be a computing device such as a desktop computer, a notebook, a palmtop computer, or a server.
  • the electronic device 1 may include, but is not limited to, a memory 11, a processor 12, and a display 13.
  • Figure 4 shows only the electronic device 1 with components 11-13, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
  • the memory 11 may be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1, in some embodiments.
  • the memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (Smart Media Card, SMC), Secure Digital (SD) card, flash card (Flash) Card) and so on.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 is configured to store application software and various types of data installed in the electronic device 1, such as the program code of the lvs scheduler supporting the hash scheduling policy.
  • the memory 11 can also be used to temporarily store data that has been output or is about to be output.
  • the processor 12 may be a central processing unit (Central Processing Unit) in some embodiments.
  • the display 13 may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic) in some embodiments. Light-Emitting Diode, organic light emitting diodes), etc.
  • the display 13 is used to display information processed in the electronic device 1 and a user interface for displaying visualization, such as an application menu interface, an application icon interface, and the like.
  • the components 11-13 of the electronic device 1 communicate with one another via a system bus.
  • the processor is further configured to execute the lvs scheduler 10 supporting the hash scheduling policy to implement the following steps:
  • the first key value is placed in the annular space.
  • the processor is further configured to execute the lvs scheduler 10 supporting the hash scheduling policy to implement the following steps:
  • the minimum value of the plurality of first key values is greater than the second key value, the minimum value of the plurality of first key values is recorded as the first minimum key value, and the host corresponding to the first minimum key value is obtained;
  • the processor is further configured to execute the lvs scheduler 10 supporting the hash scheduling policy to implement the following steps:
  • the host connects to the Nginx physical server through Http and reverse proxy; wherein the Nginx physical server is an IMAP/POP3/SMTP server.
  • FIG. 5 is a functional block diagram of a preferred embodiment of the lvs scheduler 10 that supports the hash scheduling policy.
  • the lvs scheduler 10 supporting the hash scheduling policy includes at least one computer program instruction segment, which may be divided into one or more modules based on different functions implemented by the respective parts.
  • One or more modules are stored in the memory 11 and executed by one or more processors (the processor 12 in this embodiment) to perform the hash scheduling policy support of the embodiments of the present application.
  • Lvs scheduling method For example, in FIG.
  • the lvs scheduler 10 supporting the hash scheduling policy includes a first obtaining module 21, a second obtaining module 22, a determining module 23, and a destination address obtaining module 24; wherein, the first obtaining module 21 For obtaining the IP addresses of multiple hosts, hashing each host's IP address one by one to obtain a corresponding first key value, and placing the first key value in a ring space of a specified size; the second acquiring module 22, for obtaining a source address of the data packet, and performing a hash operation on the source address of the data packet to obtain a second key value; the determining module 23 is configured to obtain a minimum value of the plurality of first key values stored in the annular space, And determining whether the minimum value of the plurality of first key values is greater than the second key value; the destination address obtaining module 24, configured to: when the minimum value of the plurality of first key values is greater than the second key value, the multiple first key The host corresponding to the minimum value of the value transmits the data packet as the destination address.
  • IP addresses of multiple hosts Obtaining IP addresses of multiple hosts, performing hash operations on each host's IP address one by one to obtain a corresponding first key value, and placing the first key value in an annular space of a specified size;
  • the data packet is sent by using a host corresponding to the minimum value among the plurality of first key values as the destination address.
  • the step of obtaining the IP address of the multiple hosts, performing the hash operation on each host's IP address to obtain the corresponding first key value, and placing the first key value in the annular space of the specified size includes:
  • the first key value is placed in the annular space.
  • the specific implementation is the same as the previous embodiment, and details are not described herein again.
  • the step of transmitting the data packet by using the host corresponding to the minimum value of the plurality of first key values as the destination address includes:
  • the minimum value of the plurality of first key values is greater than the second key value, the minimum value of the plurality of first key values is recorded as the first minimum key value, and the host corresponding to the first minimum key value is obtained;
  • the host connects to the Nginx physical server through Http and reverse proxy; wherein the Nginx physical server is IMAP/POP3/SMTP Server.
  • the Nginx physical server is IMAP/POP3/SMTP Server.
  • each ipv4 in the ring space corresponds to one node, and each node is copied to obtain a corresponding virtual node.
  • the specific implementation is the same as the previous embodiment, and details are not described herein again.
  • the present application further provides a storage medium (and a computer readable storage medium).
  • the storage medium stores one or more programs, and the one or more programs may be executed by one or more processors to implement the steps of the lvs scheduling method supporting the hash scheduling policy.
  • the lvs scheduling device that supports the hash scheduling policy is further provided by the lvs scheduling device that supports the hash scheduling policy, and the lvs scheduling device that supports the hash scheduling policy includes:
  • the first obtaining module is configured to obtain an IP address of the plurality of hosts, perform a hash operation on each host's IP address, and obtain a corresponding first key value, and place the first key value in an annular space of a specified size;
  • a second acquiring module configured to obtain a source address of the data packet, and perform a hash operation on the source address of the data packet to obtain a second key value
  • a determining module configured to obtain a minimum value of the plurality of first key values stored in the annular space, and determine whether a minimum value of the plurality of first key values is greater than a second key value
  • the destination address obtaining module is configured to: when the minimum value of the plurality of first key values is greater than the second key value, send the data packet by using a host corresponding to the minimum value of the plurality of first key values as the destination address.
  • the first obtaining module includes:
  • a hash unit configured to obtain IP addresses of multiple hosts, and perform hash operations on each host's IP address to obtain a corresponding first key value
  • the first obtaining unit is configured to obtain the number of addresses of the ipv4, and set an annular space by using twice the value of the number of addresses of the ipv4;
  • a setting unit for placing the first key value in the annular space.
  • the destination address obtaining module includes:
  • a second acquiring unit configured to: when the minimum value of the plurality of first key values is greater than the second key value, record the minimum value of the plurality of first key values as the first minimum key value, and obtain the first minimum key The value corresponds to the host;
  • a third acquiring unit configured to acquire an IP address of the host corresponding to the first minimum key value
  • a sending unit configured to send the data packet to the destination address by using an IP address of the host corresponding to the first minimum key value as the destination address.
  • the lvs scheduling device that supports the hash scheduling policy further includes:
  • connection module configured to connect to the Nginx physical server by using a Http and a reverse proxy mode; wherein the Nginx physical server is an IMAP/POP3/SMTP Server.
  • the embodiments of the lvs scheduling device that support the hash scheduling policy are substantially the same as the corresponding embodiments of the lvs scheduling method that supports the hash scheduling policy, and therefore are not described here.
  • the lvs scheduling method, device, device, and storage medium supporting the hash scheduling policy provided by the present application when a host is connected to the Nginx physical server, schedules connection drift to the adjacent hash node. To join the host; when a host exits, the session scheduled to other hosts will not drift, and only the sessions on the host that is scheduled to exit will be redistributed, which reduces session drift and improves the quality of load balancing services.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请提供了支持哈希调度策略的lvs调度方法、设备、装置及存储介质,方法包括:获取多个主机的IP,以每一主机的IP一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;获取数据包的源地址,并以该源地址进行哈希运算得到第二key值;获取环形空间中多个第一key值中最小值,并判断该最小值是否大于第二key值;当是时,则以该最小值对应的主机作为目的地址发送所述数据包。本申请实现了降低会话漂移,提升负载均衡服务质量。

Description

支持哈希调度策略的lvs调度方法、设备、装置及存储介质
本申请要求于2017年06月22日提交中国专利局、申请号为201710481690.0、发明名称为“支持哈希调度策略的lvs调度方法、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机网络技术领域,尤其涉及支持哈希调度策略的lvs调度方法、装置、设备及存储介质。
背景技术
lvs(即Linux Virtual Server,表示Linux虚拟服务器)的sh(souce address,即源地址)调度方法不支持源地址一致性hash调度,仅通过普通的hash算法根据源地址选择相应real server进行调度。当某台real server(即主机)宕机时,需要将real server从转发表中删除,否则将出现无法为部分客户端提供服务。当新添加real server时,需要将该real server加到转发表中。当前的sh调度方法下,real server的删除或者添加会引起大量的session(即会话)漂移。
因此,现有技术还有待于改进和发展。
发明内容
鉴于上述现有技术的不足之处,本申请的目的在于提供支持哈希调度策略的lvs调度方法、装置、设备及存储介质,旨在解决现有技术中采用sh调度方法时,主机的删除或者添加会引起大量的会话漂移的问题。
为了达到上述目的,本申请采取了以下技术方案:
一种支持哈希调度策略的lvs调度方法,其中,所述方法包括以下步骤:
获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
一种支持哈希调度策略的lvs调度设备,其中,所述支持哈希调度策略的lvs调度设备包括处理器、存储器及通信总线;
所述通信总线用于实现处理器和存储器之间的连接通信;
所述处理器用于执行存储器中存储的支持哈希调度策略的lvs调度程序,以实现以下步骤:
获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
一种存储介质,其中,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现所述的支持哈希调度策略的lvs调度方法的步骤。
一种支持哈希调度策略的lvs调度装置,所述支持哈希调度策略的lvs调度装置包括:
第一哈希模块,用于获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
第二哈希模块,用于获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
判断模块,用于获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
发送模块,用于当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
有益效果:本申请提供的支持哈希调度策略的lvs调度方法、设备及存储介质,当有某个主机连接到Nginx物理服务器上时,调度到相邻hash节点上的连接漂移到加入的主机;当有某个主机退出时,调度到其他主机的会话不会漂移,只有调度到退出的主机上的会话会重新分布,实现了降低会话漂移,提升负载均衡服务质量。
附图说明
图1为本申请所述的支持哈希调度策略的lvs调度方法较佳实施例的流程图。
图2为本申请所述的支持哈希调度策略的lvs调度方法中步骤S100的流程图。
图3为本申请所述的支持哈希调度策略的lvs调度方法较佳实施例中步骤S400的流程图。
图4为本申请所述的支持哈希调度策略的lvs调度程序较佳实施例的运行环境示意图。
图5为本申请所述的支持哈希调度策略的lvs调度程序较佳实施例的功能模块图。
具体实施方式
本申请提供支持哈希调度策略的lvs调度方法、设备及存储介质,为使本申请的目的、技术方案及效果更加清楚、明确,以下参照附图并举实施例对本申请进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
请参阅图1,是本申请所述的支持哈希调度策略的lvs调度方法较佳实施例的流程图。如图1所示,所述支持哈希调度策略的lvs调度方法,包括以下步骤:
步骤S100、获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中。
本实施例中,获取了主机的IP地址后,并不是与现有sh调度方法一样先根据源地址选择相应主机进行调度,而是先对主机的IP地址进行哈希运算,得到第一key值。例如有4台主机,分别记为主机1、主机2、主机3和主机4,其中主机1的IP地址为192.168.1.100,主机2的IP地址为192.168.1.101,主机3的IP地址为192.168.1.102,主机4的IP地址为192.168.1.104;分别对3台主机的IP地址进行哈希运算,并得到对应的第一key值,具体的Hash(“192.168.1.100”)=key1、Hash(“192.168.1.101”)=key2、Hash(“192.168.1.102”)=key3、Hash(“192.168.1.103”)=key4,得到的key1、key2、key3和key4都为第一key值;将上述key1、key2、key3和key4都映射到一个环形空间中,然后以顺时针的方向计算将所有的第一key值存储到离自己最近的主机中。
可以看出,第一key值与主机处于同一个哈希空间中。在这样的部署环境中,哈希环是不会更改的,只要算出了对象的hash值就能快速的定位到对应的机器中,这样就能找到对象真正的存储位置了。
步骤S200、获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
同样的,本实施例中,在获取了数据包的源地址之后,直接对数据包的源地址进行哈希运算,即进行hash(Packet.source_ip)的运算,得到第二key值。获取的第二key值并不是部署到环形空间(即哈希环)中,而是作为一个寻址用的中间值。
步骤S300、获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值。
在本实施例中,先获取环形空间中所存储多个第一key值中最小值,即进行MIN{hash(RealServer.ip)}的运算,当得到了MIN{hash(RealServer.ip)}后与hash(Packet.source_ip)(即第二key值)进行比较,这一比较结果决定了目的地址的选定方向。
步骤S400、当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
在步骤S400中,若判断了多个第一key值中最小值大于第二key值时,则获取MIN{hash(RealServer.ip)}对应的主机,并以该主机对应的IP地址作为目的地址,数据包根据该目的地址向此处发送。这样,实现了当有某个主机连接到Nginx物理服务器上时,调度到相邻hash节点上的连接漂移到加入的主机,不会引发大量的会话漂移,提升负载均衡服务质量。
优选的,如图2所示,所述步骤S100包括:
步骤S101、获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
步骤S102、获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
步骤S103、将第一key值置于所述环形空间中。
在步骤S101中,所获取的主机个数可能为0,也可能是大于0的正整数。当有至少一个主机与Nginx物理服务器连接时,则获取每一主机的IP地址,并将每一主机的IP地址都进行哈希运算得到第一key值。这样,多个主机的IP地址经哈希运算得到的key值均不一样,也就是每个key值都是唯一的,确保了后面的寻址不会出错。
在步骤S102中,为了确保环形空间中有足够的节点,需至少保证环形空间的大小是ipv4的地址个数的两倍。这与现有技术中采用sh调度时采用232-1的环形空间相比,节省了很多空间大小,以最小的空间大小满足了调度的基本需求。本实施中选择ipv4的地址个数的两倍值作为环形空间的空间大小,是因为目前主机的IP地址格式是ipv4。显然,当主机的IP地址为ipv6的格式,同样可以选择ipv6的地址个数的两倍值作为环形空间的空间大小。
而在步骤S103中,当有多个第一key值需置于所述环形空间中时,是按照第一key值得到的先后顺序,按照顺时针方向依次插入所述环形空间。
普通的sh调度方法中,采用的是hash求余算法,其最为不妥的地方就是在有机器的添加或者删除之后会照成大量的对象存储位置失效,这样就大大的不满足单调性了。基于步骤S101-S103的所采用的基于一致性哈希算法的处理方式,与普通的sh调度方法相比,能有效满足单独性。
以上面4台主机的例子继续举例说明。如果按照顺时针的方向,将key1存储到哈希环中的NODE1,将key3存储到哈希环中的NODE2,将key2和key4存储到哈希环中的NODE3,如果NODE2出现故障被删除了,那么按照顺时针迁移的方法,object3将会被迁移到NODE3中,这样仅仅是object3的映射位置发生了变化,其它的对象没有任何的改动。
如果往集群中添加一个新的节点NODE4,通过对应的哈希算法得到KEY4,并映射到哈希环中。通过按顺时针迁移的规则,那么object2被迁移到了NODE4中,其它对象还保持这原有的存储位置。通过对节点的添加和删除的分析,一致性哈希算法在保持了单调性的同时,还是数据的迁移达到了最小,这样的算法对分布式集群来说是非常合适的,避免了大量数据迁移,减小了服务器的的压力。
优选的,如图3所示,所示步骤S400包括:
步骤S401、当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
步骤S402、获取与第一最小key值对应主机的IP地址;
步骤S403、以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址,并由该主机转发所述数据包。
优选的,在所述支持哈希调度策略的lvs调度方法中,所述步骤S100之前还包括:
步骤S10、主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
更具体的,所述步骤S10包括:
1)Nginx物理服务器(即高性能的HTTP和反向代理服务器)中的LXC1-LXC8分别使用VF1-VF8连接至PF1-1,LXC1-LXC8还分别使用VF1-VF8连接只PF1-2;LXC9-LXC16分别使用VF1-VF8连接至PF2-1,LXC9-LXC16还分别使用VF1-VF8连接只PF2-2;其中PF1-1和PF2-1为VLAN External接口(即外部虚拟局域网接口)、PF1-2、PF2-2均为VLAN Internal接口(即内部虚拟局域网接口)
2)Nginx物理服务器与IPSV(即IP虚拟服务器)通过后端服务器负载均衡器IPVS-DR连接;
3、)IPSV通过Real IP与Tor建立BGP Peer,并发布VIP的主机路由,形成ECMP(即等价路由)后与CXP交换机连接,CXP交换机接收来自外网客户端的连接请求。通过上述方式,来实现lvs负载均衡。
优选的,在所述支持哈希调度策略的lvs调度方法中,所述环形空间中每一ipv4的地址对应一个节点,每一节点均复制得到一个对应的虚拟节点。在一致性哈希算法中,为了尽可能的满足平衡性,其引入了虚拟节点。“虚拟节点”(virtual node)是实际节点(机器)在 hash 空间的复制(replica),一实际个节点(机器)对应了若干个“虚拟节点”,这个对应个数也成为“复制个数”,“虚拟节点”在 hash 空间中以hash值排列。通过虚拟节点的引入,对象的分布就比较均衡了。虚拟节点的hash计算可以采用对应节点的IP地址加数字后缀的方式。例如假设NODE1的IP地址为192.168.1.100。引入“虚拟节点”前,计算 cache A 的 hash 值:Hash(“192.168.1.100”);
引入“虚拟节点”后,计算“虚拟节”点NODE1-1和NODE1-2的hash值:Hash(“192.168.1.100#1”); // NODE1-1,Hash(“192.168.1.100#2”); // NODE1-2。
可见,本申请所述的支持哈希调度策略的lvs调度方法中,当有某个主机连接到Nginx物理服务器上时,调度到相邻hash节点上的连接漂移到加入的主机;当有某个主机退出时,调度到其他主机的会话不会漂移,只有调度到退出的主机上的会话会重新分布,实现了降低会话漂移,提升负载均衡服务质量。
基于上述支持哈希调度策略的lvs调度方法,本申请还提供了一种支持哈希调度策略的lvs调度设备。如图4所示,所述支持哈希调度策略的lvs调度设备包括处理器11、存储器12及通信总线;
所述通信总线用于实现处理器和存储器之间的连接通信;
所述处理器用于执行存储器中存储的支持哈希调度策略的lvs调度程序,以实现以下步骤:
获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
在本实施例中,所述的支持哈希调度策略的lvs调度程序10安装并运行于电子装置1中。所述电子装置1可以是桌上型计算机、笔记本、掌上电脑及服务器等计算设备。该电子装置1可包括,但不仅限于,存储器11、处理器12及显示器13。图4仅示出了具有组件11-13的电子装置1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
所述存储器11在一些实施例中可以是所述电子装置1的内部存储单元,例如该电子装置1的硬盘或内存。所述存储器11在另一些实施例中也可以是所述电子装置1的外部存储设备,例如所述电子装置1上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括所述电子装置1的内部存储单元也包括外部存储设备。所述存储器11用于存储安装于所述电子装置1的应用软件及各类数据,例如所述支持哈希调度策略的lvs调度程序的程序代码等。所述存储器11还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器12在一些实施例中可以是一中央处理器(Central Processing Unit, CPU),微处理器或其他数据处理芯片,用于运行所述存储器11中存储的程序代码或处理数据,例如执行所述支持哈希调度策略的lvs调度程序10等。
所述显示器13在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器13用于显示在所述电子装置1中处理的信息以及用于显示可视化的用户界面,例如应用菜单界面、应用图标界面等。所述电子装置1的部件11-13通过系统总线相互通信。
进一步的,在所述支持哈希调度策略的lvs调度设备中,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤中,所述处理器还用于执行所述支持哈希调度策略的lvs调度程序10,以实现以下步骤:
获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
将第一key值置于所述环形空间中。
进一步的,在所述支持哈希调度策略的lvs调度设备中,所述当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包的步骤中,所述处理器还用于执行所述支持哈希调度策略的lvs调度程序10,以实现以下步骤:
当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
获取与第一最小key值对应主机的IP地址;
以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址,并由该主机转发所述数据包。
进一步的,在所述支持哈希调度策略的lvs调度设备中,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤之前,所述处理器还用于执行所述支持哈希调度策略的lvs调度程序10,以实现以下步骤:
主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
请参阅图5,是本申请安装支持哈希调度策略的lvs调度程序10较佳实施例的功能模块图。在本实施例中,所述的支持哈希调度策略的lvs调度程序10包括至少一个计算机程序指令段,该计算机程序指令段基于各部分实现的功能不同,可以分成一个或多个模块,所述一个或者多个模块被存储于所述存储器11中,并由一个或多个处理器(本实施例为所述处理器12)所执行,以完成本申请各实施例的支持哈希调度策略的lvs调度方法。例如,在图5中,所述的支持哈希调度策略的lvs调度程序10包括第一获取模块21、第二获取模块22、判断模块23及目的地址获取模块24;其中,第一获取模块21,用于获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;第二获取模块22,用于获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;判断模块23,用于获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;目的地址获取模块24,用于当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
这些模块由处理器12执行,从而实现以下步骤:
获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。具体实现与前面的实施例相同,在此不再赘述。
所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤包括:
获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
将第一key值置于所述环形空间中。具体实现与前面的实施例相同,在此不再赘述。
所述当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包的步骤包括:
当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
获取与第一最小key值对应主机的IP地址;
以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址,并由该主机转发所述数据包。具体实现与前面的实施例相同,在此不再赘述。
所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤之前还包括:
主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。具体实现与前面的实施例相同,在此不再赘述。
所述环形空间中每一ipv4的地址对应一个节点,每一节点均复制得到一个对应的虚拟节点。具体实现与前面的实施例相同,在此不再赘述。
基于上述支持哈希调度策略的lvs调度方法,本申请还提供了一种存储介质(及计算机可读存储介质)。所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现所述的支持哈希调度策略的lvs调度方法的步骤。
基于上述支持哈希调度策略的lvs调度方法,本申请还提供了一种支持哈希调度策略的lvs调度装置,其特征在于,所述支持哈希调度策略的lvs调度装置包括:
第一获取模块,用于获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
第二获取模块,用于获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
判断模块,用于获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
目的地址获取模块,用于当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
进一步地,所述第一获取模块包括:
哈希单元,用于获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
第一获取单元,用于获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
设置单元,用于将第一key值置于所述环形空间中。
进一步地,所述目的地址获取模块包括:
第二获取单元,用于当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
第三获取单元,用于获取与第一最小key值对应主机的IP地址;
发送单元,用于以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址。
进一步地,所述支持哈希调度策略的lvs调度装置还包括:
连接模块,用于主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
其中,该支持哈希调度策略的lvs调度装置中各模块对应的实施例与上述基于支持哈希调度策略的lvs调度方法对应的各个实施例基本相同,故在此不再赘述。
综上所述,本申请所提供的支持哈希调度策略的lvs调度方法、装置、设备及存储介质,当有某个主机连接到Nginx物理服务器上时,调度到相邻hash节点上的连接漂移到加入的主机;当有某个主机退出时,调度到其他主机的会话不会漂移,只有调度到退出的主机上的会话会重新分布,实现了降低会话漂移,提升负载均衡服务质量。
可以理解的是,对本领域普通技术人员来说,可以根据本申请的技术方案及本申请构思加以等同替换或改变,而所有这些改变或替换都应属于本申请所附的权利要求的保护范围。

Claims (20)

  1. 一种支持哈希调度策略的lvs调度方法,其特征在于,所述方法包括以下步骤:
    获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
    获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
    获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
    当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
  2. 根据权利要求1所述支持哈希调度策略的lvs调度方法,其特征在于,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤包括:
    获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
    获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
    将第一key值置于所述环形空间中。
  3. 根据权利要求1所述支持哈希调度策略的lvs调度方法,其特征在于,所述当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包的步骤包括:
    当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
    获取与第一最小key值对应主机的IP地址;
    以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址。
  4. 根据权利要求2所述支持哈希调度策略的lvs调度方法,其特征在于,所述当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包的步骤包括:
    当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
    获取与第一最小key值对应主机的IP地址;
    以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址。
  5. 根据权利要求1所述支持哈希调度策略的lvs调度方法,其特征在于,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤之前还包括:
    主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
  6. 根据权利要求2所述支持哈希调度策略的lvs调度方法,其特征在于,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤之前还包括:
    主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
  7. 根据权利要求2所述支持哈希调度策略的lvs调度方法,其特征在于,所述环形空间中每一ipv4的地址对应一个节点,每一节点均复制得到一个对应的虚拟节点。
  8. 一种支持哈希调度策略的lvs调度设备,其特征在于,所述支持哈希调度策略的lvs调度设备包括处理器、存储器及通信总线;
    所述通信总线用于实现处理器和存储器之间的连接通信;
    所述处理器用于执行存储器中存储的支持哈希调度策略的lvs调度程序,以实现以下步骤:
    获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
    获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
    获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
    当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
  9. 根据权利要求8所述支持哈希调度策略的lvs调度设备,其特征在于,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤中,所述处理器还用于执行所述支持哈希调度策略的lvs调度程序,以实现以下步骤:
    获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
    获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
    将第一key值置于所述环形空间中。
  10. 根据权利要求8所述支持哈希调度策略的lvs调度设备,其特征在于,所述当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包的步骤中,所述处理器还用于执行所述支持哈希调度策略的lvs调度程序,以实现以下步骤:
    当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
    获取与第一最小key值对应主机的IP地址;
    以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址,并由该主机转发所述数据包。
  11. 根据权利要求8所述支持哈希调度策略的lvs调度设备,其特征在于,所述获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中的步骤之前还包括以下步骤:
    主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
  12. 一种存储介质,其特征在于,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如下步骤:
    获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
    获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
    获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
    当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
  13. 根据权利要求12所述的存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:
    获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
    获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
    将第一key值置于所述环形空间中。
  14. 根据权利要求12所述的存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:
    当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
    获取与第一最小key值对应主机的IP地址;
    以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址。
  15. 根据权利要求12所述的存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:
    主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
  16. 根据权利要求13所述的存储介质,其特征在于,所述环形空间中每一ipv4的地址对应一个节点,每一节点均复制得到一个对应的虚拟节点。
  17. 一种支持哈希调度策略的lvs调度装置,其特征在于,所述支持哈希调度策略的lvs调度装置包括:
    第一获取模块,用于获取多个主机的IP地址,以每一主机的IP地址一一进行哈希运算得到对应的第一key值,将第一key值置于指定大小的环形空间中;
    第二获取模块,用于获取数据包的源地址,并以数据包的源地址进行哈希运算得到第二key值;
    判断模块,用于获取环形空间中所存储多个第一key值中最小值,并判断多个第一key值中最小值是否大于第二key值;
    目的地址获取模块,用于当多个第一key值中最小值大于第二key值时,则以多个第一key值中最小值对应的主机作为目的地址发送所述数据包。
  18. 根据权利要求17所述支持哈希调度策略的lvs调度装置,其特征在于,所述第一获取模块包括:
    哈希单元,用于获取多个主机的IP地址,并以每一主机的IP地址一一进行哈希运算得到对应的第一key值;
    第一获取单元,用于获取ipv4的地址个数,并以ipv4的地址个数的两倍值作为空间大小设置一环形空间;
    设置单元,用于将第一key值置于所述环形空间中。
  19. 根据权利要求17所述支持哈希调度策略的lvs调度装置,其特征在于,所述目的地址获取模块包括:
    第二获取单元,用于当多个第一key值中最小值大于第二key值时,则将多个第一key值中最小值记为第一最小key值,并获取与第一最小key值对应主机;
    第三获取单元,用于获取与第一最小key值对应主机的IP地址;
    发送单元,用于以与第一最小key值对应主机的IP地址作为目的地址,将所述数据包发送至所述目的地址。
  20. 根据权利要求17所述支持哈希调度策略的lvs调度装置,其特征在于,所述支持哈希调度策略的lvs调度装置还包括:
    连接模块,用于主机通过Http和反向代理方式与Nginx物理服务器连接;其中,所述Nginx物理服务器为IMAP/POP3/SMTP 服务器。
PCT/CN2018/084470 2017-06-22 2018-04-25 支持哈希调度策略的lvs调度方法、设备、装置及存储介质 Ceased WO2018233372A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710481690.0 2017-06-22
CN201710481690.0A CN107329827A (zh) 2017-06-22 2017-06-22 支持哈希调度策略的lvs调度方法、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2018233372A1 true WO2018233372A1 (zh) 2018-12-27

Family

ID=60194360

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/084470 Ceased WO2018233372A1 (zh) 2017-06-22 2018-04-25 支持哈希调度策略的lvs调度方法、设备、装置及存储介质

Country Status (2)

Country Link
CN (1) CN107329827A (zh)
WO (1) WO2018233372A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329827A (zh) * 2017-06-22 2017-11-07 平安科技(深圳)有限公司 支持哈希调度策略的lvs调度方法、设备及存储介质
CN110968419A (zh) * 2018-09-30 2020-04-07 北京国双科技有限公司 数据接收方法及装置
CN109388351B (zh) * 2018-12-18 2024-11-26 平安科技(深圳)有限公司 一种分布式数据存储的方法及相关装置
CN111683036B (zh) * 2020-02-29 2022-05-27 新华三信息安全技术有限公司 数据存储方法、装置以及报文识别方法和装置
CN114579558B (zh) * 2020-11-28 2025-11-14 华为云计算技术有限公司 哈希表的管理方法、装置及系统、计算机存储介质
CN113395183B (zh) * 2021-08-18 2021-12-07 南京赛宁信息技术有限公司 网络仿真平台vlan互联的虚拟节点调度方法与系统
CN119051975B (zh) * 2024-10-21 2025-12-02 北京天融信网络安全技术有限公司 策略管理方法、电子设备、可读介质、程序产品

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104780201A (zh) * 2015-03-02 2015-07-15 新浪网技术(中国)有限公司 一种ipvs集群中的数据包处理方法及装置
CN104852934A (zh) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 基于前端调度实现流量分配的方法、装置和系统
CN106856505A (zh) * 2016-12-26 2017-06-16 成都康赛信息技术有限公司 基于hash算法的服务器均衡方法
CN107329827A (zh) * 2017-06-22 2017-11-07 平安科技(深圳)有限公司 支持哈希调度策略的lvs调度方法、设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103747060B (zh) * 2013-12-26 2017-12-08 惠州华阳通用电子有限公司 一种基于流媒体服务集群的分布式监控系统及方法
CN106503139A (zh) * 2016-10-20 2017-03-15 上海携程商务有限公司 动态数据存取方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104852934A (zh) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 基于前端调度实现流量分配的方法、装置和系统
CN104780201A (zh) * 2015-03-02 2015-07-15 新浪网技术(中国)有限公司 一种ipvs集群中的数据包处理方法及装置
CN106856505A (zh) * 2016-12-26 2017-06-16 成都康赛信息技术有限公司 基于hash算法的服务器均衡方法
CN107329827A (zh) * 2017-06-22 2017-11-07 平安科技(深圳)有限公司 支持哈希调度策略的lvs调度方法、设备及存储介质

Also Published As

Publication number Publication date
CN107329827A (zh) 2017-11-07

Similar Documents

Publication Publication Date Title
WO2018233372A1 (zh) 支持哈希调度策略的lvs调度方法、设备、装置及存储介质
WO2014081266A1 (en) Packet format and communication method of network node for ip routing compatibility and network node therefor
WO2013137573A1 (en) Apparatus and method for managing content for cloud computing
WO2018161478A1 (zh) 多区块链的分片处理方法、装置、服务器和存储介质
WO2020147396A1 (zh) 服务域名的动态配置方法、装置、设备及存储介质
WO2013117104A1 (zh) Bt离线数据下载系统及方法、计算机存储介质
WO2020224246A1 (zh) 基于区块链的数据管理方法、装置、设备和存储介质
GB2497196A (en) Enabling co-existence of hosts or virtual machines with identical addresses across a network
WO2016190476A1 (ko) 클라우드 서비스를 위한 암호화 키 관리 방법 및 그 장치
WO2012057581A4 (ko) 클라우드 컴퓨팅 시스템 및 그의 데이터 동기화 방법
CN102857438A (zh) 同步负载平衡器组件间的状态
US10956501B2 (en) Network-wide, location-independent object identifiers for high-performance distributed graph databases
WO2017185925A1 (zh) 一种访问网站的方法、客户端及局域网内服务器
WO2018227771A1 (zh) 基于保单服务的区域划分方法、系统、服务器和存储介质
WO2015006970A1 (zh) 交换设备、控制器、交换设备配置、报文处理方法及系统
WO2018094809A1 (zh) 一种资源共享方法及装置
WO2018036168A1 (zh) 数据处理任务执行方法、装置、执行服务器和存储介质
WO2014142553A1 (ko) 워크 로드에 따라 동적 자원 할당 가능한 상호 연결 패브릭 스위칭 장치 및 방법
WO2019189963A1 (ko) 분산 클러스터 관리 시스템 및 그 방법
WO2017054445A1 (zh) 一种文件管理方法、服务器及网络附属存储设备
US11140224B2 (en) Moving storage volumes across network boundaries
WO2013176431A1 (ko) 단말을 서버에 할당하고 단말로의 효율적인 메시징을 위한 시스템 및 방법
WO2020153797A1 (en) Method and apparatus for managing data in a network based on swarm intelligence
WO2015068929A1 (ko) 컨텐츠 중심 네트워크에서 패킷 특성을 고려하는 노드의 동작 방법 및 노드
WO2022139055A1 (ko) 분산 메시징 시스템을 이용한 데이터 처리 시스템 및 그 정보 처리 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18820374

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18820374

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 17.03.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18820374

Country of ref document: EP

Kind code of ref document: A1