Giter VIP home page Giter VIP logo

elasticsearch-eventhook's Introduction

Elasticsearch Event Hook Pugin

Overview

Event Hook Plugin provides a feature to invoke your script on Elasticsearch Cluster event.

Version

Version Elasticsearch
master 1.4.X
1.4.0 1.4.0.Beta1
1.3.0 1.3.2

Issues/Questions

Please file an issue. (Japanese forum is here.)

Installation

Install DynaRank Plugin

$ $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-eventhook/1.4.0

Getting Started

Event Hook Plugin invokes your scripts in .eventhook index. A type of .eventhook index is an event name. A script has a type "all" is invoked on all events. Event Hook Plugin uses Elasticsearch script service.

Print All Events

curl -s -XPOST localhost:9200/.eventhook/all/print_event?pretty -d '{
  "priority": 1,
  "lang": "groovy",
  "script": "logger.info(\"[\"+cluster.getLocalNode().name()+\"]:\"+eventType+\" => \"+event.source())",
  "script_type": "inline"
}'

Disable Allocation On Less Than 3 Nodes

The following script is for disappearing a master node:

curl -s -XPOST localhost:9200/.eventhook/routing_table_updater/allocation_disable_on_master?pretty -d '{
  "priority": 1,
  "lang": "groovy",
  "script": "if(nodes.nodeInfo().length<3)cluster.setTransientSettings(\"cluster.routing.allocation.enable\",\"none\")",
  "script_type": "inline"
}'

For disappearing a non-master node:

curl -s -XPOST localhost:9200/.eventhook/zen_disco_node_left/allocation_disable_on_nonmaster?pretty -d '{
  "priority": 1,
  "lang": "groovy",
  "script": "if(nodes.nodeInfo().length<3)cluster.setTransientSettings(\"cluster.routing.allocation.enable\",\"none\")",
  "script_type": "inline"
}'

Specification

Index Mapping

Name Type Description
priority long a sort order to execute a script. 1 is a high priority.
lang string a script language. ex. groovy, native, mvel...
script string a script.
script_type string a script type. ex. inline, indexded, file.

elasticsearch-eventhook's People

Contributors

marevol avatar

Stargazers

Rishu Mehrotra avatar Anselmo Silva avatar frllk avatar GuoHai avatar Andrew Eberbach avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar  avatar Matsutani Kenji avatar Koki I. avatar  avatar

elasticsearch-eventhook's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.