<div dir="ltr">Aha, yes that was it. I literally just spotted the fact that the shard director needs a ".reconfigure()" after making changes.<div><br></div><div>Thanks, that seems to have fixed it.</div><div><br></div><div>Mark</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 30 March 2017 at 13:43, Guillaume Quintard <span dir="ltr"><<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think you forgot to commit the backend addtions.</div><div class="gmail_extra"><br clear="all"><div><div class="m_-5024315147999378329gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Wed, Mar 29, 2017 at 6:12 PM, Mark Hanford <span dir="ltr"><<a href="mailto:mark@hanfordonline.co.uk" target="_blank">mark@hanfordonline.co.uk</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi folks. I'm in the process of migrating to from v3 to v5, and have finally got the config compiling at least. Now I'm having some problems with the backends that I can't seem to work out. Apologies, this is a bit of a wordy one...<div><br></div><div>Let's say I have two backends, web01 and web02, and these are put into a director called admin_director for load-balancing. This is all in "backends.vcl":</div><div><br></div><div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>import directors;</div><div><br></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>probe healthcheck {</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>.request =</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                     </span>"GET / HTTP/1.1"</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                     </span>"Host: <a href="http://www.mydomain.co.uk" target="_blank">www.mydomain.co.uk</a>"</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                   </span>"Connection: close";</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>.timeout = 30s;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>.interval = 15s;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">               </span>.window = 10;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">          </span>.threshold = 8;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>.expected_response = 302;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>}</div><div><br></div><div><br></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>backend web01 { .host = "192.168.1.11"; .port = "80"; .first_byte_timeout = 600s; .probe = healthcheck; }</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>backend web02 { .host = "192.168.1.12"; .port = "80"; .first_byte_timeout = 600s; .probe = healthcheck; }</div><div><br></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>sub vcl_init {</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>new admin_director = directors.shard();</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>admin_director.add_backend(web<wbr>01);</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">          </span>admin_director.add_backend(web<wbr>02);</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>}</div><div><br></div><div><br></div><div>I've now removed all my main VCL for clarification, so my vcl_recv.vcl file contains just:</div><div><br></div><div><br></div><div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>import std;</div><div><br></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>sub vcl_recv {</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>set req.backend_hint = admin_director.backend();</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">               </span>std.log("Backend hint: " + req.backend_hint);</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>}</div></div><div><br></div><div><br><br></div></div><div>I then have my main "default.vcl":</div><div><br></div><div><br></div><div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>vcl 4.0;</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>include "backends.vcl";</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>include "vcl_recv.vcl";</div></div><div><br></div><div><br></div><div>Now to the problem. If I try to access a URL, I always get a "FetchError: No backend"</div><div><br></div><div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">              </span></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>*   << BeReq    >> 3</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   Begin          bereq 2 fetch</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   Timestamp      Start: 1490802880.486355 0.000000 0.000000</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   BereqMethod    GET</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   BereqURL       /Common/Images/NewLoginImages/<wbr>training.png</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   BereqProtocol  HTTP/1.1</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   BereqHeader    Host: <a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   BereqHeader    User-Agent: curl/7.35.0</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   BereqHeader    Accept: */*</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   BereqHeader    X-Forwarded-Proto: https</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   BereqHeader    X-Real-Ip: 1.2.3.4</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   BereqHeader    Accept-Encoding: gzip</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   BereqHeader    X-Forwarded-For: 1.2.3.4, 192.168.1.23</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   BereqHeader    X-Varnish: 3</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   VCL_call       BACKEND_FETCH</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   VCL_return     fetch</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   FetchError     No backend</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   Timestamp      Beresp: 1490802880.486447 0.000092 0.000092</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   Timestamp      Error: 1490802880.486452 0.000098 0.000006</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   BerespProtocol HTTP/1.1</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   BerespStatus   503</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   BerespReason   Service Unavailable</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   BerespReason   Backend fetch failed</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   BerespHeader   Date: Wed, 29 Mar 2017 15:54:40 GMT</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   BerespHeader   Server: Varnish</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   VCL_call       BACKEND_ERROR</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   BerespHeader   Content-Type: text/html; charset=utf-8</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   BerespHeader   Retry-After: 5</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   VCL_return     deliver</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   Storage        malloc Transient</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   ObjProtocol    HTTP/1.1</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   ObjStatus      503</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   ObjReason      Backend fetch failed</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   ObjHeader      Date: Wed, 29 Mar 2017 15:54:40 GMT</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   ObjHeader      Server: Varnish</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   ObjHeader      Content-Type: text/html; charset=utf-8</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   ObjHeader      Retry-After: 5</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   Length         278</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   BereqAcct      0 0 0 0 0 0</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   End</div></div><div><br></div><div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>*   << Request  >> 32770</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   Begin          req 32769 rxreq</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   Timestamp      Start: 1490803780.494500 0.000000 0.000000</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   Timestamp      Req: 1490803780.494500 0.000000 0.000000</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-   ReqStart       192.168.1.23 36896</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   ReqMethod      GET</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   ReqURL         /Common/Images/NewLoginImages/<wbr>training.png</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   ReqProtocol    HTTP/1.1</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   ReqHeader      Host: <a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a></div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   ReqHeader      User-Agent: curl/7.35.0</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   ReqHeader      Accept: */*</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   ReqHeader      X-Forwarded-For: 1.2.3.4</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-   ReqHeader      X-Forwarded-Proto: https</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-   ReqHeader      X-Real-Ip: 1.2.3.4</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   ReqHeader      Accept-Encoding: gzip</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   ReqUnset       X-Forwarded-For: 1.2.3.4</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-   ReqHeader      X-Forwarded-For: 1.2.3.4, 192.168.1.23</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   VCL_call       RECV</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   Error          shard admin_director: no backends</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   VCL_Log        Backend hint:</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   VCL_return     hash</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   VCL_call       HASH</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   VCL_return     lookup</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   VCL_call       MISS</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   VCL_return     fetch</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   Link           bereq 32771 fetch</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   Timestamp      Fetch: 1490803780.495705 0.001204 0.001204</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   RespProtocol   HTTP/1.1</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   RespStatus     503</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   RespReason     Backend fetch failed</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>-   RespHeader     Date: Wed, 29 Mar 2017 16:09:40 GMT</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   RespHeader     Server: Varnish</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   RespHeader     Content-Type: text/html; charset=utf-8</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   RespHeader     Retry-After: 5</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   RespHeader     X-Varnish: 32770</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   RespHeader     Age: 0</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   RespHeader     Via: 1.1 varnish (Varnish/5.1)</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   VCL_call       DELIVER</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>-   VCL_return     deliver</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   Timestamp      Process: 1490803780.495723 0.001223 0.000019</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>-   RespHeader     Content-Length: 282</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>-   Debug          "RES_MODE 2"</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-   RespHeader     Connection: keep-alive</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>-   Timestamp      Resp: 1490803780.495806 0.001305 0.000082</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>-   ReqAcct        238 0 238 250 282 532</div><div><span class="m_-5024315147999378329m_-572121323818346792gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>-   End</div></div><div><br></div><div>But my backend.list seems to always be healthy:</div><div><br></div><div><div>    boot.web01                     probe      Healthy             10/10 Wed, 29 Mar 2017 15:54:18 GMT</div><div>    boot.web02                     probe      Healthy             10/10 Wed, 29 Mar 2017 15:54:18 GMT</div></div><div><br></div><div>From the varnish server, I can reach the backends successfully manually:</div><div><br></div><div>    curl --resolve www.mydomain.com:192.168.1.11 <a href="http://www.mydomain.com/Common/Images/NewLoginImages/training.png" target="_blank">http://www.mydomain.com/Common<wbr>/Images/NewLoginImages/trainin<wbr>g.png</a></div><div><br></div><div>Not sure what it all means.</div></div>
<br></div></div>______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-misc</a><br></blockquote></div><br></div>
</blockquote></div><br></div>