Solr - Collections API timeouts

2019-07-07 02:10发布

问题:

I've got a setup with 3x zoo keeper's and 4x solrcloud node's.

This is all working, all nodes are seeing each other and I initially had a default collection.

From there, I used the collections API to create a new collection which successfully completed and all it's successfully sharded across 2 nodes, with the other 2 being used for replica's. I can also successfully save documents to that collection. Browsing the solr web GUI on any of the boxes all works, no speed issues.

However, anytime I try to use the collections API I get timeouts. Creating a new collection, reloading one of the existing collections, deleting a collection... all of them timeout.

Any thoughts on why would be much appreciated

Cheers

回答1:

Such timeout can occur when Solr is not able to obtain cluster state. If following call is results in timeout, then this is the case

http://solr-hostname:8983/solr/admin/collections?action=CLUSTERSTATUS&wt=json

This may be caused by incorrect entries present in /clusterstate.json

To fix this:

  • get clusterstate from ZooKeeper by calling

    zkcli.sh -zkhost localhost:2181 -cmd get /clusterstate.json > clusterstate.json
    
  • edit extracted clusterstate.json file and remove sections with wrong IPs or not existing hosts
  • clear the clusterstate in ZooKeeper by calling

    zkcli.sh -zkhost localhost:2181 -cmd clear /clusterstate.json
    
  • save corrected state in ZooKeeper by sending updated JSON file

    zkcli.sh -zkhost localhost:2181 -cmd putfile /clusterstate.json ./clusterstate.json`
    
  • restart Solr instances

After that, if your clusterstate shows correct info, you should no longer have timeouts when accessing Collections API.

Note

Be careful when editing clusterstate JSON, limit your changes only to removing not existing hosts/replicas/shards.



回答2:

I also had timeout issues with the collections API. To fix this problem, I added the server's IP address to the solr.xml file that you find in /var/solr/data/solr.xml. My setup consists of 3 Ubuntu servers that run ZooKeeper (3.4.6) and SolrCloud (5.2.1) on each server.



回答3:

I have also faced similar issue:

Solr process 24214 running on port 8983
Failed to get system information from http://localhost:8983/solr/ due to: org.apache.solr.client.solrj.SolrServerException: clusterstatus the collection time out:180s
    at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:537)
    at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:471)
    at org.apache.solr.util.SolrCLI$StatusTool.getCloudStatus(SolrCLI.java:721)
    at org.apache.solr.util.SolrCLI$StatusTool.reportStatus(SolrCLI.java:704)
    at org.apache.solr.util.SolrCLI$StatusTool.runTool(SolrCLI.java:662)
    at org.apache.solr.util.SolrCLI.main(SolrCLI.java:215)

So to solve this issue I have followed given instruction and resolved it.:

  • Stop all Solr instances
  • Stop all Zookeeper instances
  • Start all Zookeeper instances
  • Start Solr instances one at a time.


回答4:

Ended up being Zoo Keeper config mismatch