From 3a5ef38f3b02a1b06d3215f9e6853d8a82fea8ab Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 25 Feb 2019 15:53:08 +0100 Subject: [PATCH] Add elasticsearch_datadir_volume Change-Id: Id8276448c6e779b2b4a0aafee45d953c4f009fc1 --- ansible/group_vars/all.yml | 1 + ansible/roles/destroy/tasks/cleanup_host.yml | 1 + ansible/roles/elasticsearch/defaults/main.yml | 2 +- .../logging-and-monitoring/central-logging-guide.rst | 4 ++++ tools/cleanup-host | 5 +++++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index b53e135f18..6b15ed7211 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -133,6 +133,7 @@ keepalived_virtual_router_id: "51" # Elasticsearch Options ####################### es_heap_size: "1G" +elasticsearch_datadir_volume: "elasticsearch" ################### # Messaging options diff --git a/ansible/roles/destroy/tasks/cleanup_host.yml b/ansible/roles/destroy/tasks/cleanup_host.yml index e0e5272348..539708c2aa 100644 --- a/ansible/roles/destroy/tasks/cleanup_host.yml +++ b/ansible/roles/destroy/tasks/cleanup_host.yml @@ -5,6 +5,7 @@ environment: enable_haproxy: "{{ enable_haproxy }}" enable_swift: "{{ enable_swift }}" + elasticsearch_datadir_volume: "{{ elasticsearch_datadir_volume }}" glance_file_datadir_volume: "{{ glance_file_datadir_volume }}" nova_instance_datadir_volume: "{{ nova_instance_datadir_volume }}" gnocchi_metric_datadir_volume: "{{ gnocchi_metric_datadir_volume }}" diff --git a/ansible/roles/elasticsearch/defaults/main.yml b/ansible/roles/elasticsearch/defaults/main.yml index 3ce3085462..c2ab68064f 100644 --- a/ansible/roles/elasticsearch/defaults/main.yml +++ b/ansible/roles/elasticsearch/defaults/main.yml @@ -12,7 +12,7 @@ elasticsearch_services: volumes: - "{{ node_config_directory }}/elasticsearch/:{{ container_config_directory }}/" - "/etc/localtime:/etc/localtime:ro" - - "elasticsearch:/var/lib/elasticsearch/data" + - "{{ elasticsearch_datadir_volume }}:/var/lib/elasticsearch/data" dimensions: "{{ elasticsearch_dimensions }}" haproxy: elasticsearch: diff --git a/doc/source/reference/logging-and-monitoring/central-logging-guide.rst b/doc/source/reference/logging-and-monitoring/central-logging-guide.rst index 20f3c26f8d..91c60852a3 100644 --- a/doc/source/reference/logging-and-monitoring/central-logging-guide.rst +++ b/doc/source/reference/logging-and-monitoring/central-logging-guide.rst @@ -31,6 +31,10 @@ By default Elasticsearch is deployed on port ``9200``. Elasticsearch stores a lot of logs, so if you are running centralized logging, remember to give ``/var/lib/docker`` an adequate space. + Alternatively it is possible to use a local directory instead of the volume + ``elasticsearch`` to store the data of Elasticsearch. The path can be set via + the variable ``elasticsearch_datadir_volume``. + Kibana ~~~~~~ diff --git a/tools/cleanup-host b/tools/cleanup-host index a22628acd4..cc885558cf 100755 --- a/tools/cleanup-host +++ b/tools/cleanup-host @@ -61,6 +61,11 @@ if [[ "$nova_instance_datadir_volume" != "nova_compute" && -d "$nova_instance_da rm -rfv $nova_instance_datadir_volume fi +if [[ "$elasticsearch_datadir_volume" != "elasticsearch" && -d "$elasticsearch_datadir_volume" ]]; then + echo "Removing elasticsearch volume if it is customzied" + rm -rfv $elasticsearch_datadir_volume +fi + if [[ "$gnocchi_metric_datadir_volume" != "gnocchi" && -d "$gnocchi_metric_datadir_volume" ]]; then echo "Removing gnocchi volume if it is customzied" rm -rfv $gnocchi_metric_datadir_volume