简体   繁体   中英

Can we have two varnish on two ports running on same system?

I was just wandering if we can have two varnish instances running on separate ports on the same machine?

I was trying to implement active-active mode on local.

Yes you can. Not sure what you're doing, but you can either run two varnish processes, each on separate ports, or one varnish instance listening to two ports. Examples of each:

varnishd -a 0.0.0.0:3000 -f /etc/varnish/default_1.vcl -i varnish_1 -n /var/lib/varnish/ubuntu1.dev/varnish_1
varnishd -a 0.0.0.0:3001 -f /etc/varnish/default_2.vcl -i varnish_2 -n /var/lib/varnish/ubuntu1.dev/varnish_2

The above commands start two varnish daemons, listening on ports 3000 and 3001, with different config files, instance names, and working directories. They must have different working directories or conflicts will arise with the shared memory file (shm).

A more common scenario is a single varnish daemon bound to two ports (this is also a better setup).

varnishd -a 0.0.0.0:3000,0.0.0.0:3001 -f /etc/varnish/default.vcl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM