天天看點

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

繼續閱讀