varnish-4.x VCL之healthy check
更多帮助请man vcl
示例:
如下是本人测试的示例文件,包含healthcheck申明,director引用, purge acl
vcl
4.0;
import
std;
import
directors;
probe
healthcheck_nginx {
}
probe
healthcheck_apache {
}
backend
nginx {
}
backend
apache {
}
sub
vcl_init {
}
acl
purgers {
}
sub
vcl_recv {
}
sub
vcl_purge {
}
sub
vcl_deliver {
}
如下这段定义healthcheck,格式
probe healthcheck_nginx
{
}
一句话,5秒监测一次,最新的5次监测中,有3次成功则判定为healthy
实时查看健康状态
watch -n.5 varnishadm backend.list
watch -n.5 varnishadm debug.health
varnishlog -g raw -i Backend_health
相关栏位解释
root@config-p:~#varnishlog -g raw -i Backend_health
root@config-p:jlive#varnishadm debug.health
Backend nginx is
Healthy
Current states
good: 5 threshold:
3 window: 5
Average responsetime of good
probes: 0.000249
Oldest
Newest
================================================================
4444444444444444444444444444444444444444444444444444444444444444
Good IPv4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Good Xmit
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Good Recv
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Happy
Backend apache is
Healthy
Current states
good: 4 threshold: 3 window:
5
Average responsetime of good
probes: 0.000363
Oldest
Newest
================================================================
444444444444444444444444444444444-----4444444444444444444444444-
Good IPv4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-----XXXXXXXXXXXXXXXXXXXXXXXXX-
Good Xmit
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR-----RRRRRRRRRRRRRRRRRRRRRRRRR-
Good Recv
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH-----HHHHHHHHHHHHHHHHHHHHHHHHH-
Happy
root@config-p:~#varnishadm
debug.health
Backend nginx is
Healthy
Current states
good: 5 threshold:
3 window: 5
Average responsetime of good
probes: 0.000243
Oldest
Newest
================================================================
4444444444444444444444444444444444444444444444444444444444444444
Good IPv4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Good Xmit
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
Good Recv
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Happy
Backend apache is
Sick
Current states
good: 2 threshold: 3 window:
5
Average responsetime of good
probes: 0.000363
Oldest
Newest
================================================================
4444444444444444444444444444444-----4444444444444444444444444---
Good IPv4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-----XXXXXXXXXXXXXXXXXXXXXXXXX---
Good Xmit
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR-----RRRRRRRRRRRRRRRRRRRRRRRRR---
Good Recv
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH-----HHHHHHHHHHHHHHHHHHHHHHHHH---
Happy