Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. function reroute() {
  2. curl -XPOST 'localhost:9200/_cluster/reroute?pretty' -d '{
  3. "commands" : [ {
  4. "allocate" : {
  5. "index" : "'$1'",
  6. "shard" : '$2'
  7. "allow_primary" : true,
  8. "node" : "<node>"
  9. }
  10. }
  11. ]
  12. }' > /dev/null
  13. sleep 1
  14. }
  15. curl -s localhost:9200/_cluster/state?pretty | awk '
  16. BEGIN {more=1}
  17. {if (/"UNASSIGNED"/) unassigned=1}
  18. {if (/"routing_nodes"/) more=0}
  19. {if (unassigned && /"shard"/) shard=$3}
  20. {if (more && unassigned && /"index"/) {print "reroute",$3, shard; unassigned=false}}
  21. ' > runit
  22. source runit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement