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;
    }
    }

  • 相关阅读:
    浅谈聚类算法(K-means)
    多步法求解微分方程数值解
    本学期微分方程数值解课程总结(matlab代码)
    Stone Game
    Two Sum IV
    Insert into a Binary Search Tree
    Subtree of Another Tree
    Leaf-Similar Trees
    Diameter of Binary Tree
    Counting Bits
  • 原文地址:https://www.cnblogs.com/luoyan01/p/9734158.html
Copyright © 2011-2022 走看看