lib/smartcloud/grids/elasticsearch.rb in smartcloud-0.3.1 vs lib/smartcloud/grids/elasticsearch.rb in smartcloud-0.3.2

- old
+ new

@@ -8,24 +8,21 @@ def install self.uninstall print "-----> Creating settings for elasticsearch ... " - vm_max_map_count_filepath = "~/.smartcloud/grids/grid-elasticsearch/vm_max_map_count" ssh = Smartcloud::SSH.new - ssh.run "sudo sysctl -b vm.max_map_count > #{vm_max_map_count_filepath}" - ssh.run "sudo sysctl -w vm.max_map_count=262144" + ssh.run "echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo sysctl --system" puts "done" end def uninstall print "-----> Removing settings for elasticsearch ... " - vm_max_map_count_filepath = "~/.smartcloud/grids/grid-elasticsearch/vm_max_map_count" ssh = Smartcloud::SSH.new - ssh.run "test -f #{vm_max_map_count_filepath} && sudo sysctl -w vm.max_map_count=$(cat #{vm_max_map_count_filepath})" - ssh.run "test -f #{vm_max_map_count_filepath} && rm #{vm_max_map_count_filepath}" + # NOTE: sysctl does not reset this setting until restart of system even after sudo sysctl --system is run. + ssh.run "test -f /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo rm /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo sysctl --system" puts "done" end def self.up(*args) \ No newline at end of file