首页 > 代码库 > Using load balance for thrift servers
Using load balance for thrift servers
Software load balance .
Nginx(http://nginx.org)
1.Install nginx
download source code from http://nginx.org/en/download.html
./auto/configuremake & make install
2.Install tcp module patch
developed by Yao Weibin http://yaoweibin.github.io/nginx_tcp_proxy_module/
download from GitHub http://github.com/yaoweibin/nginx_tcp_proxy_module/zipball/master
$ patch -p1 < /path/nginx_tcp_proxy_module/tcp.patch$ ./configure --add-module=/path/nginx_tcp_proxy_module/tcp.patch$ make & make install
3. config load balance
#check status at http://localhost:8080/statushttp { server{ listen 8080; location /status { tcp_check_status; } }}#load balance to other servertcp { upstream cluster { # simple round-robin server 192.168.0.111:11213; server 192.168.0.110:11213; check interval=3000 rise=2 fall=5 timeout=1000; #check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello; #check interval=3000 rise=2 fall=5 timeout=1000 type=http; #check_http_send "GET / HTTP/1.0\r\n\r\n"; #check_http_expect_alive http_2xx http_3xx; } server { listen 11113; proxy_pass cluster; }}
4. Start Nginx
#start
$sudo /usr/local/nginx/sbin/nginx
#reopen
$sudo /usr/local/nginx/sbin/nginx -s reopen
#quit
$sudo /usr/local/nginx/sbin/nginx -s quit
5. note
1. each connection can be relocated to different servers with round-robin or weight.
2. one connection will not be relocated unless released.
3. other options for the optimize of nginx see the website. This is the basic usage only.
Using load balance for thrift servers
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。