Quantcast

Can't start Squid with workers via systemd on CentOS 7

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Can't start Squid with workers via systemd on CentOS 7

段垚
I installed Squid 4.0.18 on CentOS 7 X86_84 according to
http://wiki.squid-cache.org/KnowledgeBase/CentOS#Squid_Beta_release

I add a line "workers 2" to `/etc/squid/squid.conf` (just a copy of
`squid.conf.default`)
and start squid via `systemctl start squid`, It seems squid is running,
except that it
is not listening to the port 3128 (confirmed by netstat).

However, if I start squid in command line (`squid -sYC`), squid does
listen to port 3128.

There are some differences in `/var/log/squid/cache.log` for these two
cases:

* start via `systemctl start squid`:

   2017/03/09 21:12:54 kid3| commBind Cannot bind socket FD 12 to [::]:
(98) Address already in use
   2017/03/09 21:12:54 kid2| commBind Cannot bind socket FD 21 to [::]:
(98) Address already in use
   2017/03/09 21:12:54 kid1| commBind Cannot bind socket FD 21 to [::]:
(98) Address already in use

* start via `squid -sYC`:

   2017/03/09 21:19:28 kid1| Accepting HTTP Socket connections at
local=[::]:3128 remote=[::] FD 15 flags=1
   2017/03/09 21:19:28 kid2| Accepting HTTP Socket connections at
local=[::]:3128 remote=[::] FD 15 flags=1

The full logs are attached. Please help.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users

cache.log-cmdline (7K) Download Attachment
cache.log-systemd (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

Alex Rousskov
On 03/09/2017 07:00 AM, 段垚 wrote:

> I installed Squid 4.0.18 on CentOS 7 X86_84 according to
> http://wiki.squid-cache.org/KnowledgeBase/CentOS#Squid_Beta_release
>
> I add a line "workers 2" to `/etc/squid/squid.conf` (just a copy of
> `squid.conf.default`)
> and start squid via `systemctl start squid`, It seems squid is running,
> except that it is not listening to the port 3128 (confirmed by netstat).
>
> However, if I start squid in command line (`squid -sYC`), squid does
> listen to port 3128.
>
> There are some differences in `/var/log/squid/cache.log` for these two
> cases:
>
> * start via `systemctl start squid`:
>
>   2017/03/09 21:12:54 kid3| commBind Cannot bind socket FD 12 to [::]: (98) Address already in use
>   2017/03/09 21:12:54 kid2| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>   2017/03/09 21:12:54 kid1| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>
> * start via `squid -sYC`:
>
>   2017/03/09 21:19:28 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>   2017/03/09 21:19:28 kid2| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>
> The full logs are attached. Please help.

Most likely, your systemctl script for Squid is broken. I do not know
about CentOS 7 specifically, but many older scripts often start two
modern Squids at once due to various backward compatibility problems
with Squid startup interface and the way those scripts were written.
Study/log what that script does and you will probably find the answer to
your question.

HTH,

Alex.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

Amos Jeffries
Administrator
On 10/03/2017 3:57 a.m., Alex Rousskov wrote:

> On 03/09/2017 07:00 AM, 段垚 wrote:
>> I installed Squid 4.0.18 on CentOS 7 X86_84 according to
>> http://wiki.squid-cache.org/KnowledgeBase/CentOS#Squid_Beta_release
>>
>> I add a line "workers 2" to `/etc/squid/squid.conf` (just a copy of
>> `squid.conf.default`)
>> and start squid via `systemctl start squid`, It seems squid is running,
>> except that it is not listening to the port 3128 (confirmed by netstat).
>>
>> However, if I start squid in command line (`squid -sYC`), squid does
>> listen to port 3128.
>>
>> There are some differences in `/var/log/squid/cache.log` for these two
>> cases:
>>
>> * start via `systemctl start squid`:
>>
>>   2017/03/09 21:12:54 kid3| commBind Cannot bind socket FD 12 to [::]: (98) Address already in use
>>   2017/03/09 21:12:54 kid2| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>>   2017/03/09 21:12:54 kid1| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>>
>> * start via `squid -sYC`:
>>
>>   2017/03/09 21:19:28 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>>   2017/03/09 21:19:28 kid2| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>>
>> The full logs are attached. Please help.
>
> Most likely, your systemctl script for Squid is broken. I do not know
> about CentOS 7 specifically, but many older scripts often start two
> modern Squids at once due to various backward compatibility problems
> with Squid startup interface and the way those scripts were written.
> Study/log what that script does and you will probably find the answer to
> your question.


Please check that you are using the squid.service file provided with
Squid-4 sources (under tools/systemd/squid.service). Remove the startup
scripts or any squid.service file created for Squid-3 versions, they are
usually wrong for Squid-4 with systemd.

After that you will need to carefully check that any previous attempts
to run Squid have been fully stopped and have not left any files (ie
.pid) or /dev/shm sockets behind before attempting to start Squid again.

HTH
Amos

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

段垚


在 2017/3/9 23:22, Amos Jeffries 写道:

> On 10/03/2017 3:57 a.m., Alex Rousskov wrote:
>> On 03/09/2017 07:00 AM, 段垚 wrote:
>>> I installed Squid 4.0.18 on CentOS 7 X86_84 according to
>>> http://wiki.squid-cache.org/KnowledgeBase/CentOS#Squid_Beta_release
>>>
>>> I add a line "workers 2" to `/etc/squid/squid.conf` (just a copy of
>>> `squid.conf.default`)
>>> and start squid via `systemctl start squid`, It seems squid is running,
>>> except that it is not listening to the port 3128 (confirmed by netstat).
>>>
>>> However, if I start squid in command line (`squid -sYC`), squid does
>>> listen to port 3128.
>>>
>>> There are some differences in `/var/log/squid/cache.log` for these two
>>> cases:
>>>
>>> * start via `systemctl start squid`:
>>>
>>>    2017/03/09 21:12:54 kid3| commBind Cannot bind socket FD 12 to [::]: (98) Address already in use
>>>    2017/03/09 21:12:54 kid2| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>>>    2017/03/09 21:12:54 kid1| commBind Cannot bind socket FD 21 to [::]: (98) Address already in use
>>>
>>> * start via `squid -sYC`:
>>>
>>>    2017/03/09 21:19:28 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>>>    2017/03/09 21:19:28 kid2| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 15 flags=1
>>>
>>> The full logs are attached. Please help.
>> Most likely, your systemctl script for Squid is broken. I do not know
>> about CentOS 7 specifically, but many older scripts often start two
>> modern Squids at once due to various backward compatibility problems
>> with Squid startup interface and the way those scripts were written.
>> Study/log what that script does and you will probably find the answer to
>> your question.
>
> Please check that you are using the squid.service file provided with
> Squid-4 sources (under tools/systemd/squid.service). Remove the startup
> scripts or any squid.service file created for Squid-3 versions, they are
> usually wrong for Squid-4 with systemd.
The `squid.service` I used was shipped with the prebuild 4.0.18 rpm from
http://www1.ngtech.co.il/repo/centos/$releasever/beta/$basearch/

I uninstalled squid-3.5.20 rpm before install 4.0.18.
The `squid.service` content:

[Unit]
Description=Squid Web Proxy Server
Documentation=man:squid(8)
After=network.target

[Service]
Type=forking
LimitNOFILE=16384
PIDFile=/var/run/squid.pid
ExecStartPre=/usr/bin/mkdir -p /var/run/squid
ExecStartPre=/usr/bin/chown squid.squid /var/run/squid
ExecStart=/usr/sbin/squid -sYC
ExecReload=/usr/sbin/squid -kreconf
ExecStop=/usr/sbin/squidshut.sh
TimeoutStopSec=36
KillMode=none

[Install]
WantedBy=multi-user.target


Even if I replace it with the one under `tools/systemd/squid.service` of
squid 4.0.18 source,
still no luck:

[Unit]
Description=Squid Web Proxy Server
Documentation=man:squid(8)
After=network.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/squid.pid
ExecStartPre=/usr/sbin/squid --foreground -z
ExecStart=/usr/sbin/squid -sYC
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed

[Install]
WantedBy=multi-user.target

>
> After that you will need to carefully check that any previous attempts
> to run Squid have been fully stopped and have not left any files (ie
> .pid) or /dev/shm sockets behind before attempting to start Squid again.

I checked that there are no `/run/squid.pid `, `/var/run/squid.pid ` and
`/dev/shm/squid*` before starting squid.

There are still similar messages in `/var/log/squid/cache.log`:

2017/03/10 00:20:00 kid2| commBind Cannot bind socket FD 21 to [::]: (2)
No such file or directory
2017/03/10 00:20:00 kid1| commBind Cannot bind socket FD 21 to [::]: (2)
No such file or directory
2017/03/10 00:20:00 kid3| commBind Cannot bind socket FD 12 to [::]: (2)
No such file or directory

>
> HTH
> Amos
>
> _______________________________________________
> squid-users mailing list
> [hidden email]
> http://lists.squid-cache.org/listinfo/squid-users


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

Alex Rousskov
On 03/09/2017 09:32 AM, 段垚 wrote:
> commBind Cannot bind socket

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

Alex Rousskov
In reply to this post by 段垚
On 03/09/2017 09:32 AM, 段垚 wrote:
> There are still similar messages in `/var/log/squid/cache.log`:
>
> 2017/03/10 00:20:00 kid2| commBind Cannot bind socket FD 21 to [::]: (2)
> No such file or directory

This feels like an IPC problem (with an awful diagnostic). There are a
few hints at http://wiki.squid-cache.org/Features/SmpScale and lots of
squid-users posts that might help troubleshoot that.

Sorry for the earlier accidental empty response.

Alex.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't start Squid with workers via systemd on CentOS 7

Eliezer Croitoru
In reply to this post by 段垚
I can test it locally but it will take me couple days to get there.

----
Eliezer Croitoru
Linux System Administrator
Mobile: +972-5-28704261
Email: [hidden email]


-----Original Message-----
From: squid-users [mailto:[hidden email]] On Behalf Of ??
Sent: Thursday, March 9, 2017 4:00 PM
To: [hidden email]
Subject: [squid-users] Can't start Squid with workers via systemd on CentOS 7

I installed Squid 4.0.18 on CentOS 7 X86_84 according to http://wiki.squid-cache.org/KnowledgeBase/CentOS#Squid_Beta_release

I add a line "workers 2" to `/etc/squid/squid.conf` (just a copy of
`squid.conf.default`)
and start squid via `systemctl start squid`, It seems squid is running, except that it is not listening to the port 3128 (confirmed by netstat).

However, if I start squid in command line (`squid -sYC`), squid does listen to port 3128.

There are some differences in `/var/log/squid/cache.log` for these two
cases:

* start via `systemctl start squid`:

   2017/03/09 21:12:54 kid3| commBind Cannot bind socket FD 12 to [::]:
(98) Address already in use
   2017/03/09 21:12:54 kid2| commBind Cannot bind socket FD 21 to [::]:
(98) Address already in use
   2017/03/09 21:12:54 kid1| commBind Cannot bind socket FD 21 to [::]:
(98) Address already in use

* start via `squid -sYC`:

   2017/03/09 21:19:28 kid1| Accepting HTTP Socket connections at
local=[::]:3128 remote=[::] FD 15 flags=1
   2017/03/09 21:19:28 kid2| Accepting HTTP Socket connections at
local=[::]:3128 remote=[::] FD 15 flags=1

The full logs are attached. Please help.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Loading...