What is Lbhttpsolrserver?

Source: Internet
Author: User
Tags failover solr time in milliseconds

Lbhttpsolrserver or "Load Balanced httpsolrserver" is just a wrapper to Commonshttpsolrserver. This was useful when you had multiple solrservers and query requests need to be Load Balanced among them. It offers automatic failover when a server is goes down and it detects when the server is comes back up.

This should is used for indexing in traditional master/slave architectures since updates has the to is routed to the Corr ECT Master. In Solrcloud architectures, use Cloudsolrserver which'll take advantage of this class automatically.

How do I use?
New Lbhttpsolrserver ("http://host1:8080/solr/", "HTTP://HOST2:8080/SOLR", "HTTP://HOST3:8080/SOLR"); // or if you wish to pass the HttpClientdo as follows HttpClient HttpClient =  newNew Lbhttpsolrserver (httpClient, "http://host1:8080/solr/", "HTTP://HOST2:8080/SOLR", "HTTP://HOST3:8080/SOLR");

This can is used like any other solrserver implementation.

How does the Load balancing happen?

This is a dumb round-robin Load balancing. First request goes to ' host1 ' then to ' host2 ' and then ' host3 ' and it starts with ' host1 ' again.

"RR Mode load Balancing"

How does failover happen?

Lbhttpsolrserver does not keep pinging the servers to know if they is alive. If a request to a server fails by an Exception then the host is taken off the list of live servers and moved to a ' dead SE RVer list ' and the request is resent to the next live server. This process is continued till it tries all the live servers. If atleast one server is alive the request succeeds, and if not it fails.

"Lbhttpsolrserver does not periodically detect whether the server is alive, and if a server fails during the request process, add the server to the ' dead server List ', and transfer to the next server execution, until execution succeeds. 】

How does it know if a server had come back up?

Lbhttpsolrserver keeps pinging the dead servers once a minute (default value) to find if it is alive. The interval can changed using

Lbhttpsolrserver.setalivecheckinterval (60*1000); Time in milliseconds

The ping is do in a separate thread.

"Lbhttpsolrserver initiates a separate thread detection of ' dead server ', which is detected one minute by default. 】

Can I Add and remove servers?

Yes, there is methods to add or remove servers to an existing lbhttpsolrserver;

Example

Remove one lbhttpsolrserver.removesolrserver ("HTTP://HOST2:8080/SOLR");//and add Anotherlbhttpsolrserver.addsolrserver ("HTTP://HOST4:8080/SOLR");

When is the use of this?

This can is used as a software load balancer when you do not wish to the setup an external load balancer.

Alternatives to this built-in approach is to use a dedicated hardware load balancer or to use Apache httpd with Mod_proxy _balancer as a load balancer. See Load balancing on Wikipedia.

What is Lbhttpsolrserver?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.