How to clear the cache of squid in Linux system
This article introduces the knowledge of "how to clear the squid cache in the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
To clear the proxy cache on linux or Unix running Squid, this is a rough method, and squidclient is also used. A good way is to script, especially if there are many websites and complex url parameters.
Step 1: determine the location of the squid proxy cache
The code is as follows:
# grep cache_dir / etc/squid/squid.conf / / directly grab the path of the cached directory in the configuration file of squid
The output is as follows. Depending on the directory specified by your compilation and installation, the result may be different.
The code is as follows:
# cache_dir ufs / var/spool/squid 100 16 256
Step 2: clear the squid proxy cache
The code is as follows:
# squid-k shutdown / / disable the squid service
# rm-rf / var/spool/squid/ Delete the cache directory
Rebuild cache directory
The code is as follows:
# squid-z
The output is as follows:
The code is as follows:
04:24:19 on 2013-08-24 | Making directories in / var/spool/squid/00
04:24:19 on 2013-08-24 | Making directories in / var/spool/squid/01
04:24:19 on 2013-08-24 | Making directories in / var/spool/squid/02
04:24:20 on 2013-08-24 | Making directories in / var/spool/squid/03
04:24:20 on 2013-08-24 | Making directories in / var/spool/squid/04
04:24:20 on 2013-08-24 | Making directories in / var/spool/squid/05
04:24:20 on 2013-08-24 | Making directories in / var/spool/squid/06
Restart Squid:
The code is as follows:
# squid or # service squid start
Output after running:
The code is as follows:
Starting squid: [OK]
Step 3: confirm that Squid is running
The code is as follows:
# netstat-tulpn | grep: 3128 / / check whether port 3128 used by squid is in use
You can also check the access.log or cache.log of squid to check whether squid is running properly, as follows:
The code is as follows:
# tail-f / var/log/squid/access.log
# tail-f / var/log/squid/cache.log
This is the end of the content of "how to clear the squid cache in the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!