caching - 无法使用 "service varnish restart"重新启动 Varnish

标签 caching ubuntu restart varnish varnish-vcl

我在“/etc/default/varnish”以及 vcl 文件“/etc/varnish/default.vcl”中进行了更改,因此想重新启动 varnish。

但我无法找出问题所在。已经花了一个多小时来研究它,但没有运气。详情如下:

nish@styx:~$ sudo service varnish restart
[sudo] password for nish: 
 * Stopping HTTP accelerator varnishd                                    [fail] 
 * Starting HTTP accelerator varnishd                                    [fail] 
Too many arguments (\...)
usage: varnishd [options]
-a address:port              # HTTP listen address and port
-b address:port              # backend address and port
                             #    -b <hostname_or_IP>
                             #    -b '<hostname_or_IP>:<port_or_service>'
-C                           # print VCL code compiled to C language
-d                           # debug
-f file                      # VCL script
-F                           # Run in foreground
-h kind[,hashoptions]        # Hash specification
                             #   -h critbit [default]
                             #   -h simple_list
                             #   -h classic
                             #   -h classic,<buckets>
-i identity                  # Identity of varnish instance
-l shl,free,fill             # Size of shared memory file
                             #   shl: space for SHL records [80m]
                             #   free: space for other allocations [1m]
                             #   fill: prefill new file [+]
-M address:port              # Reverse CLI destination.
-n dir                       # varnishd working directory
-P file                      # PID file
-p param=value               # set parameter
-s kind[,storageoptions]     # Backend storage specification
                             #   -s malloc
                             #   -s file  [default: use /tmp]
                             #   -s file,<dir_or_file>
                             #   -s file,<dir_or_file>,<size>
                             #   -s persist{experimenta}
                             #   -s file,<dir_or_file>,<size>,<granularity>
-t                           # Default TTL
-S secret-file               # Secret file for CLI authentication
-T address:port              # Telnet listen address and port
-V                           # version
-w int[,int[,int]]           # Number of worker threads
                             #   -w <fixed_count>
                             #   -w min,max
                             #   -w min,max,timeout [default: -w2,500,300]
-u user                      # Priviledge separation user id

最佳答案

通过从“/etc/default/varnish”文件中删除换行符解决了这个问题。

DAEMON_OPTS="-a :80 \
             -T localhost:1234 \
             -f /etc/varnish/default.vcl \ 
             -s malloc,256m"

DAEMON_OPTS="-a :80 -T localhost:1234 -f /etc/varnish/default.vcl -s malloc,256m"

关于caching - 无法使用 "service varnish restart"重新启动 Varnish ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18609749/

相关文章:

c# - 使 ASP.NET 中的缓存对象无效

c - 如何在写操作之前缓存/缓冲数据

spring - 如何告诉 Spring 缓存不要在 @Cacheable 注释中缓存空值

c# 重新启动 for 循环

haskell - Haskell 中缓存了哪些函数?

python - "Can' t 通过套接字 '/var/run/mysqld/mysqld.sock' (2)") 连接到本地 MySQL 服务器

python - 在 Python 和 Ubuntu 中调用命令行工具

docker daemon 重新启动后,docker 容器无法启动

Android WebView 在应用加载时重新加载

python - 属性错误 : '_socketobject' object has no attribute 'set_tlsext_host_name'