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

            Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

            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