天天看点

haproxy

reverse proxy:http,pop3/imapd

web server

nginx:

反向代理URI,代理后端某服务器;

proxy_pass,rewrite

upstream:将一组后端计算机定义集群

rr

ip_hash

least_conn:最小连接

lc,wlc

proxy:

/bbs

/php

/images

worker_process:

cpu:1

io:1.5

亲缘性:           

最多有65535个套接字

web monitor

URL:基于URL调度,来提高缓存命中率

O(1):指的是一个进程队列性能评估基础

poll:把当前的文件指针挂到等待队列中,他是一个函数

配置haproxy:

最优先处理的命令行参数;

global设定全局等配置参数;

proxy(代理段)相关配置段,如default,listen,frontend,backend;

daemon:表示启动守护进程(指的是某个进程不因为用户或者终端或其他的变化而受到影响,可以在后台执行的程序,该程序一般不显示在终端输出)

例子:

global

daemon

maxconn 25600

defaults

mode http

timeout connect 5000ms

timeout client 50000ms

timeout server 50000ms

frontend http-in

bind *:80

default_backend servers

backend servers

server server1 127.0.0.1:8080 maxconn 32

详细参数见配置文档

syslog:

facility.priority

http://www.magedu.com/admin.php?a=3&

ulimit -n

listen web

bind *:80

haproxy配置方法:代理后端http服务器

yum install haproxy

rpm -ql haproxy

vim /etc/sysconfig/rsyslog

SYSLOGD_OPTIONS="-c 2 -r"

vim /etc/rsyslog.conf

local2.* /var/log/haproxy.log

vim /etc/haproxy

listen stats(通过web界面查看状态访问的端口号)

bind 0.0.0.0:1080

stats enable

stats hide-version

stats uri /haproxyadmin?stats

stats realm Haproxy\ Statistics

stats auth admin:admin

stats admin if TRUE

frontend httpd

log global

option httpclose

option logasap

option dontlognull

capture request header Host len 20

capture request header Referer len 60

frontend healthcheck

bind :1099

option forwardfor

backend servers

balance roundrobin

server websrv1 192.168.10.11:80 check maxconn 2000

server websrv2 192.168.10.12:80 check maxconn 2000

用haproxy代理MySQL服务:要采用TCP协议

mode tcp

log global

option httplog

option

retries 3

timeout http-request 10s

timeout queue 1m

timeout connect 10s

timeout client 1m

timeout server 1m

timeout http-keep-alive 10s

timeout check 10s

maxconn 600

dontlognull

retries 3

timeout queue 1m

timeout server 1m

timeout http-keep-alive 10s

timeout check 10s

maxconn

listen stats

继续阅读