Created
July 3, 2015 07:41
-
-
Save philipz/fadd2ddb92c4cf07fb10 to your computer and use it in GitHub Desktop.
Revisions
-
philipz created this gist
Jul 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ [TCP LOAD BALANCING](https://www.nginx.com/resources/admin-guide/tcp-load-balancing/) ``` user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } stream { upstream stream_backend { least_conn; server 172.17.0.34:3306 max_fails=2 fail_timeout=30s; #server backend2.example.com:12345 max_fails=2 fail_timeout=30s; #server backend3.example.com:12346 max_conns=3; } server { listen 3306; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass stream_backend; } } ```