原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://koumm.blog.51cto.com/703525/1282152
1
2
3
4
|
# vi /etc/syslog.conf
local3.* /
var
/log/haproxy.log
local0.* /
var
/log/haproxy.log
*.info;mail.none;authpriv.none;cron.none;local3.none /
var
/log/messages
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
# author: koumm
# desc:
# date:
2013
-
01
-
31
# version: v1.
0
# modify:
# cut haproxy log
mv /
var
/log/haproxy.log /
var
/log/haproxy.log.bak
if
[ -e /
var
/log/haproxy.log.bak ]; then
logrotate -f /etc/logrotate.conf
chown nobody:nobody /
var
/log/haproxy.log
chmod +x /
var
/log/haproxy.log
fi
sleep
1
if
[ -e /
var
/log/haproxy.log ]; then
rm -rf /
var
/log/haproxy.log.bak
fi
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
global
log
127.0
.
0.1
local0
maxconn
65535
chroot /usr/local/haproxy
uid
99
gid
99
stats socket /usr/local/haproxy/HaproxSocket level admin
daemon
nbproc
1
pidfile /usr/local/haproxy/haproxy.pid
#debug
defaults
log
127.0
.
0.1
local3
mode http
option httplog
option httplog clf
option httpclose
#option dontlognull
option forwardfor
option redispatch
retries
2
maxconn
2000
balance source
#balance roundrobin
stats uri /haproxy-stats
stats refresh 10s
contimeout
5000
clitimeout
50000
srvtimeout
50000
listen APP_Cluster
0.0
.
0.0
:
80
mode http
option httpchk GET /test.html HTTP/
1.0
\r\nHost:
192.168
.
0.110
server
192.168
.
0
.111_node1
192.168
.
0.111
:
80
weight
3
check inter
2000
rise
2
fall
1
server
192.168
.
0
.112_node2
192.168
.
0.112
:
80
weight
3
check inter
2000
rise
2
fall
1
server
192.168
.
0
.113_node3
192.168
.
0.113
:
80
weight
3
check inter
2000
rise
2
fall
1
listen stats_auth
0.0
.
0.0
:
91
mode http
stats enable
stats uri /admin
stats realm
"LOGIN"
stats auth admin:
123456
#stats hide-version
stats refresh 10s
stats admin
if
TRUE
|