Last active
August 29, 2015 14:02
-
-
Save jdowning/5056522b4efc9a89ae78 to your computer and use it in GitHub Desktop.
Update cluster.routing.allocation.enable in Elasticsearch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| if [[ "$1" == "all" || "$1" == "none" ]]; then | |
| echo -n -e "Setting cluster.routing.allocation.enable to \e[0;33m${1}\e[0m..." | |
| resp=$(curl -s -XPUT localhost:9200/_cluster/settings?pretty -d "{\"transient\":{\"cluster.routing.allocation.enable\":\"${1}\"}}" | awk -F: '/acknowledged/ {print $2}') | |
| if [[ "$resp" == " true," ]]; then | |
| echo "Done!" | |
| else | |
| echo "Failed!" | |
| echo $resp | |
| exit 1 | |
| fi | |
| else | |
| echo "Usage: $0 [all|none]" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment