#!/bin/sh
exec 2>&1

umask 077
ulimit -n 65536
ulimit -l unlimited
sysctl -w vm.max_map_count=262144

export ES_HOME=<%= @options[:install_directory] %>/elasticsearch
export ES_JAVA_OPTS="
  -server
  -Xms<%= @options[:max_memory] %> -Xmx<%= @options[:max_memory] %>
  -Djava.net.preferIPv4Stack=true
  -XX:+UseParNewGC
  -XX:+UseConcMarkSweepGC
  -XX:+CMSParallelRemarkEnabled
  -XX:SurvivorRatio=8
  -XX:MaxTenuringThreshold=1
  -XX:CMSInitiatingOccupancyFraction=75
  -XX:+UseCMSInitiatingOccupancyOnly
  -XX:+HeapDumpOnOutOfMemoryError"
export JAVA_HOME=<%= @options[:install_directory] %>/embedded/jre

exec chpst -P -U <%= node['graylog']['user']['username'] %> -u <%= node['graylog']['user']['username'] %> $ES_HOME/bin/elasticsearch

#!/bin/sh
exec 2>&1

umask 077
ulimit -n 65536
ulimit -l unlimited
sysctl -w vm.max_map_count=262144

export ES_HOME=<%= @options[:install_directory] %>/elasticsearch
export ES_JAVA_OPTS="
  -server
  -Xms<%= @options[:max_memory] %> -Xmx<%= @options[:max_memory] %>
  -Djava.net.preferIPv4Stack=true
  -Dlog4j2.disable.jmx=true
  -XX:+UseParNewGC
  -XX:+UseConcMarkSweepGC
  -XX:+CMSParallelRemarkEnabled
  -XX:SurvivorRatio=8
  -XX:MaxTenuringThreshold=1
  -XX:CMSInitiatingOccupancyFraction=75
  -XX:+UseCMSInitiatingOccupancyOnly
  -XX:+HeapDumpOnOutOfMemoryError"
export JAVA_HOME=<%= @options[:install_directory] %>/embedded/jre

exec chpst -P -U <%= node['graylog']['user']['username'] %> -u <%= node['graylog']['user']['username'] %> $ES_HOME/bin/elasticsearch

Add back setting to disable JMX in log4j 2
Add back setting to disable JMX in log4j 2

If the setting is missing, Log4j 2 (used in Elasticsearch 5.x) will try to
register MBeans, which fails due to JMX being disabled.

Refs #46
Refs #48
