Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Varnish - Could not get hold of varnishd, is it running?

Tags:

varnish

Running any of the commands varnishstat, varnishhist, varnishlog, varnishtop will give the error message as

Could not get hold of varnishd, is it running?

Below is some information for understanding.

sudo service varnish status

varnish.service - Varnish Cache, a high-performance HTTP accelerator
   Loaded: loaded (/lib/systemd/system/varnish.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-11-15 15:28:04 UTC; 1h 16min ago
  Process: 10235 ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m (code=ex
 Main PID: 10251 (varnishd)
    Tasks: 217
   Memory: 106.2M
      CPU: 1.673s
   CGroup: /system.slice/varnish.service
           ├─10251 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
           └─10271 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

Nov 15 15:28:03 varnish1 systemd[1]: Starting Varnish Cache, a high-performance HTTP accelerator...
Nov 15 15:28:04 varnish1 varnishd[10235]: Debug: Platform: Linux,4.11.0-1014-azure,x86_64,-junix,-smalloc,-smalloc,-hcritbit
Nov 15 15:28:04 varnish1 varnishd[10251]: Platform: Linux,4.11.0-1014-azure,x86_64,-junix,-smalloc,-smalloc,-hcritbit
Nov 15 15:28:04 varnish1 varnishd[10235]: Debug: Child (10271) Started
Nov 15 15:28:04 varnish1 varnishd[10251]: Child (10271) Started
Nov 15 15:28:04 varnish1 varnishd[10251]: Child (10271) said Child starts
Nov 15 15:28:04 varnish1 systemd[1]: Started Varnish Cache, a high-performance HTTP accelerator.

sudo service varnishd status

varnishd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

sudo service varnishd start

Failed to start varnishd.service: Unit varnishd.service not found.

varnishd -V

varnishd (varnish-5.2.1 revision 67e562482)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS

Answer:

sudo varnishstat
sudo varnishhist
sudo varnishlog
sudo varnishtop
like image 464
Sharath Avatar asked Nov 15 '17 16:11

Sharath


2 Answers

If you’re using Varnish utilities as unprivileged user, you’re probably missing privileges to execute some actions. For some distros, it’s enough to add yourself to Varnish’s group:

gpasswd -a my_user varnish

Then put the new group in use and at least varnishstat should work.

like image 127
Smar Avatar answered Dec 29 '22 21:12

Smar


If sudo varnishstat doesn't help: check if varnish is started

sudo /etc/init.d/varnish start
like image 29
numediaweb Avatar answered Dec 29 '22 21:12

numediaweb