diff --git a/data/common/common.yaml b/data/common/common.yaml --- a/data/common/common.yaml +++ b/data/common/common.yaml @@ -2857,34 +2857,20 @@ - http://esnode2.internal.softwareheritage.org:9200 - http://esnode3.internal.softwareheritage.org:9200 -# To override per "deployment" fact or instance -elasticsearch::config::network::host: "" +elasticsearch::jvm_options: + - "-Xms%{lookup('elasticsearch::jvm_options::heap_size')}" + - "-Xmx%{lookup('elasticsearch::jvm_options::heap_size')}" -elasticsearch::config::cluster::name: swh-logging-prod elasticsearch::config::path::data: /srv/elasticsearch elasticsearch::config::path::logs: /var/log/elasticsearch -elasticsearch::config::index::store::type: hybridfs -elasticsearch::config::indices::memory::index_buffer_size: 50% -elasticsearch::config::discovery::seed_hosts: - - esnode1.internal.softwareheritage.org - - esnode2.internal.softwareheritage.org - - esnode3.internal.softwareheritage.org -elasticsearch::config::cluster::initial_master_nodes: - - esnode1 - - esnode2 - - esnode3 elasticsearch::config: cluster.name: "%{alias('elasticsearch::config::cluster::name')}" node.name: "%{::hostname}" - network.host: "%{alias('elasticsearch::config::network::host')}" discovery.seed_hosts: "%{alias('elasticsearch::config::discovery::seed_hosts')}" cluster.initial_master_nodes: "%{alias('elasticsearch::config::cluster::initial_master_nodes')}" path.data: "%{alias('elasticsearch::config::path::data')}" path.logs: "%{alias('elasticsearch::config::path::logs')}" - index.store.type: "%{alias('elasticsearch::config::index::store::type')}" - indices.memory.index_buffer_size: "%{alias('elasticsearch::config::indices::memory::index_buffer_size')}" - xpack.monitoring.enabled: false logstash::listen_network: "%{lookup('internal_network')}" logstash::elasticsearch::hosts: "%{alias('elasticsearch::hosts')}" diff --git a/data/deployments/production/common.yaml b/data/deployments/production/common.yaml --- a/data/deployments/production/common.yaml +++ b/data/deployments/production/common.yaml @@ -1,3 +1,19 @@ swh::deploy::deposit::reverse_proxy::backend_http_host: "::1" swh::deploy::webapp::reverse_proxy::backend_http_host: "::1" +elasticsearch::config::cluster::name: swh-logging-prod +elasticsearch::config::discovery::seed_hosts: + - esnode1.internal.softwareheritage.org + - esnode2.internal.softwareheritage.org + - esnode3.internal.softwareheritage.org +elasticsearch::config::cluster::initial_master_nodes: + - esnode1 + - esnode2 + - esnode3 + +elasticsearch::config::extras: + indices.memory.index_buffer_size: 50% + index.store.type: hybridfs + +elasticsearch::jvm_options::heap_size: 16g + diff --git a/data/deployments/staging/common.yaml b/data/deployments/staging/common.yaml --- a/data/deployments/staging/common.yaml +++ b/data/deployments/staging/common.yaml @@ -249,14 +249,11 @@ elastic::elk_version: '7.9.3' -swh::elasticsearch::nodes: - - host: esnode1.internal.staging.swh.network - port: 9200 - -elasticsearch::config::cluster::name: swh-logging-staging -elasticsearch::config::network::host: 0.0.0.0 +elasticsearch::config::cluster::name: swh-search elasticsearch::config::discovery::seed_hosts: - - search-esnode0.internal.softwareheritage.org + - search-esnode0.internal.staging.swh.network elasticsearch::config::cluster::initial_master_nodes: - search-esnode0 + +elasticsearch::jvm_options::heap_size: 8g diff --git a/data/deployments/staging/vagrant.yaml b/data/deployments/staging/vagrant.yaml --- a/data/deployments/staging/vagrant.yaml +++ b/data/deployments/staging/vagrant.yaml @@ -2,3 +2,5 @@ swh::postgresql::shared_buffers: 128MB kafka::broker::heap_opts: "-Xmx512m -Xms512m" + +elasticsearch::jvm_options::heap_size: 512m diff --git a/data/hostname/esnode1.internal.softwareheritage.org.yaml b/data/hostname/esnode1.internal.softwareheritage.org.yaml deleted file mode 100644 --- a/data/hostname/esnode1.internal.softwareheritage.org.yaml +++ /dev/null @@ -1 +0,0 @@ -elasticsearch::config::network::host: 192.168.100.61 diff --git a/data/hostname/esnode2.internal.softwareheritage.org.yaml b/data/hostname/esnode2.internal.softwareheritage.org.yaml deleted file mode 100644 --- a/data/hostname/esnode2.internal.softwareheritage.org.yaml +++ /dev/null @@ -1 +0,0 @@ -elasticsearch::config::network::host: 192.168.100.62 diff --git a/data/hostname/esnode3.internal.softwareheritage.org.yaml b/data/hostname/esnode3.internal.softwareheritage.org.yaml deleted file mode 100644 --- a/data/hostname/esnode3.internal.softwareheritage.org.yaml +++ /dev/null @@ -1 +0,0 @@ -elasticsearch::config::network::host: 192.168.100.63 diff --git a/data/subnets/vagrant.yaml b/data/subnets/vagrant.yaml --- a/data/subnets/vagrant.yaml +++ b/data/subnets/vagrant.yaml @@ -47,9 +47,9 @@ netbox::admin::email: sysop+vagrant@softwareheritage.org static_hostnames: - 10.168.100.18: + 10.168.100.18: host: banco.internal.softwareheritage.org - aliases: + aliases: - backup.internal.softwareheritage.org - kibana.internal.softwareheritage.org 10.168.100.19: @@ -58,7 +58,7 @@ - logstash.internal.softwareheritage.org 10.168.100.29: host: pergamon.internal.softwareheritage.org - aliases: + aliases: - icinga.internal.softwareheritage.org - grafana.softwareheritage.org - stats.export.softwareheritage @@ -71,7 +71,7 @@ - deposit.internal.softwareheritage.org 10.168.100.52: host: riverside.internal.softwareheritage.org - aliases: + aliases: - sentry.softwareheritage.org 10.168.100.61: host: esnode1.internal.softwareheritage.org @@ -81,7 +81,7 @@ host: esnode3.internal.softwareheritage.org 10.168.100.104: host: saatchi.internal.softwareheritage.org - aliases: + aliases: - rabbitmq.internal.softwareheritage.org 10.168.100.106: host: kelvingrove.internal.softwareheritage.org @@ -111,3 +111,5 @@ host: vault.internal.staging.swh.network 10.168.130.70: host: journal0.internal.staging.swh.network + 10.168.130.80: + host: search-esnode0.internal.staging.swh.network diff --git a/site-modules/profile/manifests/elasticsearch.pp b/site-modules/profile/manifests/elasticsearch.pp --- a/site-modules/profile/manifests/elasticsearch.pp +++ b/site-modules/profile/manifests/elasticsearch.pp @@ -21,9 +21,11 @@ include ::profile::elastic::apt_config $elasticsearch_config = lookup('elasticsearch::config') + $elasticsearch_extra_config = lookup('elasticsearch::config::extras', {default_value => {}}) $version = lookup('elastic::elk_version') $path_data = lookup('elasticsearch::config::path::data') + $jvm_options = lookup('elasticsearch::jvm_options') file { $path_data: ensure => 'directory', @@ -34,25 +36,49 @@ apt::pin { 'elasticsearch': packages => 'elasticsearch elasticsearch-oss', - version => $version, + version => $version, priority => 1001, } -> package { 'elasticsearch': - ensure => $version, + ensure => $version, require => [ User['elasticsearch'], - Class["::profile::elastic::apt_config"] + Class['::profile::elastic::apt_config'] ] } + $config = $elasticsearch_config + $elasticsearch_extra_config + { + "network.host" => ip_for_network(lookup('internal_network')) + } + file { '/etc/elasticsearch/elasticsearch.yml': ensure => file, - owner => $uid, - group => $gid, + owner => 'root', + group => 'root', mode => '0644', - content => inline_yaml($elasticsearch_config), + content => inline_yaml($config), + require => Package['elasticsearch'], notify => Service['elasticsearch'], } + concat {'es_jvm_options': + ensure => present, + path => '/etc/elasticsearch/jvm.options.d/jvm.options', + owner => 'root', + group => 'root', + mode => '0644', + ensure_newline => true, + require => Package['elasticsearch'], + notify => Service['elasticsearch'], + } + + $jvm_options.each |$index, $option| { + concat::fragment {"${index}_es_jvm_option": + target => 'es_jvm_options', + content => $option, + order => '00', + } + } + systemd::dropin_file { 'elasticsearch.conf': unit => 'elasticsearch.service', content => template('profile/swh/elasticsearch.conf.erb'),