Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create Pool and add VIP

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to create Pool and add VIP, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Today we implement the following LBaaS environment.

The environment is described as follows:

1. Create a Pool "web servers".

two。 The two pool member "WEB1" and "WEB2" are both instance running Ubuntu cloud image.

3. Load balancer VIP is associated with floating IP.

4. Client located in the public network accesses the web server through the floating IP public network.

Let's start with the first step.

Create Pool

Click the menu Project-> Network-> Load Balancers, and click the "Add Pool" button in the Pools tab.

Displays the Pool creation page.

Name the Pool "web servers".

Provider selects the default "haproxy".

Subnet chooses "172.16.100.0 Compact 24".

Protocol selects "HTTP".

Load Balancing Method selects "ROUND_ROBIN".

Click the "Add" button and "web servers" is created successfully.

Here are some of the properties of Pool.

LBaaS supports the following Protocol:

Because we use web server to do experiments, we need to choose "HTTP" here.

LBaaS supports multiple load balance method

ROUND_ROUBIN

If the round robin algorithm is used, load balancer selects the connection requests for the corresponding client of the member from the pool in a fixed order. The drawback of this approach is the lack of a mechanism to check whether the member is overloaded. It is possible that some member will have to continue to work on new connections because of their weak processing power. If all pool member have the same processing power, memory capacity, and each connection lasts roughly the same time, this situation is ideal for round robin, and the load of each member will be balanced.

LEAST_CONNECTIONS

If you use the least connections algorithm, load balancer picks the pool member with the least number of connections currently. This is a dynamic algorithm that needs to monitor the number and status of connections in each member in real time. The computationally powerful member can process connections faster and then allocate more new connections.

SOURCE_IP

If the source IP algorithm is used, connections with the same source IP will be distributed to the same pool member. The source IP algorithm is particularly useful for applications that need to save state, such as shopping carts, because we want to use the same server to handle a client's continuous online shopping operations.

The ROUND_ROUBIN algorithm is chosen in our experiment.

Add VIP to Pool

Now that Pool is ready, you need to set up VIP for it. Click "Add VIP" in the action list of "web servers".

The VIP is named "VIP for web servers".

VIP Subnet chooses "172.16.100.0 Compact 24", which is consistent with pool.

Specify a VIP of 172.16.100.11, and if not, the system automatically assigns it from the subnet.

Specify HTTP port 80.

Session Persistence selects "SOURCE IP".

The number of connections can be limited through Connection Limit, or unlimited if not specified.

Click "Add" and VIP is created successfully.

Usually we want the same server to handle successive requests from a client. Otherwise, client may have to log in again because of the loss of session.

This feature is Session Persistence. VIP supports the following Session Persistence methods:

SOURCE_IP

This is the same as the SOURCE_IP effect of the previous load balance. After the initial connection is established, subsequent client requests from the same source IP are sent to the same member. When a large number of client access VIP through the same proxy server (such as surfing the Internet in the company and school), the SOURCE_IP mode can cause member load imbalance.

HTTP_COOKIE

The way HTTP_COOKIE works is as follows: when client first connects to the VIP, HAProxy picks out a member from the pool. When this member responds to a request, the HAProxy injects a cookie named "SRV" into the reply message, which contains the unique identity of the member. Subsequent requests from client will contain this "SRV" cookie. HAProxy parses the contents of the cookie and forwards the request to the same member.

HTTP_COOKIE is superior to SOURCE_IP because it does not rely on client's IP.

APP_COOKIE

App cookie relies on the server-side application-defined cookie. For example, app can distinguish between different client by creating a cookie in session.

HAProxy looks at the app cookie in the message to ensure that the request containing the app cookie is sent to the same member.

If there is no cookie (a new connection or the server application does not create a cookie), HAProxy uses the ROUND_ROUBIN algorithm to allocate the member.

Compare Load Balance Method and Session Persistence

There are also three kinds of Session Persistence.

Because both involve how to choose pool member, it's easy to get confused. The biggest difference between them is the stage in which you choose pool member:

Load Balance Method is the way to select member for a new connection

Session Persistence is a method of selecting member for subsequent connections of the same client

For example, our settings here are:

Load Balance Method-ROUND_ROUBIN

Session Persistence-SOURCE_IP

When client A sends the first request to VIP, HAProxy selects member1 through ROUND_ROUBIN. For subsequent requests from client A, HAProxy applies the SOURCE_IP mechanism and still chooses member1 to process the request.

On how to create Pool and add VIP to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report