When trying to setup vIDM cluster (now Workspace One Access) or restarting the cluster nodes you might’ve run into elastic search service issues. All nodes will be listed, however the ElasticSearch Health will be RED. We want that to be GREEN for the cluster to function good.
curl 'http://localhost:9200/_cluster/health?pretty'
command will also list the STATUS as RED. Below is the snap from the GUI
Important in this snap is the Elasticsearch – unassigned shards. There are basic troubleshooting steps listed in the following VMW link . However it didn’t help to delete/reroute the unassigned shards.
Below commands will help to delete unassigned shards and make the cluster status green.
First, list the nodes and make a note of the master node name. In my case it “Nightwind”
curl 'localhost:9200/_cat/nodes?v'
Next, check the list of UNASSIGNED shards using the command
curl 'localhost:9200/_cat/shards?v' | grep UNASSIGNED
Next use the below command to reroute the unassigned shards, after completing it there should be no unassigned shards.
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{"commands":[{"allocate":{"index": "v4_2020-01-12","shard": 1,"node": "Nightwind","allow_primary": 1}}]}'
After you complete it, when you run the health status; status should go green.
Also, if you would like to delete the unassigned shards, you can use the below command
curl -XDELETE ‘http://localhost:9200/<<Index>>/’
Hope this helps