I've seen several topics about this but none really solved my problem.
I need to change Elasticsearch config path so I created override.conf in /etc/systemd/system/elasticsearch.service.d/ with the following lines:
[Service]
Environment=ES_HOME={{ service_home_directory }}
Environment=ES_PATH_CONF={{ service_conf_directory }}
Environment=WORK_DIR={{ service_tmp_directory }}
Environment=DATA_DIR={{ service_data_directory }}
Environment=LOG_DIR={{ service_log_directory }}
Environment=PID_DIR={{ service_systemd_directory }}
WorkingDirectory={{ service_home_directory }}
ExecStart={{ service_home_directory }}/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid
Removing the --quiet from the exec command worked, changing PID_DIR too, but for other variables the process uses values set in /etc/sysconfig/elasticsearch, nothing is overriden.
Did I miss something or do something wrong? I think the solution is very simple but I just can't find it...
Edit: if I check systemctl show elasticsearch.service I do have the correct environment variables (ES_PATH_CONF, WORK_DIR, LOG_DIR, DATA_DIR) but if in the executed process the options are not right:
elastic+ 59979 3.9 15.9 3684404 1276456 ? Ssl 14:50 0:26 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.k1qFeiEP -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/var/log/elasticsearch/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=rpm -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /path/to/pid/file
Those JVM options are not what I have in my jvm.options, so I think the problem really is that the ES_PATH_CONF isn't used/overriden.