diff --git a/README.md b/README.md index 9d85284..9591165 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ The following illustrates applying configuration parameters to an Elasticsearch transport.tcp.port: 9301, node.data: false, node.master: true, - bootstrap.mlockall: true, + bootstrap.memory_lock: true, discovery.zen.ping.multicast.enabled: false } } vars: @@ -104,7 +104,7 @@ A more complex example: transport.tcp.port: 9301, node.data: false, node.master: true, - bootstrap.mlockall: true, + bootstrap.memory_lock: true, discovery.zen.ping.multicast.enabled: false } } vars: @@ -150,7 +150,7 @@ recommended in any multi node cluster configuration. transport.tcp.port: 9300, node.data: false, node.master: true, - bootstrap.mlockall: false, + bootstrap.memory_lock: false, discovery.zen.ping.multicast.enabled: false } } vars: @@ -172,7 +172,7 @@ recommended in any multi node cluster configuration. transport.tcp.port: 9300, node.data: true, node.master: false, - bootstrap.mlockall: false, + bootstrap.memory_lock: false, cluster.name: "test-cluster", discovery.zen.ping.multicast.enabled: false } } @@ -184,7 +184,7 @@ recommended in any multi node cluster configuration. transport.tcp.port: 9301, node.data: true, node.master: false, - bootstrap.mlockall: false, + bootstrap.memory_lock: false, cluster.name: "test-cluster", discovery.zen.ping.multicast.enabled: false } } diff --git a/tasks/elasticsearch-parameters.yml b/tasks/elasticsearch-parameters.yml index 56800b3..502403d 100644 --- a/tasks/elasticsearch-parameters.yml +++ b/tasks/elasticsearch-parameters.yml @@ -16,8 +16,8 @@ when: es_config['discovery.zen.ping.unicast.hosts'] is not defined #If the user attempts to lock memory they must specify a heap size -- fail: msg="If locking memory with bootstrap.mlockall (or bootstrap.memory_lock) a heap size must be specified" - when: (es_config['bootstrap.mlockall'] is defined or es_config['bootstrap.memory_lock'] is defined) and es_config['bootstrap.mlockall'] == True and es_heap_size is not defined +- fail: msg="If locking memory with bootstrap.memory_lock a heap size must be specified" + when: es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True and es_heap_size is not defined #Check if working with security we have an es_api_basic_auth_username and es_api_basic_auth_username - otherwise any http calls wont work - fail: msg="Enabling security requires an es_api_basic_auth_username and es_api_basic_auth_password to be provided to allow cluster operations" @@ -26,7 +26,7 @@ - set_fact: instance_default_file={{default_file | dirname}}/{{es_instance_name}}_{{default_file | basename}} - set_fact: instance_init_script={{init_script | dirname }}/{{es_instance_name}}_{{init_script | basename}} - set_fact: conf_dir={{ es_conf_dir }}/{{es_instance_name}} -- set_fact: m_lock_enabled={{ (es_config['bootstrap.mlockall'] is defined and es_config['bootstrap.mlockall'] == True) or (es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True) }} +- set_fact: m_lock_enabled={{ es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True }} #TODO - if transport.host is not local maybe error on boostrap checks diff --git a/templates/elasticsearch.j2 b/templates/elasticsearch.j2 index f099e23..a490cec 100644 --- a/templates/elasticsearch.j2 +++ b/templates/elasticsearch.j2 @@ -76,7 +76,7 @@ MAX_OPEN_FILES={{es_max_open_files}} {% endif %} # The maximum number of bytes of memory that may be locked into RAM -# Set to "unlimited" if you use the 'bootstrap.{% if es_version | version_compare('5.0', '<=') %}memory_lock{% else %}mlockall{% endif %}: true' option +# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option # in elasticsearch.yml (ES_HEAP_SIZE must also be set). # When using Systemd, the LimitMEMLOCK property must be set # in /usr/lib/systemd/system/elasticsearch.service diff --git a/templates/systemd/elasticsearch.j2 b/templates/systemd/elasticsearch.j2 index 204fa49..78d79b4 100644 --- a/templates/systemd/elasticsearch.j2 +++ b/templates/systemd/elasticsearch.j2 @@ -41,7 +41,7 @@ StandardError=inherit LimitNOFILE={{es_max_open_files}} # Specifies the maximum number of bytes of memory that may be locked into RAM -# Set to "infinity" if you use the 'bootstrap.{% if es_version | version_compare('5.0', '<=') %}memory_lock{% else %}mlockall{% endif %}: true' option +# Set to "infinity" if you use the 'bootstrap.memory_lock: true' option # in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in {{instance_default_file}} {% if m_lock_enabled %} LimitMEMLOCK=infinity diff --git a/test/integration/config.yml b/test/integration/config.yml index fabc7cd..1399556 100644 --- a/test/integration/config.yml +++ b/test/integration/config.yml @@ -4,7 +4,7 @@ hosts: localhost roles: #expand to all available parameters - - { role: elasticsearch, es_instance_name: "node1", es_data_dirs: ["/opt/elasticsearch/data-1","/opt/elasticsearch/data-2"], es_log_dir: "/opt/elasticsearch/logs", es_work_dir: "/opt/elasticsearch/temp", es_user_id: 333, es_group_id: 333, es_config: {node.name: "node1", cluster.name: "custom-cluster", discovery.zen.ping.unicast.hosts: "localhost:9301", http.port: 9201, transport.tcp.port: 9301, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } } + - { role: elasticsearch, es_instance_name: "node1", es_data_dirs: ["/opt/elasticsearch/data-1","/opt/elasticsearch/data-2"], es_log_dir: "/opt/elasticsearch/logs", es_work_dir: "/opt/elasticsearch/temp", es_user_id: 333, es_group_id: 333, es_config: {node.name: "node1", cluster.name: "custom-cluster", discovery.zen.ping.unicast.hosts: "localhost:9301", http.port: 9201, transport.tcp.port: 9301, node.data: false, node.master: true, bootstrap.memory_lock: true, discovery.zen.ping.multicast.enabled: false } } vars: es_scripts: false es_templates: false diff --git a/test/integration/helpers/serverspec/config_spec.rb b/test/integration/helpers/serverspec/config_spec.rb index 086c063..ff1d563 100644 --- a/test/integration/helpers/serverspec/config_spec.rb +++ b/test/integration/helpers/serverspec/config_spec.rb @@ -35,11 +35,10 @@ shared_examples 'config::init' do |es_version| it { should contain 'discovery.zen.ping.multicast.enabled: false' } it { should contain 'cluster.name: custom-cluster' } it { should contain 'node.name: node1' } - it { should contain 'bootstrap.mlockall: true' } + it { should contain 'bootstrap.memory_lock: true' } it { should contain 'discovery.zen.ping.unicast.hosts: localhost:9301' } it { should contain 'path.conf: /etc/elasticsearch/node1' } it { should contain 'path.data: /opt/elasticsearch/data-1/localhost-node1,/opt/elasticsearch/data-2/localhost-node1' } - it { should contain 'path.work: /opt/elasticsearch/temp/localhost-node1' } it { should contain 'path.logs: /opt/elasticsearch/logs/localhost-node1' } end @@ -77,7 +76,7 @@ shared_examples 'config::init' do |es_version| end #test to make sure mlock was applied - describe command('curl -s "localhost:9201/_nodes/process?pretty" | grep mlockall') do + describe command('curl -s "localhost:9201/_nodes/process?pretty" | grep memory_lock') do its(:stdout) { should match /true/ } its(:exit_status) { should eq 0 } end diff --git a/test/integration/helpers/serverspec/multi_spec.rb b/test/integration/helpers/serverspec/multi_spec.rb index 4d2cc2f..dba1e90 100644 --- a/test/integration/helpers/serverspec/multi_spec.rb +++ b/test/integration/helpers/serverspec/multi_spec.rb @@ -27,7 +27,7 @@ shared_examples 'multi::init' do |es_version,plugins| it { should contain 'node.master: false' } it { should contain 'discovery.zen.ping.multicast.enabled: false' } it { should contain 'node.name: localhost-node1' } - it { should_not contain 'bootstrap.mlockall: true' } + it { should_not contain 'bootstrap.memory_lock: true' } it { should contain 'path.conf: /etc/elasticsearch/node1' } it { should contain 'path.data: /opt/elasticsearch/data-1/localhost-node1,/opt/elasticsearch/data-2/localhost-node1' } it { should contain 'path.work: /tmp/elasticsearch/localhost-node1' } @@ -44,7 +44,7 @@ shared_examples 'multi::init' do |es_version,plugins| it { should contain 'node.master: true' } it { should contain 'discovery.zen.ping.multicast.enabled: false' } it { should contain 'node.name: localhost-master' } - it { should contain 'bootstrap.mlockall: true' } + it { should contain 'bootstrap.memory_lock: true' } it { should contain 'path.conf: /etc/elasticsearch/master' } it { should contain 'path.data: /opt/elasticsearch/master/localhost-master' } it { should contain 'path.work: /tmp/elasticsearch/localhost-master' } @@ -146,13 +146,13 @@ shared_examples 'multi::init' do |es_version,plugins| end #test to make sure mlock was applied - describe command('curl -s "localhost:9200/_nodes/localhost-master/process?pretty=true" | grep mlockall') do + describe command('curl -s "localhost:9200/_nodes/localhost-master/process?pretty=true" | grep memory_lock') do its(:stdout) { should match /true/ } its(:exit_status) { should eq 0 } end #test to make sure mlock was not applied - describe command('curl -s "localhost:9201/_nodes/localhost-node1/process?pretty=true" | grep mlockall') do + describe command('curl -s "localhost:9201/_nodes/localhost-node1/process?pretty=true" | grep memory_lock') do its(:stdout) { should match /false/ } its(:exit_status) { should eq 0 } end diff --git a/test/integration/multi.yml b/test/integration/multi.yml index 173528c..bf04717 100644 --- a/test/integration/multi.yml +++ b/test/integration/multi.yml @@ -3,7 +3,7 @@ - name: Elasticsearch Multi tests hosts: localhost roles: - - { role: elasticsearch, es_instance_name: "master", es_data_dirs: ["/opt/elasticsearch/master"], es_heap_size: "1g", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9200, transport.tcp.port: 9300, node.data: false, node.master: true, bootstrap.mlockall: true, discovery.zen.ping.multicast.enabled: false } } + - { role: elasticsearch, es_instance_name: "master", es_data_dirs: ["/opt/elasticsearch/master"], es_heap_size: "1g", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9200, transport.tcp.port: 9300, node.data: false, node.master: true, bootstrap.memory_lock: true, discovery.zen.ping.multicast.enabled: false } } - { role: elasticsearch, es_instance_name: "node1", es_data_dirs: "/opt/elasticsearch/data-1,/opt/elasticsearch/data-2", es_config: { "discovery.zen.ping.multicast.enabled": false, discovery.zen.ping.unicast.hosts: "localhost:9300", http.port: 9201, transport.tcp.port: 9301, node.data: true, node.master: false, discovery.zen.ping.multicast.enabled: false } } vars: es_scripts: true