how to flush squid
File size limit exceeded solution
squid dead but pid file exists solution
how to flush cache on squid
BEFORE START THIS PROGRESS PLZ MAKE SURE UR SQUID IS TOTALLY STOP
1. Check squid cache location on your Linux system. the default location may be at /var/spool/squid directory, but you can use command as show on the example below to check squid cache directory on your system.
[root@fedora10 ~]# cat /etc/squid/squid.conf | grep ^cache_dir
cache_dir ufs /var/spool/squid 4000 16 256
[root@fedora10 ~]#
2. Verify squid cache directory by list contents inside squid cache directory. The contents of squid cache directory should look like on example below.
[root@fedora10 ~]# ls /var/spool/squid
00 02 04 06 08 0A 0C 0E swap.state
01 03 05 07 09 0B 0D 0F
[root@fedora10 ~]#Stop squid cache proxy server.
In order to clear squid cache, we need to stop squid proxy first. the step below show example to stop squid proxy server on Linux Fedora system. NOTE:- Make sure that you stop squid proxy first before attempt to clear squid cache.
3. Check squid proxy status.
[root@fedora ~]# service squid status
squid (pid 7593) is running...
[root@fedora ~]#
4. Stop squid proxy server.
[root@fedora ~]# service squid stop
Stopping squid: ................ [ OK ]
[root@fedora ~]#
5. Verify that squid proxy is stop.
[root@fedora ~]# service squid status
squid is stopped
[root@fedora ~]#
Create directory and move squid cache file.
Create new directory to temporary store the old squid cache files... why we shoud do this??? the answer... to minimize squid proxy downtime. First we need to create directory and then move the old squid cache file to this directory.
6. Make directory and verify.
[root@fedora ~]# mkdir /var/spool/squid/squid_cache_old
[root@fedora ~]#
[root@fedora ~]# ls /var/spool/squid/
00 02 04 06 08 0A 0C 0E squid_cache_old swap.state.last-clean
01 03 05 07 09 0B 0D 0F swap.state
[root@fedora ~]#
7. Then move and clear squid cache directory contents to /var/spool/squid/squid_cache_old directory.
[root@fedora ~]# mv /var/spool/squid/?? /var/spool/squid/squid_cache_old/
[root@fedora ~]# mv /var/spool/squid/swap* /var/spool/squid/squid_cache_old/
[root@fedora ~]#
8. Verify the contents of the squid cache directory.
[root@fedora ~]# ls /var/spool/squid/
squid_cache_old
[root@fedora ~]#
Start squid with new cache.
9. Create squid cache directory (Rebuild squid cache).
[root@fedora ~]# squid -z
2009/06/08 07:16:32| Creating Swap Directories
2009/06/08 07:16:32| /var/spool/squid exists
2009/06/08 07:16:32| Making directories in /var/spool/squid/00
2009/06/08 07:16:32| Making directories in /var/spool/squid/01
2009/06/08 07:16:32| Making directories in /var/spool/squid/02
2009/06/08 07:16:32| Making directories in /var/spool/squid/03
2009/06/08 07:16:32| Making directories in /var/spool/squid/04
2009/06/08 07:16:32| Making directories in /var/spool/squid/05
2009/06/08 07:16:32| Making directories in /var/spool/squid/06
2009/06/08 07:16:32| Making directories in /var/spool/squid/07
2009/06/08 07:16:32| Making directories in /var/spool/squid/08
2009/06/08 07:16:32| Making directories in /var/spool/squid/09
2009/06/08 07:16:32| Making directories in /var/spool/squid/0A
2009/06/08 07:16:32| Making directories in /var/spool/squid/0B
2009/06/08 07:16:32| Making directories in /var/spool/squid/0C
2009/06/08 07:16:32| Making directories in /var/spool/squid/0D
2009/06/08 07:16:32| Making directories in /var/spool/squid/0E
2009/06/08 07:16:32| Making directories in /var/spool/squid/0F
[root@fedora ~]#
10. View squid cache directory contents to verify the cache file exist.
[root@fedora ~]# ls /var/spool/squid/
00 02 04 06 08 0A 0C 0E squid_cache_old
01 03 05 07 09 0B 0D 0F
[root@fedora ~]#
11. Start squid with new clean cache, and then verify squid proxy server is up and running.
[root@fedora ~]# service squid start
Starting squid: . [ OK ]
[root@fedora ~]#
[root@fedora ~]# service squid status
squid (pid 9202) is running...
[root@fedora ~]#
Remove squid cache.
Then remove old squid cache, this part should be done after you start the squid proxy server with new clean cache file. This part may take a while base on the size of squid cache directory. Please Note:- If you follow this article correctly, total downtime of your squid proxy server may be under 1 minutes because we already start squid proxy server with clean cache and after that we remove old squid cache file that may take lot of overall time to complete the procedure.
12. Remove squid cache in the /var/spool/squid/squid_cache_old directory. Do this step with caution...
[root@fedora ~]# rm -rf /var/spool/squid/squid_cache_old/
[root@fedora ~]#