---
title: "Collections API timeouts"
author: "JLK"
date: "2017-08-13T00:32:18Z"
tags: []
categories: ["开源软件"]
slug: "collections-api-timeouts"
draft: false
lastmod: "2017-08-13T00:32:18Z"
id: 2389490
url: "https://jlk.iteye.com/blog/2389490"
---

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.