# Trigger a red cluster state?

**URL:** <https://discuss.elastic.co/t/trigger-a-red-cluster-state/9786>\
**Category:** Elasticsearch\
**Created:** [November 21, 2012, 10:06pm UTC](https://discuss.elastic.co/t/trigger-a-red-cluster-state/9786 "2012-11-21T22:06:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emj11](https://avatars.discourse-cdn.com/v4/letter/e/ecc23a/32.png) [@emj11](https://discuss.elastic.co/u/emj11)\
**Post date:** [November 21, 2012, 10:06pm UTC](https://discuss.elastic.co/t/trigger-a-red-cluster-state/9786/1 "2012-11-21T22:06:38Z")

</div>

Is there an easy way to trigger the cluster state to go from a green state  
to a red state?

I'd like to know if the transport client tries to connect to a cluster  
while it is in a red state, will it be able to connect?

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 22, 2012, 3:51am UTC](https://discuss.elastic.co/t/trigger-a-red-cluster-state/9786/2 "2012-11-22T03:51:42Z")

</div>

Simulating a red state is easy. You can put cluster into a red state by  
creating an index with unsatisfied allocation requirements. For example:

curl -XPUT localhost:9200/bad-index -d '{"settings":  
{"index.routing.allocation.include.\_id":"does not exist"}}'

when you are done with your testing, simply delete the index and your  
cluster will return back to a green state:

curl -XDELETE localhost:9200/bad-index

Another way is to create an index with no replicas and shut down a node  
that contains one of the shards of this index.

A more important question is what are you trying to test? Normally, cluster  
shouldn't go into a red state on its own. If this is happening, it,  
probably, means that your cluster is experiencing some serious problem such  
as split brain, network issues or loss of several nodes. And while your  
client shouldn't have any issue connecting to a cluster with a simulated  
red state, it could be a different story in case of catastrophic failure  
that can lead to red state in real life.

On Wednesday, November 21, 2012 5:06:38 PM UTC-5, emj11 wrote:

> Is there an easy way to trigger the cluster state to go from a green state  
> to a red state?
> 
> I'd like to know if the transport client tries to connect to a cluster  
> while it is in a red state, will it be able to connect?

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:03am UTC](https://discuss.elastic.co/t/trigger-a-red-cluster-state/9786/3 "2017-07-06T03:03:19Z")

</div>


