转发Mysql连接

nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
stream {
    upstream cloudsocket {
       hash $remote_addr consistent;
       server 192.168.11.128:4406 weight=5 max_fails=3 fail_timeout=30s;
    }
    server {
       listen 3306;
       proxy_connect_timeout 10s;
       proxy_timeout 300s;
       proxy_pass cloudsocket;
    }
}

refer to:
https://www.cnblogs.com/DreamFather/p/11358131.html