tengine mysql_[原创]Tengine与tengine 配置参数详解
#http://wiki.nginx.org/Modules
版本:
[root@test sbin]# ./tengine -v
Tengine version: Tengine/2.0.1 (nginx/1.4.6)
#参考地址
user root root;
#工作进程数
worker_processes auto;
#CPU总核数或者总核数2倍
worker_cpu_affinity auto;
#进程id
pid /usr/local/tengine/nginx.pid;
#描述文件数量
worker_rlimit_nofile 102400;
events
{
#设置网络I/O模型.Linux为epoll
use epoll;
#允许连接数
worker_connections 102400;
}
http
{
include mime.types;
default_type application/octet-stream;
fastcgi_intercept_errors on;
#设置字符集
charset utf-8;
#保存服务器名字的hash表是由指令server_names_hash_max_size
#和server_names_hash_bucket_size所控制的。参数hash bucket size总是等于hash表的大小,
#并且是一路处理器缓存大小的倍数。在减少了在内存中的存取次数后,使在处理器中加速查找hash表键值成为可能。如果hash bucket size等于一路处理器缓存的大小,那么在查找键的时候,最坏的情况下在内存中查找的次数为2。第一次是确定存储单元的地址,第二次是在存储单元中查找键 值。因此,如果Nginx给出需要增大hash max size
#或 hash bucket size的提示,那么首要的是增大前一个参数的大小
server_names_hash_bucket_size 128;
#客户端请求头部的缓冲区大小,这个可以根据你的系统分页大小来设置,
#一般一个请求的头部大小不会超过1k,不过由于一般系统分页都要大于1k,所以这里设置为分页大小。分页大小可以用命令getconf PAGESIZE取得。
#使用getconf PAGESIZE获得大小
client_header_buffer_size 4k;
large_client_header_buffers 8 128k;
#设置客户端上传文件大小
client_max_body_size 300m;
#/sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,
#对于普通应用,必须设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,
#以平衡磁盘与网络I/O处理速度,降低系统的uptime.
sendfile on;
#tcp_nopush与 tcp_nodelay 互相排斥
tcp_nopush on;
keepalive_timeout 60;
#tcp没有延迟。接受之后。立刻发送、设置为on组合为更大的帧发送。
tcp_nodelay off;
#设置缓存区的最大值
#Sets buffer size for reading client request body. In case the request body is larger than the buffer, the whole body or only its part is written to a temporary file. By default, buffer size is equal to two memory pages. This is 8K on x86,
#other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms.
client_body_buffer_size 512k;
#Defines a timeout for establishing a connection with a proxied server.
#It should be noted that this timeout cannot usually exceed 75 seconds.
#最大值不超过75s
proxy_connect_timeout 5;
#设置默认值60秒
#Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response.
# If the proxied server does not transmit anything within this time, the connection is closed.
proxy_read_timeout 60;
#Sets a timeout for transmitting a request to the proxied server. The timeout is set only between two successive write operations, not for the transmission of the whole request.
#If the proxied server does not receive anything within this time, the connection is closed.
proxy_send_timeout 60;
#设置proxy_buffer_size与 proxy_buffers值相等等于linux平台上getconf PAGESIZE
#Sets the number and size of the buffers used for reading a response from the proxied server,
#for a single connection. By default,
#the buffer size is equal to one memory page. This is either 4K or 8K,
# depending on a platform.
#以下三个参数保持一致
proxy_buffer_size 8k;
proxy_buffers 8 8k;
#设置为值必须大于proxy_buffers与proxy_buffer_size
proxy_busy_buffers_size 8k;
#当buffer放不下的时候写入文件的大小
proxy_temp_file_write_size 64k;
#设置文件路径
proxy_temp_path /usr/local/tengine/temp;
#设置缓存名字为cache_one;大小是200M;最大值是30G;保留时间1天。保存双份。
#proxy_cache cache_one;加入到location当中;可以启用cache:
如图:
proxy_cache_path /usr/local/tengine/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
#启动压缩
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#设置日志格式
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time $remote_addr';
#负载均衡设置
#权重1.运行失败次数3次,失败超时30s;
upstream resinServer {
server 192.168.0.28:31201 weight=1 max_fails=3 fail_timeout=60s;
server 192.168.0.28:31202 weight=1 max_fails=3 fail_timeout=60s;
server 192.168.0.61:31203 weight=1 max_fails=3 fail_timeout=60s;
server 192.168.0.61:31204 weight=1 max_fails=3 fail_timeout=60s;
#Tabbao的Tengine的特殊设置
#载录自http://tengine.taobao.org/document_cn/http_upstream_check_cn.html
Syntax: check interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [default_down=true|false] [type=tcp|http|ssl_hello|mysql|ajp] [port=check_port]
Default: 如果没有配置参数,默认值是:interval=30000 fall=5 rise=2 timeout=1000 default_down=true type=tcp
Context: upstream
该指令可以打开后端服务器的健康检查功能。
指令后面的参数意义是:interval:向后端发送的健康检查包的间隔。
fall(fall_count): 如果连续失败次数达到fall_count,服务器就被认为是down。
rise(rise_count): 如果连续成功次数达到rise_count,服务器就被认为是up。
timeout: 后端健康请求的超时时间。
default_down: 设定初始时服务器的状态,如果是true,就说明默认是down的,如果是false,就是up的。默认值是true,也就是一开始服务器认为是不可用,要等健康检查包达到一定成功次数以后才会被认为是健康的。
type:健康检查包的类型,现在支持以下多种类型tcp:简单的tcp连接,如果连接成功,就说明后端正常。
ssl_hello:发送一个初始的SSL hello包并接受服务器的SSL hello包。
http:发送HTTP请求,通过后端的回复包的状态来判断后端是否存活。
mysql: 向mysql服务器连接,通过接收服务器的greeting包来判断后端是否存活。
ajp:向后端发送AJP协议的Cping包,通过接收Cpong包来判断后端是否存活。
port: 指定后端服务器的检查端口。你可以指定不同于真实服务的后端服务器的端口,比如后端提供的是443端口的应用,你可以去检查80端口的状态来判断后端健康状况。默认是0,表示跟后端server提供真实服务的端口一样。该选项出现于Tengine-1.4.0。#设置3秒检查一次。次数达到5次认为down.成功尝试3次认为up.服务类型是http类型;
#是代理Resin所以使用了http协议。
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;
#Session机制。注意Session_sticky 没有ip_hash;稳定
#但是ip_bash.必须保证后端是真实服务器,不可以是squid之类的代理服务器
#session_sticky;
#活动链接保持30秒超时
keepalive_timeout 30s;
#解决不同用户登陆浏览器,可用独立使用Session。
#避免串号现象:即不同用户登陆,后一次登陆使用了前一次的菜单信息
ip_hash;
}
server {
listen 80;
server_name 192.168.0.28;
#轮询页面顺序
index login.jsp index.jsp;
root /opt/resin-pro-3.0.27/webapps/test
location / {
proxy_pass http://resinServer;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#静态页面缓存有效期是1天
location ~ .*\.(css|htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$
{
expores 1d;
}
location ~ .*\.(jsp|do|class|js)$
{
proxy_pass http://resinServer;
}
location /status{
check_status ;
access_log off;
}
access_log /usr/local/tengine/logs/access.log main;
error_log /usr/local/tengine/logs/error.log crit;
}
}
tengine mysql_[原创]Tengine与tengine 配置参数详解相关推荐
- ELK详解(二十五)——elastalert配置参数详解
今天继续给大家介绍Linux运维相关知识,本文主要内容是elastalert的配置参数详解. 一.配置文件参数详解 首先,我们来讲解一下elastalert的配置文件中的常用参数: 1.ES集群相关参 ...
- Ehcache配置参数详解
ehcache配置参数详解 <?xml version="1.0" encoding="UTF-8"?><ehcache><dis ...
- nginx下gzip配置参数详解
这篇文章主要介绍了nginx下gzip配置参数详解,本文同时给出了配置例子,以及一些注意事项,需要的朋友可以参考下 Nginx自带的有gzip模块 http://wiki.nginx.org/Ngin ...
- build.gradle配置参数详解
转载地址:http://blog.csdn.net/baidu_31093133/article/details/51860637 build.gradle配置参数详解//声明是Android程序ap ...
- RocketMQ-PushConsumer配置参数详解
基于RocketMQ 4.3,PushConsumer配置参数详解 1.Push消费模式下的配置 Push 默认使用的是DefaultMQPushConsumer. 2.consumerGroup C ...
- elastic-Job配置参数详解
elastic-Job配置参数详解 1. 注册中心配置 (1) reg:zookeeper命名空间属性说明 属性名 类型 是否必填 缺省值 描述 id String 是 注册中心在Spring容器 ...
- Spring Boot笔记—多线程系列(三)—配置参数详解
前言 前两篇文章,我们已经学会了如何使用spring boot的多线程和自定义线程池.这篇文章,我们要深入了解上一篇文章中线程池的配置具体含义. 准备工作 说明 为了方便观察线程的情况(如执行完毕数量 ...
- daemon.json配置参数详解
** daemon.json配置参数详解 ** 背景 docker安装的时候没有daemon.json这个文件 一般情况下,daemon.json中配置的项目参数,在启动参数中同样适用.(有些可能会冲 ...
- Windows--notes.ini文件的配置参数详解
notes.ini文件的配置参数详解 用过LOTUS NOTES的人们都知道NOTES.INI文件对于LOTUS的重要性,但是有关notes.ini的参数设置方面比较少提及.以下总结了NOTES.IN ...
- zookeeper的zoo.cfg配置参数详解
配置参数详解(主要是%ZOOKEEPER_HOME%/conf/zoo.cfg文件) 参数名说明 clientPort客户端连接server的端口,即对外服务端口,一般设置为2181吧. dataDi ...
最新文章
- 单机 Oracle 11g(11.2.0.4)手动打补丁PSU(11.2.0.4.8)
- codeblock使用中,多文件编译报XXXX undefined reference to XXX错问题
- 牛客网_PAT乙级_1015反转链表 (25)【没做出来】
- 数据库SQL基础语法
- python如何读取csv文件列表页_每25行读取一个csv文件,并使用python传递到列表
- PHP5.5中新增的参数跳跃和生成器功能介绍
- 如何实现RTSP/RTMP流接入到RTSP网关
- Python中字符串格式化输出的学习笔记
- mysql数据库的笔试题_MySQL数据库常见面试题
- 孤读Paper——《CenterNet:Objects as Points》
- 应届生软件测试面经_应届生软件测试面试自我介绍
- Zuul的3种超时问题,微服务响应超时问题,Zuul配置超时时间
- GSM Hacking:如何对GSM/GPRS网络测试进行测试
- 关于计算球体体积的Java代码啾咪~
- 树莓派 和 电脑共用显示屏 无屏幕玩转树莓派
- 微程序控制器的基本原理
- 在面试时候,如何简明扼要简述产品流程
- OmniPeek11安装 (驱动安装)
- 5G的关键技术与所面临的挑战
- python基础教程Day06
热门文章
- idea中maven配置的路径老是自动还原
- MSF基础--info/show targets
- IT运维管理指什么?如何建立有效的IT运维管理系统?
- Swagger简单使用
- springboot配置swagger
- stm32中c语言换行符error——expect a declaration warning——“\“followed by white space is not a line splic
- 弱电控制强电(电子)项目--物联网工厂创业项目(智能家居核心)
- 5、数据分析--洛杉矶房价预测
- 从事ERP行业经历的三个阶段的经验总结
- 王守义说13香,那iPhone12到底香不香?