LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-21-2012, 07:55 AM   #1
sjfast911
LQ Newbie
 
Registered: Jul 2007
Distribution: Sles
Posts: 10

Rep: Reputation: 0
Multiple Instances of Squid on One Server


Good morning,

Using sles10sp4

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:

cache_dir ufs /var/cache/squid/squid-bao 100 16 256

What am I doing wrong or what have I missed?

Scott
 
Old 08-21-2012, 04:04 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
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 $@
I guess you have to run:
Code:
/usr/sbin/squid -z -f /etc/squid/BAO/squid-bao.conf
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.

Regards
 
Old 08-22-2012, 08:30 AM   #3
sjfast911
LQ Newbie
 
Registered: Jul 2007
Distribution: Sles
Posts: 10

Original Poster
Rep: Reputation: 0
That worked once I figured out the how to apply the correct rights to the squid-bao folder for the squid user. Thanks for the help!!

Scott
 
Old 08-22-2012, 08:38 AM   #4
sjfast911
LQ Newbie
 
Registered: Jul 2007
Distribution: Sles
Posts: 10

Original Poster
Rep: Reputation: 0
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?

Thanks again,
Scott
 
Old 08-22-2012, 12:08 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Are you sure that the plain squid instance is started by your script? Normally it should start as a system service on boot, or using
Code:
service squid start
Same goes for stopping squid.

If you want to stop every instance independently from the other, you can use
Code:
/usr/sbin/squid -f /path/to/instance/squid.conf -k shutdown
Regards
 
Old 08-23-2012, 09:24 AM   #6
sjfast911
LQ Newbie
 
Registered: Jul 2007
Distribution: Sles
Posts: 10

Original Poster
Rep: Reputation: 0
If I do a ps -ef |grep squid before I run my start script I see this:

twausoproxy03:/etc/squid/BAO # ps -ef |grep squid
root 13739 12142 0 09:22 pts/0 00:00:00 grep squid

After running my script I see this:

twausoproxy03:/etc/squid/BAO # ps -ef |grep squid
root 13742 1 0 09:22 ? 00:00:00 /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf
squid 13744 13742 0 09:22 ? 00:00:00 (squid) -f /etc/squid/BAO/squid-bao.conf
squid 13745 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13746 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13747 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13748 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13749 13744 0 09:22 ? 00:00:00 (squid_ldap_auth) -b ou=people,o=hcsc -f CN=%s -D cn=squidauth,ou=adm,o=hcsc -w CTpFA7y1 -h 10.135.128.210
squid 13750 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13751 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13752 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13753 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13754 13744 0 09:22 ? 00:00:00 (squid_ldap_group) -b ou=people,o=hcsc -f (&(cn=%g)(objectclass=group)(member=%u)) -u cn -h 10.135.128.210
squid 13755 13744 0 09:22 ? 00:00:00 (unlinkd)
root 13757 12142 0 09:22 pts/0 00:00:00 grep squid


This is my script:
root 13742 1 0 09:22 ? 00:00:00 /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf
squid 13744 13742 0 09:22 ? 00:00:00 (squid) -f /etc/squid/BAO/squid-bao.conf

The rest is the plain Squid instance.

Also that stop script does not work. I still see all of the instances running after I run the stop script.

Any suggestions?

Thanks
Scott
 
Old 08-23-2012, 10:34 AM   #7
sjfast911
LQ Newbie
 
Registered: Jul 2007
Distribution: Sles
Posts: 10

Original Poster
Rep: Reputation: 0
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.

exec /usr/sbin/squid -f /etc/squid/BAO/squid-bao.conf -k shutdown

Again, thanks for your help!

Scott
 
Old 08-23-2012, 11:51 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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.

Cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Running Multiple MySQL Server Instances in Parallel on a Linux Server LXer Syndicated Linux News 0 10-11-2010 12:00 PM
How to run multiple squid instances wmasry Linux - Newbie 4 09-22-2010 12:10 AM
Squid multiple instances log problem Shwick Linux - Server 1 01-01-2009 10:08 PM
Starting multiple instances of X server armandino Linux - General 2 07-04-2007 02:41 AM
Samba, multiple server instances crispyleif Linux - Software 2 04-03-2006 10:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration