Skip to content

Instantly share code, notes, and snippets.

@portante
Last active March 7, 2018 21:32
Show Gist options
  • Save portante/e09e0d2f63903f6b2fb1d48f39a6ab53 to your computer and use it in GitHub Desktop.
Save portante/e09e0d2f63903f6b2fb1d48f39a6ab53 to your computer and use it in GitHub Desktop.
A simple script to "allocate" a primary shard on an particular OpenShift pod ES cluster member.
#!/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\" : [ { \"allocate\" : { \"index\" : \"$2\", \"shard\" : 0, \"node\" : \"$1\", \"allow_primary\": \"true\" } } ] }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment