Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function reroute() {
- curl -XPOST 'localhost:9200/_cluster/reroute?pretty' -d '{
- "commands" : [ {
- "allocate" : {
- "index" : "'$1'",
- "shard" : '$2'
- "allow_primary" : true,
- "node" : "<node>"
- }
- }
- ]
- }' > /dev/null
- sleep 1
- }
- curl -s localhost:9200/_cluster/state?pretty | awk '
- BEGIN {more=1}
- {if (/"UNASSIGNED"/) unassigned=1}
- {if (/"routing_nodes"/) more=0}
- {if (unassigned && /"shard"/) shard=$3}
- {if (more && unassigned && /"index"/) {print "reroute",$3, shard; unassigned=false}}
- ' > runit
- source runit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement