Trigger a red cluster state?

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?

--

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?

--