Re: [squid-users] How do I clear the cache database without stopping squid?

From: Eliezer Croitoru <eliezer_at_ngtech.co.il>
Date: Tue, 25 Jun 2013 19:32:28 +0300

The way I gave you is the best with "no down time" option I can think of.
A restart means that instead of a slower response there will be a
connection reset or connection refused or no connection at all.

If you can automate to start another instance of squid and to monitor
that all the request was served from the second instance and then do that.
I never wrote a script with this size of effect since my idea will
require less complexity.
if you have q load-balancer like haproxy you can simply use two
backhands while they are being monitored and then wait for all the
connections move from on backend to the other.

My basic question is "why would you ever need to rm -rf the cache_dir??"
what version of squid are you using that you have corruption of the
cache_dir or the DB?

Eliezer

On 06/25/2013 04:47 PM, Daniele Segato wrote:
> On 06/21/2013 03:26 PM, Eliezer Croitoru wrote:
>> On 06/21/2013 02:45 PM, Daniele Segato wrote:
>>> Hi,
>>>
>>> is there a way to clear the cache without stopping / rebooting squid?
>>>
>>> I usually stop squid, remove the caches from the filesystem (rm -rf
>>> /path/where/the/cache/is), restart squid.
>>>
>>> Is there a way to clear that cache without the restart?
>>>
>>> Thanks,
>>> Daniele Segato
>> you can do a small tick if you want to just reload down times.
>>
>> change the conf file to no cache_dir at all.
>> reload squid
>> then erase manually the cache_dir.
>> after that just run another squid.conf file with the settings of the
>> cache_dir in it with a -z option.
>> squid -f /etc/squid/squid_res.conf -z
>>
>> now you got squid running with no shutdown but without cache_dir.
>> The cache dir also was erased and initialized.
>> you only need to change back the original conf file and then reload the
>> settings again.
>>
>> Hope the recipe will help you.
>>
>> Eliezer
>
> I see, wouldn't it be the same to restart only once with a different
> cache_dir ?
>
> next question:
> can I change the cache dir with an environment variable?
>
> I'm using Jenkins to do release, so I had to automate it and remove
> down-time. Ideally it should be no downtime.
>
> thank you
>
> sorry for the late response
>
> regards,
> Daniele Sesgato
Received on Tue Jun 25 2013 - 16:32:56 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 25 2013 - 12:00:06 MDT