zoukankan      html  css  js  c++  java
  • Nginx代理MysqlCluster集群(二)

    Nginx代理MySql集群
    本次实验采用nginx 版本1.12以上 集合了tcp代理功能
    只需在编译时明文开启指定的功能 --with-stream
    --prefix=/usr/local/ngin --user=nginx --group=nginx --with-http_stub_status_module --with-stream

    配置文件
    stream{ #作为iweb服务器在http模块 代理tcp在stream模块中
    upstream cluster {
    # hash $remote_addr consistent; //保持session不变
    server 192.168.1.2:3306 max_fails=3 fail_timeout=30s;
    server 192.168.1.3:3306 max_fails=3 fail_timeout=30s;
    }
    server {
    listen 1234;
    proxy_pass cluster;
    }
    }

    在较低的版本需要添加有yaowenbin 开发的模块nginx_tcp_proxy_module
    wget http://nginx.org/download/nginx-1.7.4.tar.gz
    wget https://codeload.github.com/yaoweibin/nginx_tcp_proxy_module/legacy.tar.gz/master

    下载下来的master 是个tar包

    #Yum install -y patch
    #cd nginx-1.7.4
    #patch -p1 < ../nginx_tcp_proxy_module/tcp.patch
    #./configure --prefix=/usr/local/ngin --user=nginx --group=nginx --with-http_stub_status_module --addmodule=../
    nginx_tcp_proxy_module

    配置文件
    tcp {
    upstream proxy_name {
    # simple round-robin
    server 192.168.1.10:8000;
    check interval=3000 rise=2 fall=5timeout=1000;
    }
    server {
    listen 8888;
    proxy_pass proxy_name;
    }
    }

  • 相关阅读:
    anchor-free : CornerNet 和 CenterNet 简要笔记
    图像分割中的loss--处理数据极度不均衡的状况
    python 装饰器
    python3 新特性
    VSCode Eslint+Prettier+Vetur常用配置
    JS lodash学习笔记
    JS 高端操作整理
    Vue 组件通信
    Vue 搭建vue-element-admin框架
    小程序 HTTP请求封装
  • 原文地址:https://www.cnblogs.com/luoyan01/p/9734158.html
Copyright © 2011-2022 走看看