[SOLVED] Multiple Instances of Squid on One Server
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to setup multiple instances of Squid on one server. I have done the following:
1. Created separate squid-bao folder under /etc/squid/
2. Created separate squid-bao.conf file under/etc/squid/squid-bao
3. Created a script to start this instance of squid which contains the following:
exec /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf $@
4. Created a /var/log/squid/squid-bao folder.
5. Created a /var/cache/squid/squid-bao folder.
I am seeing the following error messages when trying to start this instance of Squid:
Aug 21 07:36:36 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:36 twausoproxy03 squid[15555]: Squid Parent: child process 15583 exited due to signal 6
Aug 21 07:36:39 twausoproxy03 squid[15555]: Squid Parent: child process 15596 started
Aug 21 07:36:39 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:39 twausoproxy03 squid[15555]: Squid Parent: child process 15596 exited due to signal 6
Aug 21 07:36:42 twausoproxy03 squid[15555]: Squid Parent: child process 15609 started
Aug 21 07:36:42 twausoproxy03 (squid): Failed to verify one of the swap directories, Check cache.log for details. Run 'squid -z' to create swap directories if needed, or if running Squid for the first time.
Aug 21 07:36:42 twausoproxy03 squid[15555]: Squid Parent: child process 15609 exited due to signal 6
Aug 21 07:36:42 twausoproxy03 squid[15555]: Exiting due to repeated, frequent failures
Aug 21 07:45:23 twausoproxy03 syslog-ng[2370]: STATS: dropped 0
So I edited my startup script (squid-bao.sh) to include the -z switch
exec /usr/sbin/squid -z /etc/squid/BAO/squid-bao.conf $@
When I run the script it says it is creating the
2012/08/21 07:50:50| Creating Swap Directories
but when I go into the /var/cache/squid/squid-bao folder there are no folders. I have the following in the squid-bao.conf file:
Please note that you need to run squid -z only once, so it creates the needed directory structure for its cache. After that start squid normally without the -z option.
Also note that the squid user must have r/w access to the cache directory.
Now I have another question. Now that the bao instance is able to start and actually run. When I run the squid-bao.sh script to start this instance it also starts the original instance of squid that uses squid.conf. I want them to be totally separate. Is there another switch I should add to the script or a setting in the squid-bao.conf file I should set?
Also, how to stop each instance of Squid separately so I am not unloading both of them when I do not want to?
I got it figured out and what was causing me to see the regular Squid instance. It was not the reqular Squid instance I was seeing. So you were correct. To create the squid-bao.conf I copied the squid.conf file and I forgot to remove the method of authentication we are using with that Squid instance. Once I removed that it works fine. I also found that I had to add exec to the stop script, then shutdown worked.
Glad to see you've done it.
Just a FYI: the "squid -k shutdown" is indeed working, but it takes some time for squid to stop, as it has to close the files opened for its cache. If you want to stop squid instantly you can use "kill" instead of "shutdown".
You may also mark the thread "Solved" from the "Thread Tools" on top of the page.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.