Varnish - multiple backends for one siteMultiple PHP Versions / cPanel with mod_fcgidHow would I run Django and LAMP on different subdomains, but on the same Apache server?Running two instances of Apache as separate users — permission deniedDebian, Apache, mod_userdir, suexec, php-cgiWrong site appears in Nginxvarnishd killed by OOM, How can I configure the varnishd to avoid this problem?How to avoid repeating sed commands when adding sites to Varnish?Apache PHP uploads - ownership and permissionsHow to connect PHP 5.6 to SQL db after compilationRunning Multiple Versions of PHP Using Apache on Gentoo

What are these boxed doors outside store fronts in New York?

I see my dog run

I probably found a bug with the sudo apt install function

Patience, young "Padovan"

What would the Romans have called "sorcery"?

What is the meaning of "of trouble" in the following sentence?

Download, install and reboot computer at night if needed

DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?

Can I make popcorn with any corn?

Is Social Media Science Fiction?

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

How to calculate implied correlation via observed market price (Margrabe option)

Why is the design of haulage companies so “special”?

Draw simple lines in Inkscape

Can Medicine checks be used, with decent rolls, to completely mitigate the risk of death from ongoing damage?

How to make payment on the internet without leaving a money trail?

What makes Graph invariants so useful/important?

Is it possible to do 50 km distance without any previous training?

Modification to Chariots for Heavy Cavalry Analogue for 4-armed race

Concept of linear mappings are confusing me

What typically incentivizes a professor to change jobs to a lower ranking university?

Is it possible to make sharp wind that can cut stuff from afar?

Can I interfere when another PC is about to be attacked?

XeLaTeX and pdfLaTeX ignore hyphenation



Varnish - multiple backends for one site


Multiple PHP Versions / cPanel with mod_fcgidHow would I run Django and LAMP on different subdomains, but on the same Apache server?Running two instances of Apache as separate users — permission deniedDebian, Apache, mod_userdir, suexec, php-cgiWrong site appears in Nginxvarnishd killed by OOM, How can I configure the varnishd to avoid this problem?How to avoid repeating sed commands when adding sites to Varnish?Apache PHP uploads - ownership and permissionsHow to connect PHP 5.6 to SQL db after compilationRunning Multiple Versions of PHP Using Apache on Gentoo






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















Is possible with Varnish configure multiple backends for one site? For example I have high avalibility site with multiple backends.



For example I have site www.goodies.com which is running on php 5.6. So I have 3 www-nodes as backend www-node5.6a www-node5.6b www-node5.6c



I have configured backends in Varnish like this:



backend www-node5.6a 
.host = "10.0.0.11";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6b
.host = "10.0.0.12";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6c
.host = "10.0.0.13";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;



my question is, how to configure Varnish so user will be randomly use to any of this backends for this specific one site?










share|improve this question






















  • Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

    – wurtel
    Mar 27 at 15:08











  • Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

    – Delirium
    Mar 27 at 15:08

















2















Is possible with Varnish configure multiple backends for one site? For example I have high avalibility site with multiple backends.



For example I have site www.goodies.com which is running on php 5.6. So I have 3 www-nodes as backend www-node5.6a www-node5.6b www-node5.6c



I have configured backends in Varnish like this:



backend www-node5.6a 
.host = "10.0.0.11";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6b
.host = "10.0.0.12";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6c
.host = "10.0.0.13";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;



my question is, how to configure Varnish so user will be randomly use to any of this backends for this specific one site?










share|improve this question






















  • Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

    – wurtel
    Mar 27 at 15:08











  • Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

    – Delirium
    Mar 27 at 15:08













2












2








2








Is possible with Varnish configure multiple backends for one site? For example I have high avalibility site with multiple backends.



For example I have site www.goodies.com which is running on php 5.6. So I have 3 www-nodes as backend www-node5.6a www-node5.6b www-node5.6c



I have configured backends in Varnish like this:



backend www-node5.6a 
.host = "10.0.0.11";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6b
.host = "10.0.0.12";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6c
.host = "10.0.0.13";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;



my question is, how to configure Varnish so user will be randomly use to any of this backends for this specific one site?










share|improve this question














Is possible with Varnish configure multiple backends for one site? For example I have high avalibility site with multiple backends.



For example I have site www.goodies.com which is running on php 5.6. So I have 3 www-nodes as backend www-node5.6a www-node5.6b www-node5.6c



I have configured backends in Varnish like this:



backend www-node5.6a 
.host = "10.0.0.11";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6b
.host = "10.0.0.12";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;


backend www-node5.6c
.host = "10.0.0.13";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;



my question is, how to configure Varnish so user will be randomly use to any of this backends for this specific one site?







debian apache-httpd varnish






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 14:48









DeliriumDelirium

74111




74111












  • Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

    – wurtel
    Mar 27 at 15:08











  • Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

    – Delirium
    Mar 27 at 15:08

















  • Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

    – wurtel
    Mar 27 at 15:08











  • Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

    – Delirium
    Mar 27 at 15:08
















Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

– wurtel
Mar 27 at 15:08





Googling for "varnish load balancing" serves up plenty of examples. BTW, 6000 seconds timeout for connect?! And the rest...

– wurtel
Mar 27 at 15:08













Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

– Delirium
Mar 27 at 15:08





Actually no, just wanted to make it more simple. There is the only reason so if there will be high traffic so the www-node will not crash.

– Delirium
Mar 27 at 15:08










1 Answer
1






active

oldest

votes


















4














What you are looking for if you want random distribution of the content you need something like this in your config file:



director cl1 random 
.backend = [Backend0]; .weight = 1;
.backend = [Backend1]; .weight = 1;



More information about how Varnish backends work can be found here. I found the above snippet from this blog. You can also do this on the basis of url, as seen here. You can also read more on configuring Varnish for High Availability here.



You should consider doing health checks and setting up and defining an actual director in round robin mode. Random is random. In theory, every single user that visits your site could be randomly sent to the same backend and that would be just as "random" as splitting things evenly based on backend health and status. Looking to another source they have something along these lines:




import directors; 

backend [Backend0]
.host = "192.168.0.10";
.probe =
.url = "/";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;


backend [Backend1]
.host = "192.168.0.10";
.probe =
.url = "/";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;


sub vcl_init
new vdir = directors.round_robin();
vdir.add_backend([Backend0]);
vdir.add_backend([Backend1]);




Make the changes as necessary for what makes sense in your environment. Please read over all the links and documentation as well as make a backup of your old configuration before trying any of this.






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509009%2fvarnish-multiple-backends-for-one-site%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    What you are looking for if you want random distribution of the content you need something like this in your config file:



    director cl1 random 
    .backend = [Backend0]; .weight = 1;
    .backend = [Backend1]; .weight = 1;



    More information about how Varnish backends work can be found here. I found the above snippet from this blog. You can also do this on the basis of url, as seen here. You can also read more on configuring Varnish for High Availability here.



    You should consider doing health checks and setting up and defining an actual director in round robin mode. Random is random. In theory, every single user that visits your site could be randomly sent to the same backend and that would be just as "random" as splitting things evenly based on backend health and status. Looking to another source they have something along these lines:




    import directors; 

    backend [Backend0]
    .host = "192.168.0.10";
    .probe =
    .url = "/";
    .timeout = 1s;
    .interval = 5s;
    .window = 5;
    .threshold = 3;


    backend [Backend1]
    .host = "192.168.0.10";
    .probe =
    .url = "/";
    .timeout = 1s;
    .interval = 5s;
    .window = 5;
    .threshold = 3;


    sub vcl_init
    new vdir = directors.round_robin();
    vdir.add_backend([Backend0]);
    vdir.add_backend([Backend1]);




    Make the changes as necessary for what makes sense in your environment. Please read over all the links and documentation as well as make a backup of your old configuration before trying any of this.






    share|improve this answer



























      4














      What you are looking for if you want random distribution of the content you need something like this in your config file:



      director cl1 random 
      .backend = [Backend0]; .weight = 1;
      .backend = [Backend1]; .weight = 1;



      More information about how Varnish backends work can be found here. I found the above snippet from this blog. You can also do this on the basis of url, as seen here. You can also read more on configuring Varnish for High Availability here.



      You should consider doing health checks and setting up and defining an actual director in round robin mode. Random is random. In theory, every single user that visits your site could be randomly sent to the same backend and that would be just as "random" as splitting things evenly based on backend health and status. Looking to another source they have something along these lines:




      import directors; 

      backend [Backend0]
      .host = "192.168.0.10";
      .probe =
      .url = "/";
      .timeout = 1s;
      .interval = 5s;
      .window = 5;
      .threshold = 3;


      backend [Backend1]
      .host = "192.168.0.10";
      .probe =
      .url = "/";
      .timeout = 1s;
      .interval = 5s;
      .window = 5;
      .threshold = 3;


      sub vcl_init
      new vdir = directors.round_robin();
      vdir.add_backend([Backend0]);
      vdir.add_backend([Backend1]);




      Make the changes as necessary for what makes sense in your environment. Please read over all the links and documentation as well as make a backup of your old configuration before trying any of this.






      share|improve this answer

























        4












        4








        4







        What you are looking for if you want random distribution of the content you need something like this in your config file:



        director cl1 random 
        .backend = [Backend0]; .weight = 1;
        .backend = [Backend1]; .weight = 1;



        More information about how Varnish backends work can be found here. I found the above snippet from this blog. You can also do this on the basis of url, as seen here. You can also read more on configuring Varnish for High Availability here.



        You should consider doing health checks and setting up and defining an actual director in round robin mode. Random is random. In theory, every single user that visits your site could be randomly sent to the same backend and that would be just as "random" as splitting things evenly based on backend health and status. Looking to another source they have something along these lines:




        import directors; 

        backend [Backend0]
        .host = "192.168.0.10";
        .probe =
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;


        backend [Backend1]
        .host = "192.168.0.10";
        .probe =
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;


        sub vcl_init
        new vdir = directors.round_robin();
        vdir.add_backend([Backend0]);
        vdir.add_backend([Backend1]);




        Make the changes as necessary for what makes sense in your environment. Please read over all the links and documentation as well as make a backup of your old configuration before trying any of this.






        share|improve this answer













        What you are looking for if you want random distribution of the content you need something like this in your config file:



        director cl1 random 
        .backend = [Backend0]; .weight = 1;
        .backend = [Backend1]; .weight = 1;



        More information about how Varnish backends work can be found here. I found the above snippet from this blog. You can also do this on the basis of url, as seen here. You can also read more on configuring Varnish for High Availability here.



        You should consider doing health checks and setting up and defining an actual director in round robin mode. Random is random. In theory, every single user that visits your site could be randomly sent to the same backend and that would be just as "random" as splitting things evenly based on backend health and status. Looking to another source they have something along these lines:




        import directors; 

        backend [Backend0]
        .host = "192.168.0.10";
        .probe =
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;


        backend [Backend1]
        .host = "192.168.0.10";
        .probe =
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;


        sub vcl_init
        new vdir = directors.round_robin();
        vdir.add_backend([Backend0]);
        vdir.add_backend([Backend1]);




        Make the changes as necessary for what makes sense in your environment. Please read over all the links and documentation as well as make a backup of your old configuration before trying any of this.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 15:38









        kemotepkemotep

        2,6983823




        2,6983823



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509009%2fvarnish-multiple-backends-for-one-site%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            -apache-httpd, debian, varnish

            Popular posts from this blog

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant

            fontconfig warning: “/etc/fonts/fonts.conf”, line 100: unknown “element blank” The 2019 Stack Overflow Developer Survey Results Are In“tar: unrecognized option --warning” during 'apt-get install'How to fix Fontconfig errorHow do I figure out which font file is chosen for a system generic font alias?Why are some apt-get-installed fonts being ignored by fc-list, xfontsel, etc?Reload settings in /etc/fonts/conf.dTaking 30 seconds longer to boot after upgrade from jessie to stretchHow to match multiple font names with a single <match> element?Adding a custom font to fontconfigRemoving fonts from fontconfig <match> resultsBroken fonts after upgrading Firefox ESR to latest Firefox