AWS Elastic Load Balancing (Amazon ELB)学习笔记

The Elastic Load Balancing service allows you to distribute traffic across a group of Amazon EC2 instances in one or more Availability Zones, enabling you to achieve high availability in your applications.

Elastic Load Balancing supports routing and load balancing of Hypertext
Transfer Protocol (HTTP), Hypertext Transfer Protocol Secure (HTTPS), TransmissionControl Protocol (TCP), and Secure Sockets Layer (SSL) traffic to Amazon EC2 instances.
Elastic Load Balancing provides a stable, single Canonical Name record (CNAME) entry point for Domain Name System (DNS) configuration and supports both Internet-facing and internal application-facing load balancers. Elastic Load Balancing supports health checks for Amazon EC2 instances to ensure traffic is not routed to unhealthy or failing instances. Also,Elastic Load Balancing can automatically scale based on collected metrics.

Types of Load Balancers

Internet-Facing Load Balancers
An Internet-facing load balancer is, as the name implies, a load balancer that takes requests from clients over the Internet and distributes them to Amazon EC2 instances that are registered with the load balancer.

An AWS recommended best practice is always to reference a load balancer by its DNS name, instead of by the IP address of the load balancer, in order to provide a single, stable entry point.

Internal Load Balancers
In a multi-tier application, it is often useful to load balance between the tiers of the application.

TTPS Load Balancers
You can create a load balancer that uses the SSL/Transport Layer Security (TLS) protocol for encrypted connections (also known as SSL offload).

Elastic Load Balancing provides security policies that have predefined SSL negotiation configurations to use to negotiate connections between clients and the load balancer. In order to use SSL, you must install an SSL certificate on the load balancer that it uses to terminate the connection and then decrypt requests from clients before sending requests to the back-end Amazon EC2 instances. You can optionally choose to enable authentication on your back-end instances.

Listeners

Every load balancer must have one or more listeners configured. A listener is a process that checks for connection requests—for example, a CNAME configured to the A record name of the load balancer. Every listener is configured with a protocol and a port (client to load balancer) for a front-end connection and a protocol and a port for the back-end (load balancer to Amazon EC2 instance) connection. Elastic Load Balancing supports the following protocols:
HTTP
HTTPS
TCP
SSL

Configuring Elastic Load Balancing

Idle Connection Timeout

the load balancer maintains two connections.One connection is with the client and the other connection is to the back-end instance.One connection is with the client and the other connection is to the back-end instance.
By default, Elastic Load Balancing sets the idle timeout to 60 seconds for both connections.
If you use HTTP and HTTPS listeners, we recommend that you enable the keep-alive option for your Amazon EC2 instances.
Keep-alive, when enabled, allows the load balancer to reuse connections to your back-end instance, which reduces CPU utilization.

Cross-Zone Load Balancing

To ensure that request traffic is routed evenly across all back-end instances for your load balancer, regardless of the Availability Zone in which they are located, you should enable cross-zone load balancing on your load balancer.

Connection Draining

You should enable connection draining to ensure that the load balancer stops sending requests to instances that are deregistering or unhealthy, while keeping the existing connections open.
This enables the load balancer to complete in-flight requests made to these
instances.

Proxy Protocol

When you use TCP or SSL for both front-end and back-end connections, your load balancer forwards requests to the back-end instances without modifying the request headers. If you enable Proxy Protocol, a human-readable header is added to the request header with connection information such as the source IP address, destination IP address, and port numbers. The header is then sent to the back-end instance as part of the request.

Sticky Sessions

you can use the sticky session feature (also known as session affinity), which enables the load balancer to bind a user’s session to a specific instance. This ensures that all requests from the user during the session are sent to the same instance.

Health Checks

Elastic Load Balancing supports health checks to test the status of the Amazon EC2 instances behind an Elastic Load Balancing load balancer.
A health check is a ping, a connection attempt, or a page that is checked periodically.

猜你喜欢

转载自blog.csdn.net/pg_edb/article/details/87867945