Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

load-balancer

БесплатноБез исполняемых скриптовНе проверен

Configures nginx load balancing with upstream servers, health checks, and failover strategies. Use when setting up load balancing, distributing traffic across…

armanzeroeightот armanzeroeight★ 30 звёзд на GitHub7 установок в других каталогах

Об этом скилле

Load Balancer Configuration

Quick Start

Configure nginx to distribute traffic across multiple backend servers with health checks and automatic failover.

Instructions

Step 1: Define upstream block

Create an upstream block with your backend servers:

upstream backend {
    # Load balancing method (optional, defaults to round-robin)
    least_conn;  # or ip_hash, or omit for round-robin
    
    # Backend servers
    server backend1.example.com:8080 weight=3;
    server backend2.example.com:8080 weight=2;
    server backend3.example.com:8080;
    
    # Backup server (used when all primary servers are down)
    server backup.example.com:8080 backup;
    
    # Health check parameters
    keepalive 32;
}

Step 2: Configure proxy in server block

Add proxy configuration to route traffic to the upstream:

server {
    listen 80;
    server_name example.com;
    
    location / {
        proxy_pass http://backend;
        
        # Essential proxy headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        
        # Timeouts
        proxy_connect_timeout 60s;
        proxy_send_timeout 60s;
        proxy_read_timeout 60s;
        
        # Buffering
        proxy_buffering on;
        proxy_buffer_size 4k;
        proxy_buffers 8 4k;
    }
}

Step 3: Add health checks

Configure passive health checks (active checks require nginx Plus):

upstream backend {
    server backend1.example.com:8080 max_fails=3 fail_timeout=30s;
    server backend2.example.com:8080 max_fails=3 fail_timeout=30s;
    server backend3.example.com:8080 max_fails=3 fail_timeout=30s;
}

Parameters:

  • max_fails: Number of failed attempts before marking server as unavailable
  • fail_timeout: Time to wait before retrying a failed server

Step 4: Test and reload

# Test configuration
nginx -t

# Reload nginx
nginx -s reload

Load Balancing Methods

Round-robin (default): Distributes requests evenly across servers

upstream backend {
    server backend1.example.com:8080;
    server backend2.example.com:8080;
}

Least connections: Routes to server with fewest active connections

upstream backend {
    least_conn;
    server backend1.example.com:8080;
    server backend2.example.com:8080;
}

IP hash: Routes same client IP to same server (session persistence)

upstream backend {
    ip_hash;
    server backend1.example.com:8080;
    server backend2.example.com:8080;
}

Weighted: Distributes based on server capacity

upstream backend {
    server backend1.example.com:8080 weight=3;  # Gets 3x traffic
    server backend2.example.com:8080 weight=1;
}

Common Patterns

WebSocket proxying

location /ws {
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

Sticky sessions with cookie

upstream backend {
    server backend1.example.com:8080;
    server backend2.example.com:8080;
    
    # Requires nginx Plus or third-party module
    sticky cookie srv_id expires=1h domain=.example.com path=/;
}

Slow start (nginx Plus)

upstream backend {
    server backend1.example.com:8080 slow_start=30s;
    server backend2.example.com:8080 slow_start=30s;
}

Advanced

For detailed information, see:

  • Upstream Patterns - Advanced load balancing algorithms and patterns
  • Health Checks - Comprehensive health check configuration
  • Caching - Proxy caching strategies for load-balanced backends
Полный SKILL.md на GitHub

Установить load-balancer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

reference/caching.mdreference/health-checks.mdreference/upstream-patterns.md

FAQ

Что делает скилл load-balancer?

Configures nginx load balancing with upstream servers, health checks, and failover strategies. Use when setting up load balancing, distributing traffic across multiple servers, or configuring upstream backends.

Как установить скилл load-balancer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл load-balancer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить load-balancer с