stream { upstream mysql { hash $remote_addr consistent; server 10.0.10.2:3306 weight=5 max_fails=5 fail_timeout=30s; } server { listen 3306; proxy_connect_timeout 30s; proxy_timeout 300s; proxy_pass mysql; } }