README.rst 2.95 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
..
.. NB:  This file is machine generated, DO NOT EDIT!
..
.. Edit vmod.vcc and run make instead
..

.. role:: ref(emphasis)

.. _vmod_all_healthy(3):

================
vmod_all_healthy
================

--------------------------
Varnish all_healthy Module
--------------------------

:Manual section: 3

SYNOPSIS
========


::

   import all_healthy [from "path"] ;
   
   new xdirector = director()
  
      VOID xdirector.consider(BACKEND)
  
      VOID xdirector.set_backend(BACKEND)
  
      BACKEND xdirector.backend()
  


DESCRIPTION
===========

The all_healthy vmod provides a varnish director tieing the health
state of several other backends / health states: An all_healthy
director is only healthy if all backends to consider are healthy. It
always resolves to exactly one backend, which may or may not be part
of the set of backends considered for health state.

An all_healthy director will commonly be layered below other directors
for actual load balancing.

Examples and use cases:

* Using more than one health checks for a backend::

	probe probe_a { ... }
	probe probe_b { ... }

	backend be_a {
		.host = "1.2.3.4";
		.probe = probe_a;
	}

	# will never actually be used, only provides the second probe
	backend be_b {
		.host = "1.2.3.4";
		.probe = probe_b;
	}

	sub vcl_init {
		new be = all_healthy.director();
		# implies be.set_backend(be_a);
		be.consider(be_a);
		be.consider(be_b);

		some_director.add_backend(be);
	}

	sub vcl_backend_fetch {
		set bereq.backend = be.backend();
	}

* Checking health on a different port::

	probe oob_probe { ... }

	backend be_traffic {
		.host = "1.2.3.4";
		# no .probe !
	}

	backend be_oob_probe {
		.host = "1.2.3.4";
		.port = "4242";
		.probe = oob_probe;
	}

	sub vcl_init {
		new be = all_healthy.director();
		be.consider(be_oob_probe);
		be.set_backend(be_traffic);

		some_director.add_backend(be);
	}

	sub vcl_backend_fetch {
		set bereq.backend = be.backend();
	}

CONTENTS
========

* :ref:`obj_director`
* :ref:`func_director.backend`
* :ref:`func_director.consider`
* :ref:`func_director.set_backend`


.. _obj_director:

new xdirector = director()
--------------------------

Instantiate an all_healthy director.

.. _func_director.consider:

VOID xdirector.consider(BACKEND)
--------------------------------

Add a backend to consider for determining the health state of the
director.

This method may only be called from vcl_init {}


.. _func_director.set_backend:

VOID xdirector.set_backend(BACKEND)
-----------------------------------

Set the backend the director resolves to.

This method may only be called from vcl_init {}


.. _func_director.backend:

BACKEND xdirector.backend()
---------------------------

Return the all_healthy director instance, which will resolve to the
backend set using the .set_backend() method.

SEE ALSO
========vcl\(7),varnishd\(1)





COPYRIGHT
=========

::

  This document is copyright and licensed under the same conditions as
  the libvmod-all_healthy project. See LICENSE for details.