squidclient 使用方法
2013-04-22 17:28
537 查看
一.squidclient的使用
查看帮助
基本使用:
二.cacahemgr.cgi程序
squidclient得到的信息都可以运行Squid提供的CGI程序cachemgr.cgi获得:
将cachemgr.conf拷到Apache的cgi-bin目录,也可是其他支持CGI的WEB服务器
1.squid.conf中有关cachemgr.cgi的配置
访问http://ip/cgi-bin/cachecgi.cgi时Managername:就是managerPassword:就是unixvip
因为squid不是运行在3128端口,还要修改cachemgr.conf文件,cachemgr.cgi运行时会读取这个文件
cachemgr.conf只有一行,hostanme:port形式,例如:
启动Apache,输入http://ip/cgi-bin/cachecgi.cgi登录即可获得Squid的各种状态信息。
注:Squid.conf中进行了上面的配置,squidclient应该增加-Umanager-Wunixvip参数
三.使用squidclient删除缓存对象
(参考Squid权威指南)
(1)缓新缓存
刷新缓存,在uri前面使用-r选项,如果refresh_pattern指令里设置了ignore-reload选项,则不能刷新缓存,而只能采用
删除缓存的办法。
(2)删除缓存
使用squid独有的PURGE请求.(squidclient-mPURGE选项),例如,清除某个URL缓存
(2)删除一组对象,<<squid权威指南>>提供的方法:
#awk'{print$7}'/usr/local/squid/var/logs/access.log\
|grepwww.example.com\
|xargs-n1squidclient-mPURGE
它所进行的操作是:
1)使用awk取出access.log中第7个域(实际上是访问的url记录).
2)使用grep过虑出某个域名的记录。
3)传递给squidclient-mPURGE命令执行
(3)删除所有缓存对像
方法1
#echo''>/usr/local/squid/var/cache/swap.state#放一个单字节进去
方法2:
停止Squid,重命名旧缓存目录->新建一个空缓存目录->squid-z->删除旧缓存目录
Squid的一些状态信息
#squidclient-Umanager-Wtest-p80mgr:info
Connectioninformationforsquid:
Numberofclientsaccessingcache:2#访问客户端数量
NumberofHTTPrequestsreceived:2#收到http请求数量
NumberofICPmessagesreceived:0#收到ICP请求数量
NumberofICPmessagessent:0#发送ICP请求数量
NumberofqueuedICPreplies:0
NumberofHTCPmessagesreceived:0
NumberofHTCPmessagessent:0
Requestfailureratio:0.00
AverageHTTPrequestsperminutesincestart:0.2#平均每分钟http请求数量
AverageICPmessagesperminutesincestart:0.0#平均每分钟ICP请求数量
Selectloopcalled:524times,975.494msavg
Cacheinformationforsquid:
RequestHitRatios:5min:0.0%,60min:0.0%#5分钟/60分钟请求命中率
ByteHitRatios:5min:-0.0%,60min:-0.0%#5分钟/60分钟命中率,以Byte计算
RequestMemoryHitRatios:5min:0.0%,60min:0.0%#内存中请求命中率
RequestDiskHitRatios:5min:0.0%,60min:0.0%#磁盘请求命中率
StorageSwapsize:200KB#cache对象占用硬盘的存储空间
StorageMemsize:116KB#cache对象占用内存的存储空间
MeanObjectSize:7.69KB
Requestsgiventounlinkd:0
MedianServiceTimes(seconds)5min60min:
HTTPRequests(All):0.000000.00721
CacheMisses:0.000000.00721
CacheHits:0.000000.00000
NearHits:0.000000.00000
Not-ModifiedReplies:0.000000.00000
DNSLookups:0.000000.00000
ICPQueries:0.000000.00000
Resourceusageforsquid:
UPTime:511.159seconds
CPUTime:0.155seconds
CPUUsage:0.03%
CPUUsage,5minuteavg:0.00%#5分钟内平均CPU使用率
CPUUsage,60minuteavg:0.03%#60分钟内平均CPU使用率
ProcessDataSegmentSizeviasbrk():2108KB
MaximumResidentSize:0KB
Pagefaultswithphysicali/o:0
Memoryusageforsquidviamallinfo():
Totalspaceinarena:2108KB
Ordinaryblocks:2068KB5blks
Smallblocks:0KB0blks
Holdingblocks:15628KB3blks
FreeSmallblocks:0KB
FreeOrdinaryblocks:39KB
Totalinuse:17696KB100%
Totalfree:39KB0%
Totalsize:17736KB
Memoryaccountedfor:
Totalaccounted:225KB
memPoolAlloccalls:2785
memPoolFreecalls:1551
Filedescriptorusageforsquid:
Maximumnumberoffiledescriptors:65536#能使用的最大文件描述符
Largestfiledesccurrentlyinuse:21
Numberoffiledesccurrentlyinuse:19
Filesqueuedforopen:0
Availablenumberoffiledescriptors:65517
Reservednumberoffiledescriptors:100
StoreDiskfilesopen:0
IOloopmethod:epoll
InternalDataStructures:
55StoreEntries
29StoreEntrieswithMemObjects
28HotObjectCacheItems
26on-diskobjects
查看帮助
1 | squidclient-h |
2 | squidclient-p80mgr: |
3 |
4 | -hhostRetrieveURLfromcacheonhostname.Defaultislocalhost. |
5 | -lhostSpecifyalocalIPaddresstobindto.Defaultisnone. |
6 | -pportPortnumberofcache.Defaultis3128. |
7 | -UuserWWWauthenticationusername |
8 | -WpasswordWWWauthenticationpassword |
1 | squidclient-p80mgr:info#squid的运行统计信息 |
2 | squidclient-p80mgr:mem#内存使用情况 |
3 | squidclient-p80mgr:diskd#硬盘缓存使用情况 |
4 | squidclient-p80mgr:objects#已经缓存的列表 |
5 | squidclient-p80mgr:io#IO情况 |
squidclient得到的信息都可以运行Squid提供的CGI程序cachemgr.cgi获得:
将cachemgr.conf拷到Apache的cgi-bin目录,也可是其他支持CGI的WEB服务器
1.squid.conf中有关cachemgr.cgi的配置
1 | acllocalhostsrc127.0.0.1/255.255.255.255 |
2 | aclmanagerprotocache_object |
3 | http_accessallowmanagerlocalhost#只允许localhost |
4 | http_accessdenymanager |
5 | #cachemgr_passwdunixvipall |
6 | cachemgr_passwdunixvipinfostats/objects |
因为squid不是运行在3128端口,还要修改cachemgr.conf文件,cachemgr.cgi运行时会读取这个文件
cachemgr.conf只有一行,hostanme:port形式,例如:
1 | localhost:80 |
注:Squid.conf中进行了上面的配置,squidclient应该增加-Umanager-Wunixvip参数
三.使用squidclient删除缓存对象
(参考Squid权威指南)
(1)缓新缓存
刷新缓存,在uri前面使用-r选项,如果refresh_pattern指令里设置了ignore-reload选项,则不能刷新缓存,而只能采用
删除缓存的办法。
1 | #squidclient-r |
2 |
3 | #squidclient-r"http://www.unixvip.cn/" |
使用squid独有的PURGE请求.(squidclient-mPURGE选项),例如,清除某个URL缓存
1 | squidclient-p80-mPURGE | 'target='_blank'>http://www.unixvip.com/test[/code]
#awk'{print$7}'/usr/local/squid/var/logs/access.log\
|grepwww.example.com\
|xargs-n1squidclient-mPURGE
它所进行的操作是:
1)使用awk取出access.log中第7个域(实际上是访问的url记录).
2)使用grep过虑出某个域名的记录。
3)传递给squidclient-mPURGE命令执行
(3)删除所有缓存对像
方法1
#echo''>/usr/local/squid/var/cache/swap.state#放一个单字节进去
方法2:
停止Squid,重命名旧缓存目录->新建一个空缓存目录->squid-z->删除旧缓存目录
Squid的一些状态信息
#squidclient-Umanager-Wtest-p80mgr:info
Connectioninformationforsquid:
Numberofclientsaccessingcache:2#访问客户端数量
NumberofHTTPrequestsreceived:2#收到http请求数量
NumberofICPmessagesreceived:0#收到ICP请求数量
NumberofICPmessagessent:0#发送ICP请求数量
NumberofqueuedICPreplies:0
NumberofHTCPmessagesreceived:0
NumberofHTCPmessagessent:0
Requestfailureratio:0.00
AverageHTTPrequestsperminutesincestart:0.2#平均每分钟http请求数量
AverageICPmessagesperminutesincestart:0.0#平均每分钟ICP请求数量
Selectloopcalled:524times,975.494msavg
Cacheinformationforsquid:
RequestHitRatios:5min:0.0%,60min:0.0%#5分钟/60分钟请求命中率
ByteHitRatios:5min:-0.0%,60min:-0.0%#5分钟/60分钟命中率,以Byte计算
RequestMemoryHitRatios:5min:0.0%,60min:0.0%#内存中请求命中率
RequestDiskHitRatios:5min:0.0%,60min:0.0%#磁盘请求命中率
StorageSwapsize:200KB#cache对象占用硬盘的存储空间
StorageMemsize:116KB#cache对象占用内存的存储空间
MeanObjectSize:7.69KB
Requestsgiventounlinkd:0
MedianServiceTimes(seconds)5min60min:
HTTPRequests(All):0.000000.00721
CacheMisses:0.000000.00721
CacheHits:0.000000.00000
NearHits:0.000000.00000
Not-ModifiedReplies:0.000000.00000
DNSLookups:0.000000.00000
ICPQueries:0.000000.00000
Resourceusageforsquid:
UPTime:511.159seconds
CPUTime:0.155seconds
CPUUsage:0.03%
CPUUsage,5minuteavg:0.00%#5分钟内平均CPU使用率
CPUUsage,60minuteavg:0.03%#60分钟内平均CPU使用率
ProcessDataSegmentSizeviasbrk():2108KB
MaximumResidentSize:0KB
Pagefaultswithphysicali/o:0
Memoryusageforsquidviamallinfo():
Totalspaceinarena:2108KB
Ordinaryblocks:2068KB5blks
Smallblocks:0KB0blks
Holdingblocks:15628KB3blks
FreeSmallblocks:0KB
FreeOrdinaryblocks:39KB
Totalinuse:17696KB100%
Totalfree:39KB0%
Totalsize:17736KB
Memoryaccountedfor:
Totalaccounted:225KB
memPoolAlloccalls:2785
memPoolFreecalls:1551
Filedescriptorusageforsquid:
Maximumnumberoffiledescriptors:65536#能使用的最大文件描述符
Largestfiledesccurrentlyinuse:21
Numberoffiledesccurrentlyinuse:19
Filesqueuedforopen:0
Availablenumberoffiledescriptors:65517
Reservednumberoffiledescriptors:100
StoreDiskfilesopen:0
IOloopmethod:epoll
InternalDataStructures:
55StoreEntries
29StoreEntrieswithMemObjects
28HotObjectCacheItems
26on-diskobjects
相关文章推荐
- 使用hdfsclient遇到的kerberos解决方法
- linux 上使用commons-net.jar中 FTPClient类的listFiles、retrieveFile等方法停止不执行,出现假死状态解决办法
- CentOS下使用Squid架设CDN服务器的方法
- squid的基本使用方法
- 使用Java实现简单的server/client回显功能的方法介绍
- Android HttpClient GET或者POST请求基本使用方法
- client.transport.sniff的使用方法
- Android系列之网络(三)----使用HttpClient发送HTTP请求(分别通过GET和POST方法发送数据)
- 警惕使用WebClient.DownloadFile(string uri,string filePath)方法
- 使用JS,JQ获取offset-*,client-*,scroll-*的方法总结
- javascript的offset、client、scroll使用方法
- SSH Secure Shell Client的使用方法
- HttpClient使用方法(包括POST文件)
- Apache Common HttpClient七种常用使用方法和注意事项
- 最新google play内购(com.android.billingclient) 教程 代码 封装 使用方法
- httpclient 简单介绍使用方法
- Android 异步请求类库Async_Http_Client的使用方法
- 杂谈,以及HttpClient过时后,继续使用HttpClient的方法
- Android系列之网络(一)----使用HttpClient发送HTTP请求(通过get方法获取数据)
- Android系列之网络(一)----使用HttpClient发送HTTP请求(通过get方法获取数据)