Skip to content Skip to main navigation Skip to footer

如何清除squid proxy 缓存以及重新创建缓存目录

在linux系统或者unix系统里,如何清除squid缓存,以及怎么重新创建缓存目录呢?
可以通过下面的方法来来删除或清空缓存并重新创建缓存目录。
步骤#1:查找Squid缓存的目录位置

#grep cache_dir  /etc/squid/squid.conf
 

命令输出:

cache_dir ufs /var/spool/squid 110 17 25
 

步骤#2:以空缓存目录的方式,重启Squid服务  

#squid -k shutdown
#rm -rf /cache/
#rm -rf /var/spool/squid/
 

重新创建缓存目录

#squid -z
 

命令输出:

2013/08/30 08:14:29| Making directories in /var/spool/squid/00
2013/08/30 08:14:29| Making directories in /var/spool/squid/01
2013/08/30 08:14:29| Making directories in /var/spool/squid/02
2013/08/30 08:14:30| Making directories in /var/spool/squid/03
2013/08/30 08:14:30| Making directories in /var/spool/squid/04
 

重启squid服务:

#squid
 

#service squid start
 

命令输出:

Starting squid:                                            [  OK  ]
 

步骤#3:验证Squid是否正在运行

# netstat -tulpn | grep :3128
# tail -f /var/log/squid/access.log
# tail -f /var/log/squid/cache.log
 
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published.