Load Balancer Setup

aj-geddes/useful-ai-prompts/skills/load-balancer-setup

作者 aj-geddes3f5182cfd739无许可证355 个星标收录于 2026年10月8日更新于 2026年10月8日仓库7个月前更新

Configure and deploy load balancers (HAProxy, AWS ELB/ALB/NLB) for distributing traffic, session management, and high availability.

包含脚本DevOps & Cloud
AI 生成的概览

配置并部署 HAProxy、AWS ELB/ALB/NLB 等负载均衡器,用于流量分发与高可用。

功能
提供部署和配置负载均衡器的指导与参考资料,包括 HAProxy 配置、AWS 应用负载均衡器 CloudFormation 模板、健康检查脚本和监控。内容涵盖后端服务器流量分发、会话保持、SSL/TLS 终止和故障转移。该技能还附带一个校验脚本和一个 API 脚手架模板。
适用场景
适用于搭建多服务器流量分发、高可用与故障转移、粘性会话、健康检查或 SSL/TLS 终止的场景。也适合跨区域负载均衡、负载均衡器层面的限流以及 DDoS 缓解规划。
运行要求
需要能读取随附参考文档和模板的智能体环境。技能附带可执行脚本(scripts/validate-api.sh)和模板(templates/api-scaffold.yaml)。部署到 AWS 或运行 HAProxy 需要相应的基础设施、工具和凭据。

Load Balancer Setup

Table of Contents

Overview

Deploy and configure load balancers to distribute traffic across multiple backend servers, ensuring high availability, fault tolerance, and optimal resource utilization across your infrastructure.

When to Use

  • Multi-server traffic distribution
  • High availability and failover
  • Session persistence and sticky sessions
  • Health checking and auto-recovery
  • SSL/TLS termination
  • Cross-region load balancing
  • API rate limiting at load balancer
  • DDoS mitigation

Quick Start

Minimal working example:

conf
# /etc/haproxy/haproxy.cfgglobal    log stdout local0    log stdout local1 notice    maxconn 4096    daemon
    # Security    tune.ssl.default-dh-param 2048    ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256    ssl-default-bind-options ssl-min-ver TLSv1.2
defaults    log global    mode http    option httplog    option denylogin    option forwardfor    option http-server-close
    # Timeouts    timeout connect 5000    timeout client 50000    timeout server 50000
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
HAProxy Configuration [blocked]HAProxy Configuration
AWS Application Load Balancer (CloudFormation) [blocked]AWS Application Load Balancer (CloudFormation)
Load Balancer Health Check Script [blocked]Load Balancer Health Check Script
Load Balancer Monitoring [blocked]Load Balancer Monitoring

Best Practices

✅ DO

  • Implement health checks
  • Use connection pooling
  • Enable session persistence when needed
  • Monitor load balancer metrics
  • Implement rate limiting
  • Use multiple availability zones
  • Enable SSL/TLS termination
  • Implement graceful connection draining

❌ DON'T

  • Allow single point of failure
  • Skip health check configuration
  • Mix HTTP and HTTPS without redirect
  • Ignore backend server limits
  • Over-provision without monitoring
  • Cache sensitive responses
  • Use default security groups
  • Neglect backup load balancers

来源与署名

来源:aj-geddes/useful-ai-prompts位于skills/load-balancer-setup提交3f5182c

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架