Skip to content

Instantly share code, notes, and snippets.

@cdahlqvist
Last active June 4, 2024 09:20
Show Gist options
  • Save cdahlqvist/883b9def76409df94b30e1db25e7caae to your computer and use it in GitHub Desktop.
Save cdahlqvist/883b9def76409df94b30e1db25e7caae to your computer and use it in GitHub Desktop.
Sequence of commands to test forced shard allocation awareness
# Check if the allocation aareness settings can be seen through _cluster/settings
GET /_cluster/settings
# Verify that the specified node attributes are present
GET /_cat/nodeattrs
# Create 4 test indices with default settings - 1 primary shard and 1 replica shard
PUT /testindex1
PUT /testindex2
PUT /testindex3
PUT /testindex4
# Verify that shards are allocated according to allocation awareness
GET /_cat/shards/testindex*
# Increase the number of replicas for one of the indices to 2
PUT /testindex1/_settings
{
"index" : {
"number_of_replicas" : 2
}
}
# Verify that the forced allocation awareness prevents the new shard to be allocated as there are only 2 zones configured
GET /_cat/shards/testindex*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment