[root@kakeru-cache01 ~]# varnishlog -i ReqHeader,RespHeader,BereqHeader,BerespHeader
* << BeReq >> 360459
- BereqHeader User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
- BereqHeader Host: 10.10.10.10
- BereqHeader Accept: */*
- BereqHeader X-Forwarded-For: 10.10.10.20
- BereqHeader Accept-Encoding: gzip ################### backendへのreqにはAccept-Encoding: gzipを使用
- BereqHeader X-Varnish: 360459
- BerespHeader Server: nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _SENSU_USER_=sensu | |
| _SENSU_PASS_=sensu | |
| _SENSU_SERVER_=10.10.10.10 | |
| stop_monit () { | |
| _HTTP_STATUS_=`curl -s -m 5 -X POST http://${_SENSU_USER_}:${_SENSU_PASS_}@${_SENSU_SERVER_}:4567/stashes -d "{\"path\" : \"silence/$1\", \"content\" : {\"reason\" : \"${REASON}\"} }" -w "status:%{http_code}" -o /dev/null` | |
| if [ $_HTTP_STATUS_ != "status:201" ]; then | |
| echo "stop_monit command failed" |
### tcpdumpでHeaderを可視化するで。特定backendとの通信を見てみよか。
$ /usr/sbin/tcpdump -i bond0.2168 -s 3000 -A dst host <対象backendのIP> or src host <対象backendのIP>
################### passナシ
...!..3.GET /kakeru.css HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
Host: 10.10.10.10
Accept: */*
X-Forwarded-For: 10.10.10.10## passナシ
[root@kakeru-varnish01 ~]# varnishlog -i ReqHeader,RespHeader,BereqHeader,BerespHeader
* << BeReq >> 32771
- BereqHeader User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
- BereqHeader Host: 10.10.10.10
- BereqHeader Accept: */*
- BereqHeader X-Forwarded-For: 10.10.10.20
- BereqHeader Accept-Encoding: gzip ################### gzip付けてbackendに聞いてる
- BereqHeader X-Varnish: 32771
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub vcl_recv { | |
| if (req.url ~ "^/hogehoge") { | |
| set req.backend_hint = hogehoge; | |
| return (pass); // ← remove code | |
| } | |
| ... | |
| } | |
| sub vcl_backend_response { | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kakerukaeru@PC-kakeru:~/chef/kakeru (master)$ ssh 192.168.32.161 -lkakeru_kaeru_test | |
| [email protected]'s password: | |
| UID must be less than 65535 | |
| Connection closed by 192.168.32.161 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 構文check | |
| varnishd -C -f /tmp/test.vcl | |
| ## clientとのやり取りのlog | |
| varnishlog -C | |
| ### よくこれでStatusだけcheckしたりしてる | |
| varnishlog -C | grep Status | |
| ## backendとのやり取りのlog | |
| varnishlog -b |
NewerOlder
