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 從公開儲存庫中收錄這些內容。

檢舉或申請下架