mysql集群使用nginx配置负载均衡

参考链接:https://mu-sl.com//archives/mysql%E9%9B%86%E7%BE%A4%E4%BD%BF%E7%94%A8nginx%E9%85%8D%E7%BD%AE%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1

mysql集群使用nginx配置负载均衡_第1张图片

配置文件nginx_tcp.conf 示例

load_module  modules/ngx_stream_module.so;

stream{
    upstream tcpssh{
        hash $remote_addr consistent;
        server 10.0.10.79:3306 max_fails=3 fail_timeout=10s;
        server 10.0.10.111:3306 max_fails=3 fail_timeout=10s;
        server 10.0.10.120:3306 max_fails=3 fail_timeout=10s;

    }
    server{
        listen 3389;
        proxy_connect_timeout 20s;
        proxy_timeout 5m;
        proxy_pass tcpssh;
    }
}


mysql 集群搭建(双主模式)

https://mu-sl.com/archives/mysql%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA%E5%8F%8C%E4%B8%BB%E5%8F%8C%E4%BB%8E%E5%8F%8C%E4%B8%BB%E7%83%AD%E5%A4%87

你可能感兴趣的:(mysql,nginx,负载均衡)