tar jxvf jemalloc-3.5.1.tar.bz2

cd jemalloc-3.5.1

./configure

make && make install

echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf

ldconfig

cd ..

下载 http://tengine.taobao.org/download/tengine-2.1.1.tar.gz

tar zxvf tengine-2.1.1.tar.gz

wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip

unzip master.zip

yum -y install patch

cd tengine-2.1.1

patch -p1 < /opt/software/nginx_tcp_proxy_module-master/tcp.patch

-----------------------------------------------------------------------

patching file src/core/ngx_log.c

Hunk #1 succeeded at 69 (offset 3 lines).

patching file src/core/ngx_log.h

Hunk #1 succeeded at 30 (offset 1 line).

Hunk #2 succeeded at 38 (offset 1 line).

patching file src/event/ngx_event_connect.h

Hunk #1 succeeded at 33 (offset 1 line).

Hunk #2 succeeded at 45 (offset 2 lines).

-------------------------------------------------------------------------

./configure --user=upload --group=upload --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-ld-opt="-ljemalloc" --add-module=/opt/software/nginx_tcp_proxy_module-master

make && make install

cd /opt/local/nginx/conf

vi nginx.conf

--------------------------------------------------------------------------------------------

user upload upload;

worker_processes 8;

error_log /opt/local/nginx/logs/nginx_error.log crit;

pid     /opt/local/nginx/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.

worker_rlimit_nofile 65535;

events

{

use epoll;

worker_connections 65535;

}

http

{

include     mime.types;

default_type application/octet-stream;

#charset gb2312;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 100m;

sendfile on;

server_tokens off;

tcp_nopush   on;

keepalive_timeout 120;

tcp_nodelay on;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

gzip on;

gzip_min_length 1k;

gzip_buffers   4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types     text/plain application/x-javascript text/css application/xml;

gzip_vary on;

#limit_zone crawler $binary_remote_addr 10m;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" $http_x_forwarded_for  "$request_time"';

}

tcp

{

include vhost/*.conf;

include upstream.conf;

}

--------------------------------------------------------------------------------------------

vi  upstream.conf

upstream mysql {

server 172.16.32.20:3306;

server 172.16.32.24:3306;

server 172.16.32.27:3306;

server 172.16.32.33:3306;

check interval=3000 rise=2 fall=3 timeout=1000;

}

mkdir vhost/

cd vhost/

vi mysql.conf

server {

listen 3306;

proxy_pass mysql;

}

Tengine TCP 负载均衡的更多相关文章

  1. Nginx 的 TCP 负载均衡介绍

    Nginx除了以前常用的HTTP负载均衡外,Nginx增加基于TCP协议实现的负载均衡方法. HTTP负载均衡,也就是我们通常所有“七层负载均衡”,工作在第七层“应用层”.而TCP负载均衡,就是我们通 ...

  2. [转帖]Nginx 的 TCP 负载均衡介绍

    Nginx 的 TCP 负载均衡介绍 https://www.cnblogs.com/felixzh/ 前几天同事问 nginx的代理 当时以为只有http的 现在看起来还有tcp的可以使用tcp 代 ...

  3. Nginx作为TCP负载均衡

    参考文档:https://www.cnblogs.com/stimlee/p/6243055.html Nginx在1.9版本以后支持TCP负载均衡,模块默认是没有编译的,需要编译时添加—with-s ...

  4. 【精选】Nginx负载均衡学习笔记(一)实现HTTP负载均衡和TCP负载均衡(官方和OpenResty两种负载配置)

    说明:很简单一个在HTTP模块中,而另外一个和HTTP 是并列的Stream模块(Nginx 1.9.0 支持) 一.两个模块的最简单配置如下 1.HTTP负载均衡: http { include m ...

  5. nginx基于tcp负载均衡

    官方参考文档:http://nginx.org/en/docs/stream/ngx_stream_core_module.html 只有nginx1.9以上的版本才支持tcp负载均衡 配置必须出现在 ...

  6. Nginx 反向代理功能-实现Nginx tcp负载均衡

    Nginx 反向代理功能-实现Nginx tcp负载均衡 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.

  7. 使用tengine解决负载均衡的session问题

    事情的经过时这样的~~,我看了好多好多百度中nginx负载均衡中解决session问题的方式,我选择了研究url_hash的方式.经过一番配置之后,我越发觉得这百度搜出来的帖子也太过久远了吧,去htt ...

  8. 利用nginx做tcp负载均衡

    当前nginx-13.1已经支持tcp,ucp,unix域套接字三种负载均衡模式(http肯定支持,这个不用说).最近有需求需要对后端服务做负载均衡,因此考虑使用nginx来做. 1. 下载nginx ...

  9. HAproxy四层TCP负载均衡配置及测试

    --------------------------------------------------centos 7 处理--------------------------------------- ...

随机推荐

  1. Jquery-获取勾选的checkbox的同级节点数量

    // 获取勾选的标签值得上一个兄弟节点 var groups = []; $('input[name="group_name"]:checked').siblings(" ...

  2. vs2010在进行数据架构比较时报'text lines should not be null'错误

    通过VS2010进行服务器数据库和本地数据库比较架构(都是sql server 2008 R2)时,弹出“text lines should be not null”错误,如下图: 解决方法:在Vis ...

  3. 689C - Mike and Chocolate Thieves 二分

    题目大意:有四个小偷,第一个小偷偷a个巧克力,后面几个小偷依次偷a*k,a*k*k,a*k*k*k个巧克力,现在知道小偷有n中偷法,求在这n种偷法中偷得最多的小偷的所偷的最小值. 题目思路:二分查找偷 ...

  4. ios字体大小适应不同屏幕

    //根据button高度来设置字体大小 CGFloat dayLabelWidth = (viewWidth-10)/7-1; cancelButton = [[UIButton alloc] ini ...

  5. vps安装wordpress遇到的问题(lnmp)

    1.要执行请求的操作,WordPress 需要访问您网页服务器的权限. 请输入您的 FTP 登录XXXX完美解决方法 因为在wordpress中新上传的插件的权限都是www用户的,而不是root或其他 ...

  6. Swift 学习笔记 (三) 之循环引用浅析

    原创:转载请注明出处 110.自动引用计数实践 下面的例子展示了自动引用计数的工作机制.例子以一个简单的Person类开始,并定义了一个叫name的常量属性: class Person {     l ...

  7. pat L2-006. 树的遍历

    L2-006. 树的遍历 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历 ...

  8. 当使用System,out.println()打印一个对象是自动调用toString方法

    在Java中,所有的对象都是继承自Object,自然继承了toString方法,在当使用System,out.println()里面为一个对象的引用时,自动调用toString方法讲对象打印出来.如果 ...

  9. Linux学习 -- 备份与恢复

    备份 Linux系统需要备份的数据 /root/ /home/ /var/spool/mail /etc/ others 备份策略 完全备份 增量备份 差异备份 备份和恢复命令 dump  resto ...

  10. CenOS配置VSFTP服务器

    1 Linux FTP服务器分类: wu-ftp proftp=profession ftp vsftp=very security ftp 2 安装vsftp yum install vsftp 3 ...