forked from ISTI-ansible-roles/ansible-roles
library/roles/ELK/elasticsearch: Compatibility fixes for version 5.x. Version 5.x is now the default.
This commit is contained in:
parent
3e614c33c1
commit
5a91e6944e
|
@ -1,9 +1,11 @@
|
||||||
---
|
---
|
||||||
elasticsearch_repo_key: https://packages.elastic.co/GPG-KEY-elasticsearch
|
elasticsearch_repo_key: https://packages.elastic.co/GPG-KEY-elasticsearch
|
||||||
elasticsearch_repo: 'deb http://packages.elastic.co/elasticsearch/2.x/debian stable main'
|
elasticsearch_repo_version: 5.x
|
||||||
|
elasticsearch_repo: 'deb http://packages.elastic.co/elasticsearch/{{ elasticsearch_repo_version }}/debian stable main'
|
||||||
elasticsearch_packages:
|
elasticsearch_packages:
|
||||||
- elasticsearch
|
- elasticsearch
|
||||||
|
|
||||||
|
elasticsearch_package_state: 'present'
|
||||||
elasticsearch_cluster_name: 'Elasticsearch Cluster'
|
elasticsearch_cluster_name: 'Elasticsearch Cluster'
|
||||||
elasticsearch_enabled: True
|
elasticsearch_enabled: True
|
||||||
elasticsearch_http_port: 9200
|
elasticsearch_http_port: 9200
|
||||||
|
@ -11,15 +13,23 @@ elasticsearch_data_dir: /var/lib/elasticsearch
|
||||||
elasticsearch_log_dir: /var/log/elasticsearch
|
elasticsearch_log_dir: /var/log/elasticsearch
|
||||||
elasticsearch_bind_ip: 127.0.0.1
|
elasticsearch_bind_ip: 127.0.0.1
|
||||||
elasticsearch_discovery_host_list: '["127.0.0.1", "[::1]"]'
|
elasticsearch_discovery_host_list: '["127.0.0.1", "[::1]"]'
|
||||||
elasticsearch_define_majority_of_nodes: False
|
elasticsearch_define_majority_of_nodes: True
|
||||||
elasticsearch_majority_of_nodes: 3
|
elasticsearch_majority_of_nodes: 1
|
||||||
|
elasticsearch_real_cluster: False
|
||||||
elasticsearch_recover_after_nodes: 3
|
elasticsearch_recover_after_nodes: 3
|
||||||
elasticsearch_max_local_storage_nodes: 1
|
elasticsearch_max_local_storage_nodes: 1
|
||||||
elasticsearch_destructive_requires_name: True
|
elasticsearch_destructive_requires_name: 'true'
|
||||||
elasticsearch_define_heap_size: False
|
elasticsearch_define_heap_size: False
|
||||||
elasticsearch_heap_size: 2g
|
elasticsearch_heap_size: 2g
|
||||||
elasticsearch_additional_java_opts: ''
|
elasticsearch_additional_java_opts: ''
|
||||||
elasticsearch_max_open_files: 65535
|
elasticsearch_max_open_files: 65536
|
||||||
|
|
||||||
elasticsearch_plugins:
|
# bin/plugin for 2.x, bin/elasticsearch-plugin for 5.x
|
||||||
|
elasticsearch_plugin_bin: /usr/share/elasticsearch/bin/elasticsearch-plugin
|
||||||
|
#elasticsearch_plugins:
|
||||||
|
# - { name: 'royrusso/elasticsearch-HQ', state: 'present' }
|
||||||
|
|
||||||
|
# elasticsearch 5 not supported yet
|
||||||
|
elasticsearch_hq_install: False
|
||||||
|
elasticsearch_hq_plugin:
|
||||||
- { name: 'royrusso/elasticsearch-HQ', state: 'present' }
|
- { name: 'royrusso/elasticsearch-HQ', state: 'present' }
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
---
|
---
|
||||||
- name: Install the elasticsearch repo key
|
- block:
|
||||||
apt_key: url={{ elasticsearch_repo_key }} state=present
|
- name: Install the elasticsearch repo key
|
||||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
apt_key: url={{ elasticsearch_repo_key }} state=present
|
||||||
|
|
||||||
- name: Install the elasticsearch deb repository
|
- name: Install the elasticsearch deb repository
|
||||||
apt_repository: repo='{{ elasticsearch_repo }}' state=present update_cache=yes
|
apt_repository: repo='{{ elasticsearch_repo }}' state=present update_cache=yes
|
||||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
|
||||||
|
|
||||||
- name: Install the elasticsearch deb packages
|
- name: Install the elasticsearch deb packages
|
||||||
apt: name='{{ item }}' state=present
|
apt: name='{{ item }}' state={{ elasticsearch_package_state }} update_cache=yes cache_valid_time=1800
|
||||||
with_items: '{{ elasticsearch_packages }}'
|
with_items: '{{ elasticsearch_packages }}'
|
||||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
|
||||||
|
|
||||||
- name: Install the elasticsearch startup default
|
- name: Install the elasticsearch startup default
|
||||||
template: src=elasticsearch-default.j2 dest=/etc/default/elasticsearch owner=root group=elasticsearch mode=0640
|
template: src=elasticsearch-default.j2 dest=/etc/default/elasticsearch owner=root group=elasticsearch mode=0640
|
||||||
notify: Restart elasticsearch
|
notify: Restart elasticsearch
|
||||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
|
||||||
|
|
||||||
- name: Install the elasticsearch configuration
|
- name: Install the elasticsearch JVM options
|
||||||
template: src=elasticsearch.yml.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root group=elasticsearch mode=0640
|
template: src=jvm.options.j2 dest=/etc/elasticsearch/jvm.options owner=root group=elasticsearch mode=0640
|
||||||
notify: Restart elasticsearch
|
notify: Restart elasticsearch
|
||||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
|
||||||
|
|
||||||
|
- name: Install the elasticsearch configuration
|
||||||
|
template: src=elasticsearch.yml.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root group=elasticsearch mode=0640
|
||||||
|
notify: Restart elasticsearch
|
||||||
|
|
||||||
|
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
---
|
---
|
||||||
- block:
|
- block:
|
||||||
- name: Manage a list of elasticsearch plugins
|
- name: Manage a list of elasticsearch plugins
|
||||||
elasticsearch_plugin: name="{{ item.name }}" state={{ item.state }} url={{ item.url|default(omit) }} version={{ item.version|default(omit) }}
|
elasticsearch_plugin: name="{{ item.name }}" state={{ item.state }} plugin_bin={{ elasticsearch_plugin_bin }} url={{ item.url|default(omit) }} version={{ item.version|default(omit) }}
|
||||||
with_items: '{{ elasticsearch_plugins | default ([]) }}'
|
with_items: '{{ elasticsearch_plugins | default ([]) }}'
|
||||||
|
|
||||||
|
- name: Install the elasticsearch HQ plugin
|
||||||
|
elasticsearch_plugin: name="{{ item.name }}" state={{ item.state }} plugin_bin={{ elasticsearch_plugin_bin }} url={{ item.url|default(omit) }} version={{ item.version|default(omit) }}
|
||||||
|
with_items: '{{ elasticsearch_hq_plugin | default ([]) }}'
|
||||||
|
when: elasticsearch_hq_install
|
||||||
|
|
||||||
when: elasticsearch_plugins is defined
|
when: elasticsearch_plugins is defined
|
||||||
tags: [ 'elasticsearch', 'es_plugins' ]
|
tags: [ 'elasticsearch', 'es_plugins' ]
|
||||||
|
|
||||||
|
|
|
@ -77,16 +77,18 @@ discovery.zen.minimum_master_nodes: {{ elasticsearch_majority_of_nodes }}
|
||||||
# For more information, see the documentation at:
|
# For more information, see the documentation at:
|
||||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
|
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
|
||||||
#
|
#
|
||||||
|
{% if elasticsearch_real_cluster %}
|
||||||
# ---------------------------------- Gateway -----------------------------------
|
# ---------------------------------- Gateway -----------------------------------
|
||||||
#
|
#
|
||||||
# Block initial recovery after a full cluster restart until N nodes are started:
|
# Block initial recovery after a full cluster restart until N nodes are started:
|
||||||
#
|
#
|
||||||
gateway.recover_after_nodes:
|
gateway.recover_after_nodes: {{ elasticsearch_recover_after_nodes }}
|
||||||
#
|
#
|
||||||
# For more information, see the documentation at:
|
# For more information, see the documentation at:
|
||||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
|
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
|
||||||
#
|
#
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
# ---------------------------------- Various -----------------------------------
|
# ---------------------------------- Various -----------------------------------
|
||||||
#
|
#
|
||||||
# Disable starting multiple nodes on a single system:
|
# Disable starting multiple nodes on a single system:
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
## JVM configuration
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
## IMPORTANT: JVM heap size
|
||||||
|
################################################################
|
||||||
|
##
|
||||||
|
## You should always set the min and max JVM heap
|
||||||
|
## size to the same value. For example, to set
|
||||||
|
## the heap to 4 GB, set:
|
||||||
|
##
|
||||||
|
## -Xms4g
|
||||||
|
## -Xmx4g
|
||||||
|
##
|
||||||
|
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
|
||||||
|
## for more information
|
||||||
|
##
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# Xms represents the initial size of total heap space
|
||||||
|
# Xmx represents the maximum size of total heap space
|
||||||
|
|
||||||
|
-Xms{{ elasticsearch_heap_size }}
|
||||||
|
-Xmx{{ elasticsearch_heap_size }}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
## Expert settings
|
||||||
|
################################################################
|
||||||
|
##
|
||||||
|
## All settings below this section are considered
|
||||||
|
## expert settings. Don't tamper with them unless
|
||||||
|
## you understand what you are doing
|
||||||
|
##
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
## GC configuration
|
||||||
|
-XX:+UseConcMarkSweepGC
|
||||||
|
-XX:CMSInitiatingOccupancyFraction=75
|
||||||
|
-XX:+UseCMSInitiatingOccupancyOnly
|
||||||
|
|
||||||
|
## optimizations
|
||||||
|
|
||||||
|
# disable calls to System#gc
|
||||||
|
-XX:+DisableExplicitGC
|
||||||
|
|
||||||
|
# pre-touch memory pages used by the JVM during initialization
|
||||||
|
-XX:+AlwaysPreTouch
|
||||||
|
|
||||||
|
## basic
|
||||||
|
|
||||||
|
# force the server VM
|
||||||
|
-server
|
||||||
|
|
||||||
|
# set to headless, just in case
|
||||||
|
-Djava.awt.headless=true
|
||||||
|
|
||||||
|
# ensure UTF-8 encoding by default (e.g. filenames)
|
||||||
|
-Dfile.encoding=UTF-8
|
||||||
|
|
||||||
|
# use our provided JNA always versus the system one
|
||||||
|
-Djna.nosys=true
|
||||||
|
|
||||||
|
# flag to explicitly tell Netty to not use unsafe
|
||||||
|
-Dio.netty.noUnsafe=true
|
||||||
|
|
||||||
|
## heap dumps
|
||||||
|
|
||||||
|
# generate a heap dump when an allocation from the Java heap fails
|
||||||
|
# heap dumps are created in the working directory of the JVM
|
||||||
|
-XX:+HeapDumpOnOutOfMemoryError
|
||||||
|
|
||||||
|
# specify an alternative path for heap dumps
|
||||||
|
# ensure the directory exists and has sufficient space
|
||||||
|
#-XX:HeapDumpPath=${heap.dump.path}
|
||||||
|
|
||||||
|
## GC logging
|
||||||
|
|
||||||
|
#-XX:+PrintGCDetails
|
||||||
|
#-XX:+PrintGCTimeStamps
|
||||||
|
|
||||||
|
#-XX:+PrintGCDateStamps
|
||||||
|
#-XX:+PrintClassHistogram
|
||||||
|
#-XX:+PrintTenuringDistribution
|
||||||
|
#-XX:+PrintGCApplicationStoppedTime
|
||||||
|
|
||||||
|
# log GC status to a file with time stamps
|
||||||
|
# ensure the directory exists
|
||||||
|
#-Xloggc:${loggc}
|
||||||
|
|
||||||
|
# Elasticsearch 5.0.0 will throw an exception on unquoted field names in JSON.
|
||||||
|
# If documents were already indexed with unquoted fields in a previous version
|
||||||
|
# of Elasticsearch, some operations may throw errors.
|
||||||
|
#
|
||||||
|
# WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided
|
||||||
|
# only for migration purposes.
|
||||||
|
#-Delasticsearch.json.allow_unquoted_field_names=true
|
Loading…
Reference in New Issue