mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2022-01-25 15:00
This commit is contained in:
49
roles/elasticsearch/templates/elasticsearch.service.j2
Normal file
49
roles/elasticsearch/templates/elasticsearch.service.j2
Normal file
@@ -0,0 +1,49 @@
|
||||
[Unit]
|
||||
Description=Elasticsearch
|
||||
Documentation=https://www.elastic.co
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
RuntimeDirectory=elasticsearch
|
||||
PrivateTmp=true
|
||||
Environment=ES_HOME={{ es_root_dir }}/app
|
||||
Environment=ES_PATH_CONF={{ es_root_dir }}/etc
|
||||
Environment=ES_TMPDIR={{ es_root_dir }}/tmp
|
||||
Environment=PID_DIR=/run/elasticsearch
|
||||
WorkingDirectory={{ es_root_dir }}/app
|
||||
User={{ es_user }}
|
||||
Group={{ es_user }}
|
||||
|
||||
ExecStart={{ es_root_dir }}/app/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid
|
||||
|
||||
# StandardOutput is configured to redirect to journalctl since
|
||||
# some error messages may be logged in standard output before
|
||||
# elasticsearch logging system is initialized. Elasticsearch
|
||||
# stores its logs in {{ es_root_dir }}/log/
|
||||
StandardOutput=journal
|
||||
StandardError=inherit
|
||||
|
||||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
LimitNOFILE=65535
|
||||
# Specifies the maximum number of processes
|
||||
LimitNPROC=4096
|
||||
# Specifies the maximum size of virtual memory
|
||||
LimitAS=infinity
|
||||
# Specifies the maximum file size
|
||||
LimitFSIZE=infinity
|
||||
# Give some time for the process to stop
|
||||
TimeoutStopSec=300
|
||||
# SIGTERM signal is used to stop the Java process
|
||||
KillSignal=SIGTERM
|
||||
# Send the signal only to the JVM rather than its control group
|
||||
KillMode=process
|
||||
# Java process is never killed
|
||||
SendSIGKILL=no
|
||||
# When a JVM receives a SIGTERM signal it exits with code 143
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@@ -1,11 +1,11 @@
|
||||
cluster.name: {{ es_cluster_name }}
|
||||
node.name: {{ es_node_name }}
|
||||
path.data: {{ es_root_dir }}/data
|
||||
path.logs: {{ es_root_dir }}/logs
|
||||
network.host: 0.0.0.0
|
||||
http.port: {{ es_port }}
|
||||
node.name: {{ es_node_name }}
|
||||
path.data: {{ es_data_dir }}
|
||||
path.logs: /var/log/elasticsearch
|
||||
path.repo: [ {{ es_backup_dir }} ]
|
||||
path.repo: [ {{ es_root_dir }}/backup ]
|
||||
action.auto_create_index: false
|
||||
{% if es_major_version is defined and es_major_version is version('7','>=') %}
|
||||
{% if es_version is version('7','>=') %}
|
||||
discovery.type: single-node
|
||||
{% endif %}
|
||||
|
46
roles/elasticsearch/templates/jvm.options.j2
Normal file
46
roles/elasticsearch/templates/jvm.options.j2
Normal file
@@ -0,0 +1,46 @@
|
||||
-Xms{{ es_memory }}
|
||||
-Xmx{{ es_memory }}
|
||||
## GC configuration
|
||||
8-13:-XX:+UseConcMarkSweepGC
|
||||
8-13:-XX:CMSInitiatingOccupancyFraction=75
|
||||
8-13:-XX:+UseCMSInitiatingOccupancyOnly
|
||||
# G1GC Configuration
|
||||
# NOTE: G1 GC is only supported on JDK version 10 or later
|
||||
# to use G1GC, uncomment the next two lines and update the version on the
|
||||
# following three lines to your version of the JDK
|
||||
# 10-13:-XX:-UseConcMarkSweepGC
|
||||
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
|
||||
14-:-XX:+UseG1GC
|
||||
|
||||
## JVM temporary directory
|
||||
-Djava.io.tmpdir=${ES_TMPDIR}
|
||||
|
||||
## 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 unless an alternative path is
|
||||
# specified
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
# exit right after heap dump on out of memory error. Recommended to also use
|
||||
# on java 8 for supported versions (8u92+).
|
||||
9-:-XX:+ExitOnOutOfMemoryError
|
||||
|
||||
# specify an alternative path for heap dumps; ensure the directory exists and
|
||||
# has sufficient space
|
||||
-XX:HeapDumpPath={{ es_root_dir }}/data
|
||||
|
||||
# specify an alternative path for JVM fatal error logs
|
||||
-XX:ErrorFile={{ es_root_dir }}/logs/hs_err_pid%p.log
|
||||
|
||||
## JDK 8 GC logging
|
||||
8:-XX:+PrintGCDetails
|
||||
8:-XX:+PrintGCDateStamps
|
||||
8:-XX:+PrintTenuringDistribution
|
||||
8:-XX:+PrintGCApplicationStoppedTime
|
||||
8:-Xloggc:logs/gc.log
|
||||
8:-XX:+UseGCLogFileRotation
|
||||
8:-XX:NumberOfGCLogFiles=32
|
||||
8:-XX:GCLogFileSize=64m
|
||||
|
||||
# JDK 9+ GC logging
|
||||
9-:-Xlog:gc*,gc+age=trace,safepoint:file={{ es_root_dir }}/logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
|
@@ -1,5 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
curl -X DELETE http://localhost:{{ es_port }}/_snapshot/lbkp/lbkp
|
||||
umount /home/lbkp/es
|
||||
fstrim -a -v
|
||||
|
@@ -2,6 +2,4 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
mkdir -p /home/lbkp/es
|
||||
mount -o bind,ro {{ es_backup_dir }} /home/lbkp/es
|
||||
curl -X PUT http://localhost:{{ es_port }}/_snapshot/lbkp/lbkp?wait_for_completion=true
|
||||
|
1
roles/elasticsearch/templates/tmpfiles.conf.j2
Normal file
1
roles/elasticsearch/templates/tmpfiles.conf.j2
Normal file
@@ -0,0 +1 @@
|
||||
d /run/elasticsearch 700 {{ es_user }} {{ es_user }}
|
Reference in New Issue
Block a user