zoukankan      html  css  js  c++  java
  • Nginx配置TCP服务负载均衡

    # Nginx配置TCP服务负载均衡


    ## 前置条件

    - nginx 1.18 (1.9之后支持tcp负载)
    - 两个前置服务


    ## 配置文件修改

    Legacy
    Stable

    ```
    # cat nginx.conf
    user  nginx;
    # 增加工作线程
    worker_processes  4;

    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;


    events {
        # worker_connections  1024;
        # 工作者连接
        worker_connections 8192;
    }


    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;

        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';

        access_log  /var/log/nginx/access.log  main;

        sendfile        on;
        #tcp_nopush     on;

        keepalive_timeout  65;

        #gzip  on;

        include /etc/nginx/conf.d/*.conf;
    }

    worker_rlimit_nofile 40000;

    stream {
        upstream appkey01 {
            least_conn;
            # server 192.168.1.14:9905 max_fails=3 fail_timeout=5s;
            server 192.168.1.192:9905 max_fails=3 fail_timeout=5s;
        }

        server {
            listen 9905;
            proxy_pass appkey01;
        }
    }
    ```

  • 相关阅读:
    MPI学习四-集合通信
    MPI学习三
    MPI学习二
    MPI学习一
    HIP编程
    CUDA实战3
    CUDA实战2
    Excel处理
    2.java中c#中statc 静态调用不同之处、c#的静态构造函数和java中的构造代码块、静态代码块
    1.隐藏继承的成员new / 虚方法(override)/ abstract / 多态 ----- 重写
  • 原文地址:https://www.cnblogs.com/jiftle/p/13049899.html
Copyright © 2011-2022 走看看