Skip to content

Instantly share code, notes, and snippets.

@portante
Created March 7, 2018 21:33
Show Gist options
  • Select an option

  • Save portante/9b173a137aae335b341cbd5585a3b992 to your computer and use it in GitHub Desktop.

Select an option

Save portante/9b173a137aae335b341cbd5585a3b992 to your computer and use it in GitHub Desktop.
A simple script to move a replica shard from one node to another in an OpenShift ES cluster.
#!/bin/bash
ES_URL='https://localhost:9200'
curl_post='curl -s -X POST --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key'
date
$curl_post $ES_URL/_cluster/reroute?pretty=true -d "{ \"commands\" : [ { \"move\" : { \"index\" : \"$1\", \"shard\" : $2, \"from_node\" : \"$3\", \"to_node\" : \"$4\" } } ] }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment