Charanjeet Kaur Charanjeet Kaur - 1 year ago 80
Linux Question

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.

Answer Source

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 -f /etc/varnish/default_1.vcl -i varnish_1 -n /var/lib/varnish/
varnishd -a -f /etc/varnish/default_2.vcl -i varnish_2 -n /var/lib/varnish/

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, -f /etc/varnish/default.vcl
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download