zoukankan      html  css  js  c++  java
  • Nginx——stream模块

    nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等

    stream模块的用法和http模块差不多,语法基本一致,支持server,hash, listen, proxy_pass等指令,

    配置实例如下:

    worker_processes auto;
    error_log logs/error.stream.log info;
    events {
        worker_connections  1024;
    }
    stream {
    
        upstream cloudsocket {
           hash $remote_addr consistent;
          # $binary_remote_addr;
           server 172.19.20.7:3306 weight=5 max_fails=3 fail_timeout=300s;
        }
    
    
        server {
           listen 3306;#数据库服务器监听端口
           server_name mysql1.tools.hrtop.net;
           proxy_connect_timeout 120s;
           proxy_send_timeout 120;
        proxy_read_timeout 120;
        proxy_buffer_size 256k;
        proxy_buffers 8 128k;
           proxy_pass cloudsocket;
        }
    }
  • 相关阅读:
    POJ 1045
    POJ 1051
    POJ 1047
    POJ 1050
    POJ 1046
    POJ 1036
    POJ 1035
    POJ 1032
    【洛谷P1412】经营与开发
    【洛谷P3377】【模板】左偏树(可并堆)
  • 原文地址:https://www.cnblogs.com/zh-dream/p/12911609.html
Copyright © 2011-2022 走看看