

GitHub - vicanso/varnish-agent: 让varnish更简单
source link: https://github.com/vicanso/varnish-agent?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
varnish-agent
varnish-agent
提供界面化的配置管理,配置信息保存于etcd
中,当配置信息有更新时,自动更新配置并重新加载,方便多实例的配置管理。varnish-agent
设置的varnish默认的ttl
为0,因此如果不设置Cache-Control
的所有请求都为不可缓存,尽量使用Cache-Control
来控制接口的缓存时间。
需要注意,varnish-agent
默认的probe
如下:
probe basicProbe {
.url = "/ping";
.interval = 3s;
.timeout = 5s;
.window = 5;
.threshold = 3;
}
所以对于backend都需要添加相应的health check处理(/ping),如果有需要自定义的,可以去调整template.vcl
后,自行重新编译。
参数说明:
CONFIG
配置etcd的连接地址,此参数必须指定,如CONFIG=etcd://192.168.31.176:2379/varnish-test
AUTH
agent的认证配置,如AUTH=user:pwd
,如果不配置则不使用认证,建议指定此参数ADMIN_PATH
管理后台的路径,如果不配置,则为/agent
PARAMS
varnish的启动参数,如PARAMS="-a :8080 -s malloc,256m"
,需要注意的是,varnish的启动参数默认会添加-F -p default_ttl=0
,而-a
如果未指定,则指定为:8080
,-s
如果未指定,则指定为malloc,1G
,一般不需要调整此参数
docker run -d --restart=always \ -p 8080:8080 \ -e CONFIG=etcd://10.254.136.81:2379/varnish \ -e AUTH=user:pwd \ -e ADMIN_PATH=/@agent \ --name varnish-agent \ vicanso/varnish-agent
启动成功后,访问http://127.0.0.1:8080/@agent/
,则可进入管理后台。
添加director
在更新相关配置后,会自动更新加载最新的配置文件(其它实例也会同时更新),当前最新的配置可在Basic Info
中查看,需要注意的是,由于file是根据时间生成,因此不同实例有可能不一致,判断配置文件是否一致应该根据hash
值。
Recommend
-
58
my articles
-
46
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
-
31
-
51
-
56
-
31
axios妙用技巧 应用开发中,各服务的调用使用最多的就是HTTP的形式,使用的HTTP client也从request --> superagent --> axios。axios中的各类函数都是基于promise的形式,虽然我也钟情于superagent的链...
-
42
go-axios入门 日常开发中,各服务主要都是REST的形式提供接口服务,因此HTTP Client则是开发中的重中之重。golang中自带的HTTP Client已经能满足各类的场景,但是在使用的时候,各依赖服务的调用都基于同一模块,调整相关代码时影响较大...
-
26
Tree Xie edited this page on May 5 · 8 revisions ...
-
35
varnish-agent varnish-agent 提供界面化的配置管理,配置信息保存于 etcd 中,当配置信息有更新时,自动更新配置并重新加载,方便多实例的配置管理。 varnish-agent 设置的varnish默...
-
43
Home · vicanso/elton Wiki · GitHub Tree Xie edited this page on Mar 15...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK