Re: SolrJ Solr Cloud timeout

2016-08-30 Thread Shawn Heisey
On 8/29/2016 10:22 PM, Brent P wrote:
> Is there any way to set a timeout with a CloudSolrClient?

There are a couple of potential timeouts that you might be talking
about, but the one that seems most likely to be of interest to you is
the Socket Timeout.  This is a low-level timeout on the TCP connection,
and represents the amount of time the TCP connection can be idle before
it will be disconnected forcefully.  Such a disconnect will throw an
exception.

If that's what you're after, here's some sample code:

  String zkHost = "zk1:2181,zk2:2181,zk3:2181/mysolr";
  RequestConfig rc = RequestConfig.custom().setConnectTimeout(15000)
.setSocketTimeout(90).build();
  HttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(rc).setMaxConnPerRoute(300)
.setMaxConnTotal(5000).disableAutomaticRetries().build();
  CloudSolrClient = new CloudSolrClient(zkHost, httpClient);

Another possibility that you might want is the "timeAllowed" parameter,
which you can add to requests.  If the request type supports this
parameter, Solr will do its best to honor it.  It won't always succeed.

http://wiki.apache.org/solr/CommonQueryParameters#timeAllowed

Thanks,
Shawn



SolrJ Solr Cloud timeout

2016-08-30 Thread Brent P
Is there any way to set a timeout with a CloudSolrClient?