Susmita Sadhu
Susmita Sadhu

Reputation: 67

Solr Error -> "Cannot assign requested address (connect failed)" during frequently invoke Solr query

I am running Solr 7.1 on my Ubuntu system in port 8983.

It contains 8 number of cores and around 200 million document in each core. I am running a java code which do solr query to different cores simultaneously. According to my requirement it needs to invoke 10 000 queries in one second and it will continue for 3-4 hours. When I am running this code it is getting the following error after some seconds:

org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://10.*.*.*:8983/solr/solr_core
.

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 10.*.*.*:8983 [/10.*.*.*:8983] failed: Cannot assign requested address (connect failed)
.
Caused by: java.net.ConnectException: Cannot assign requested address (connect failed)

What I have explored that if I reduce the number of query per second or give some delay after an interval, it solve my problem up to some extent. But still I am getting this error after 1 hour running of this program. As I am not an expert in Solr, I don't know about any limitations for which it is happening.

Upvotes: 0

Views: 2918

Answers (1)

freedev
freedev

Reputation: 30067

Probably you are exhausting your local ports, AFAIK is due to keep-alive configuration if you open new connections very aggressively .

I'll suggest to take a look at SolrJ HttpClientUtil, this class let you create a client defining your own PoolingClientConnectionManager configuration.

Upvotes: 1

Related Questions