乐都城娱乐-山东430文科能上什么大学

首页

AD联系:507867812

乐都城娱乐

时间:2019-11-20 02:49:33 作者:bet36台湾 浏览量:55027

乐都城娱乐OpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux,见下图

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQLOpenResty负载均衡MySQL,见下图

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQL,如下图

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQL

如下图

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux,如下图

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL,见图

乐都城娱乐OpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQL

OpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty负载均衡MySQL

OpenResty负载均衡MySQL

OpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL。

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

乐都城娱乐OpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

1.

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQLOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQL

2.

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

3.OpenResty负载均衡MySQL。

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

4.

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty负载均衡MySQLOpenResty负载均衡MySQLOpenResty负载均衡MySQLOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQL

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linuxOpenResty负载均衡MySQLOpenResty负载均衡MySQL。乐都城娱乐

展开全文
相关文章
赢咖注册

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux

色狮导航

OpenResty负载均衡MySQL....

天下现金tx66

OpenResty负载均衡MySQL....

百乐坊线上娱乐

OpenResty负载均衡MySQL....

锦海国际

OpenResty负载均衡MySQL....

相关资讯
伟德备用网址

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux....

快乐基站1024澳门看片

OpenResty下载地址https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz

nginx_tcp_proxy_module模块需要单独下载https://github.com/yaoweibin/nginx_tcp_proxy_module

首先,解压缩上述文件[nginx@localhost~]$ll总用量 3668drwxrwxr-x 7 nginx nginx 4096 8月 18 23:39 nginx_tcp_proxy_module-master-rw-r--r-- 1 nginx nginx 213069 12月 8 15:05 nginx_tcp_proxy_module-master.zipdrwxrwxr-x 5 nginx nginx 4096 12月 8 15:31 ngx_openresty-1.9.3.2-rw-r--r-- 1 nginx nginx 3529639 11月 30 10:22 ngx_openresty-1.9.3.2.tar.gz

然后,打patch[nginx@localhost~]$cd ngx_openresty-1.9.3.2/bundle/nginx-1.9.3[nginx@localhost~/ngx_openresty-1.9.3.2/bundle/nginx-1.9.3]$patch -p1 < /home/nginx/nginx_tcp_proxy_module-master/tcp.patch patching file src/core/ngx_log.cHunk #1 FAILED at 66.1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rejpatching file src/core/ngx_log.hHunk #1 FAILED at 29.Hunk #2 FAILED at 36.2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rejpatching file src/event/ngx_event_connect.hHunk #1 succeeded at 33 (offset 1 line).Hunk #2 succeeded at 45 with fuzz 2 (offset 2 lines).

最后[nginx@localhost~]$cd ngx_openresty-1.9.3.2[nginx@localhost~/ngx_openresty-1.9.3.2]$./configure --prefix=/home/nginx/OpenResty --add-module=/home/nginx/nginx_tcp_proxy_module-master

make -j `cat /proc/cpuinfo | grep processor| wc -l`make install

修改配置文件[nginx@localhost~]$cd OpenResty/nginx/conf[nginx@localhost~/OpenResty/nginx/conf]$vim nginx.conf

tcp{ upstream mysql { server 172.16.1.25:3306 weight=10; server 172.16.1.78:3306 weight=10 down; #check interval=10000 rise=2 fall=5 timeout=10000 type=mysql; } server { listen 9999; proxy_pass mysql; timeout 1d; proxy_read_timeout 1d; proxy_send_timeout 1d; proxy_connect_timeout 3000; so_keepalive on; tcp_nodelay on; } }

注意:check要注释,否则连接不上.原因未知.

参考:https://github.com/yaoweibin/nginx_tcp_proxy_module

linux....

热门资讯