UNPKG

elasticsearch-watchdog

Version:

A watchdog of elasticsearch - cluster nodes' statuses monitor, auto restart, keep PRIMARY node unique.

143 lines (123 loc) 4.57 kB
############# Elasticsearch Watchdog Configuration Example ############# # Overview of all various configuration settings. # YAML reference: http://en.wikipedia.org/wiki/YAML ############################## WATCHDOG ################################ # The name of current WATCHDOG, it is required. # watchdog.name: elasticsearch-server # The frequency of watchdog patrolling. # https://www.npmjs.org/package/dynamic-timer # # it could be one of: # low - lucas # medium - fibonacci # high - dayan # critical - procession # # medium by default. # #watchdog.frequency: medium ################################ NODES ################################# # Both `nodes.elasticsearch` and `nodes.ssh` must be instances of Array and keep the same lengths.` # And each host must have a ssh connection, e.g.: # nodes.elasticsearch: ["host1"] # nodes: # ssh: # - host: host1 # ... # # Configure an list of nodes in the cluster of elasticsearch, e.g.: # nodes.elasticsearch: ["host1", "host2:port"] # # The port is optional, if it is not defined, 9200 will be used by default. # nodes.elasticsearch: ["host1", "host2:port2", "host3:port3"] # Connect to the specific server by OpenSSH, it should be defined as: # nodes: # ssh: # - host: 192.168.1.100 # port: 22 # username: root # password: p@ssword # - host: 192.168.1.101 # port: 22 # username: root # password: p@ssword # # A plain text `password` in the configured file is extremely dangerous, but don't worry, try to encrypt # your password through CLI like following: # $ watchdog pwd <PASSWORD> # And copy the encrypted string to replace the `p@ssword`. # nodes: ssh: # defined an anchor. - &ssh1 host: host1 port: 22 username: root password: passw@rd es_stop: kill -9 `cat /var/www/elasticsearch-1.3.2/pid` es_start: elasticsearch -d -p /var/www/elasticsearch-1.3.2/pid -Xmx8G -Xms8G # inherits the properties by anchor id - a YAML feature. - <<: *ssh1 host: host2 password: c2162f2355d0430066194c8d356db578 - <<: *ssh1 host: host3 password: 75f0dc5bb33bbe48891f1175f69bf00c ################## ELASTICSEARCH CONDITIONS ###################### # All these conditions indicate whether node available or not, ElasticSearch nodes will be auto-restarted if unavailable. # Server is running smoothly when the status of ElasticSearch matches this Setting, # WATCHDOG will not auto-restart your ElasticSearch server. # It could be "yellow", "green" or "red", and if not be defined, ["yellow", "green"] will be set by default. # # yellow - A little buzy. # green - Smoothly. # Red - Very buzy, unresponsive sometimes. # #elasticsearch.status: ["yellow", "green"] # The strategy of keeping primary node, it could be: # MS2M # the minority is subordinate to majority, if a node stands alone, WATCHDOG will try to shut it down, and restart it. # IP_ADDRESS # Always keep the primary node as a specific one, e.g.: "192.168.1.1". # # MS2M by default. # #elasticsearch.primary: MS2M # The latency time of ElasticSearch stop and start. # 5 seconds by default. # #elasticsearch.delay: 5s # A value indicates whether auto-restart the ElasticSearch server or not, `true` by default. # Auto-restart will be triggered in one of the following situation. # 1. If ElasticSearch APIs, _cluster/health or _cluster/state can not be resolved(timeout). # 2. Node status is not one of `elasticsearch.status`. # 3. Master node does not conform to the `elasticsearch.primary`. # #elasticsearch.autorestart: true ############################## HTTP ############################### # Http request options. # All the time various such as `http.wait` and `http.timeout` support below formats: # h: hour, `1h` means 1 hour. # m: minute, `2m` means 2 minutes. # s: second, `3s` means 3 seconds. # {Number}: millisecond, `4000` means 4000 milliseconds(4 seconds). # The latency time of Health check, just be used after ElasticSearch being restart. # THE REBOOT TIME AND NODES' STATUSES WAS PERSISTED AS A JSON FILE, SO MAKE SURE YOUR PROJECT DIRECTORY IS WRITABLE. # 20 minutes by default. # #http.wait: 20m # The http `timeout`. # 10 seconds by default. # #http.timeout: 10s # The latency time when a http request error is caught. # 5 seconds by default. # #http.delay: 5s # The maximize number of times to connect to ElasticSearch server. # 3 by default. # #http.retry: 3