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 set load balancer in Docker container

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how to set load balancer in the Docker container. The editor thinks it is very practical, so I hope you can learn something after reading this article. Let's take a look at it with the editor.

About load balancing

Load balancing (Load balancing) is a computer network technology that is used to distribute load among multiple computers (computer clusters), network connections, CPU, disk drives, or other resources to optimize resource usage, maximize throughput, minimize response time, and avoid overload.

Using multiple server components with load balancing instead of a single component can improve reliability through redundancy. Load balancing services are usually done by dedicated software and hardware.

One of the most important applications of load balancing is to use multiple servers to provide a single service, which is sometimes referred to as a server farm. In general, load balancing is mainly used in Web websites, large Internet Relay Chat networks, high-traffic file download sites, NNTP (Network News Transfer Protocol) services and DNS services. Now load balancers are also beginning to support database services, called database load balancers.

For Internet services, a load balancer is usually a software program that listens to an external port through which Internet users can access the service. the software as a load balancer forwards the user's request to the background intranet server, which returns the request to the load balancer, and the load balancer sends the response to the user. This hides the intranet structure from Internet users, prevents users from directly accessing the background (intranet) server, makes the server more secure, and can prevent attacks on the core network stack and other port services.

When all back-end servers fail, some load balancers provide special features to handle this situation. For example, forwarding a request to an alternate load balancer, displaying a message about a service outage, and so on. Load balancers enable IT teams to significantly improve fault tolerance. It can automatically provide a large amount of capacity to handle any increase or decrease in application traffic.

Let's take a look at the process of configuring load balancing in a honeycomb:

Create a load balancer

Click "load Balancer" on the left navigation menu to enter the load balancer instance list page, and click "create load Balancer" button to enter the load balancer creation interface, as shown in the following figure:

After completing the basic creation information, click the "create now" button to jump to the "load Balancer details" page, as shown in the following figure:

Add snooping

After you have created it, the add Monitor button is available. Click this button to jump to the create listening page. After filling in the relevant information, click "add now":

Note: by default, a maximum of 20 groups of listeners can be opened for an instance. If you need more monitoring, please submit a ticket.

Protocol settin

Each group of listeners can be configured with a set of forwarding ports, including source and destination ports. Currently, only HTTP and HTTPS are supported.

Forwarding rule

You can choose "do not use" or "use" forwarding rule, the default is "do not use".

If you "use" the forwarding rule, it is divided into "by domain name" and "by URL":

By domain name: multiple domain names can be set for each group of listeners. Domain names support full domain names and wildcards. Take c.163.com as an example, the format is as follows:

C.163.com exactly matches the c.163.com domain name

* .163.com matches all domain names ending in 163.com

C.163.* matches all domain names starting with c.163

Note: if domain name matching is enabled, but the requested domain name matching is less than any of the rules, 403 will be returned.

Press URL: use prefix matching, support "/", you can add "$" at the end to do a complete match.

Back-end container

Clusters or containers can be selected, and mixed selection is supported.

Session persistence

You can choose "do not use" or "use" session persistence. The default is "do not use".

Session persistence is divided into "implanting cookie" or "rewriting cookie":

Implanted cookie: load balancer service automatically generates cookie. You can specify the timeout period (in S). If it is left empty, the default is session cookie.

Rewrite cookie: rewrite the cookie specified by the user. If there is no corresponding cookie, session persistence is not used.

Set up snooping

Click "Monitoring Management" in "Cloud load Balancer details" to view the added monitoring, as shown below:

Click the "Settings" button in the corresponding monitoring to set the monitoring, as shown in the following figure:

Monitoring details

In the listening list, click the "details" button in the corresponding monitoring to view the monitoring details, as shown in the following figure

Modify load balancer

Click the navigation menu "load balancer" on the left to view the list of load balancer instances. Click the name of the cloud load balancer instance you want to modify, go to the "details of load balancer" page, click "Settings" button, and enter the "set load Balancer" page. After modifying the corresponding parameters, click "submit Settings":

Delete load balancer

In the load balancer list, click the name of the cloud load balancer instance to be deleted to enter the "load balancer details" page. Click the "Settings" button, go to the "set up load balancer" page, and click the "Delete" button. Note: after the cloud load balancer instance is deleted, the associated clusters and containers will not be deleted, but the public network IP will not be retained. Please be careful.

The above is how to set load balancer in the Docker container. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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