Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
on
12-11-2017
04:00 PM
- edited on
05-14-2020
09:26 PM
by
Claudia.Landiva
“events-service-api-store / elasticsearch-singlenode-module” : {
“healthy” : false,
“message” : “Current [appdynamics-events-service-cluster]
cluster state: [RED]. data nodes: [1], nodes: [1}, active shards:
[3], relocating shards: [0], initializing shards: [0], unassigned
shards; [8], timed out: [false]
}
}
curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED
Elasticsearch gives the following reasons for a shard to be in an unassigned state:
|
Unassigned as a result of an API creation of an index. |
|
Unassigned as a result of a full cluster recovery. |
|
Unassigned as a result of opening a closed index. |
|
Unassigned as a result of importing a dangling index. |
|
Unassigned as a result of restoring into a new index. |
|
Unassigned as a result of restoring into a closed index. |
|
Unassigned as a result of explicit addition of a replica. |
|
Unassigned as a result of a failed allocation of the shard. |
|
Unassigned as a result of the node hosting it leaving the cluster. |
|
Unassigned as a result of explicit cancel reroute command. |
|
When a shard moves from started back to initializing, for example, with shadow replicas. |
|
A better replica location is identified and causes the existing replica allocation to be canceled. |
curl http://<events_service_machine>:9081/healthcheck?pretty=true curl http://<events_service_machine>:9200/_cat/shards?v curl http://<events_service_machine>:9200/_cat/indices?v
Output from the above health check commands:
"events-service-api-store / elasticsearch-singlenode-module" : { "healthy" : false, "message" : "Current [appdynamics-events-service-cluster] cluster state: [RED], data nodes: [1], nodes: [1], active shards: [3], relocating shards: [0], initializing shards: [0], unassigned shards: [12], timed out: [false]" } }
appdynamics_meters_v2 0 p UNASSIGNED CLUSTER_RECOVERED appdynamics_meters_v2 1 p UNASSIGNED CLUSTER_RECOVERED appdynamics_api_keys_v1 0 p UNASSIGNED CLUSTER_RECOVERED appdynamics_api_keys_v1 1 p UNASSIGNED CLUSTER_RECOVERED appdynamics_accounts 0 p UNASSIGNED CLUSTER_RECOVERED appdynamics_accounts 1 p UNASSIGNED CLUSTER_RECOVERED event_type_metadata 0 p UNASSIGNED CLUSTER_RECOVERED event_type_metadata 1 p UNASSIGNED CLUSTER_RECOVERED event_type_extracted_fields 0 p UNASSIGNED CLUSTER_RECOVERED event_type_extracted_fields 1 p UNASSIGNED CLUSTER_RECOVERED
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
"commands" : [ {
"allocate" : {
"index" : "appdynamics_accounts",
"shard" : 0,
"node" : "node-12345798-7867-4ea1-b546-557a6bc546afg",
"allow_primary" : true
}
}
]}'
You need to update the node with the IP address or the name of the node, and then run the appropriate script, from below
curl http://localhost:9200/_cat/shards?v 2>/dev/null |grep UNASSIGNED | sed -e 's/\([^ ]*\) *\([^ ]*\) *.*/\1 \2/'|while read line
do
indexname=`echo $line|cut -d" "-f1`
shardid=`echo $line|cut -d" "-f2`
echo $indexname $shardid
curl -XPOST 'http://localhost:9200/_cluster/reroute'-d "{
\"commands\": [{
\"allocate\": {
\"index\": \"$indexname\",
\"shard\": $shardid,
\"node\": \"10.90.3.125\",
\"allow_primary\": 0
}
}]
}"
done
curl http://localhost:9200/_cat/shards?v 2>/dev/null |grep UNASSIGNED | sed -e 's/\([^ ]*\) *\([^ ]*\) *.*/\1 \2/'|while read line
do
indexname=`echo $line|cut -d" "-f1`
shardid=`echo $line|cut -d" "-f2`
echo $indexname $shardid
curl -XPOST 'http://localhost:9200/_cluster/reroute'-d "{
\"commands\": [{
\"allocate\": {
\"index\": \"$indexname\",
\"shard\": $shardid,
\"node\": \"10.90.3.125\",
\"allow_primary\": 1
}
}]
}"
done
Here is a powershell equivalent if you are running on Windows and don't want to install curl...
$postParams=@' { "commands": [{ "allocate": { "index": "appdynamics_accounts", "shard": 0, "node": "node-fa635229-8114-4ff8-a3b6-eee4449fkdsaaaa", "allow_primary": true } }] } '@ Invoke-WebRequest -Uri http://localhost:9200/_cluster/reroute -ContentType "application/json" -Method POST -Body $postParams
Don't forget. You may need to enable the http property (ad.es.node.http.enabled=true) in the "events-service-api-store.properties" file under events-service/processor/conf to allow port 9200 activity.
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form