Ensure elasticsearch logs and data dirs exist before startup (#17531)

With a recent change in ES https://github.com/elastic/elasticsearch/pull/125449
configuring path.data or path.logs to directories that do not exist cause ES to
not be able to start up. This commit ensures those directories exist. The
teardown script already ensures they are removed 712b37e1df/qa/integration/services/elasticsearch_teardown.sh (L26-L27)
This commit is contained in:
Cas Donoghue 2025-04-09 13:32:32 -07:00 committed by GitHub
parent 712b37e1df
commit 8e6e183adc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,10 +5,13 @@ current_dir="$(dirname "$0")"
source "$current_dir/helpers.sh"
ES_HOME="$current_dir/../../../build/elasticsearch"
ES_DATA_PATH="/tmp/ls_integration/es-data"
ES_LOGS_PATH="/tmp/ls_integration/es-logs"
start_es() {
es_args=$@
JAVA_HOME= $ES_HOME/bin/elasticsearch -Expack.security.enabled=false -Epath.data=/tmp/ls_integration/es-data -Ediscovery.type=single-node -Epath.logs=/tmp/ls_integration/es-logs $es_args -p $ES_HOME/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null &
mkdir -p $ES_DATA_PATH $ES_LOGS_PATH
JAVA_HOME= $ES_HOME/bin/elasticsearch -Expack.security.enabled=false -Epath.data=$ES_DATA_PATH -Ediscovery.type=single-node -Epath.logs=$ES_LOGS_PATH $es_args -p $ES_HOME/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null &
count=120
echo "Waiting for elasticsearch to respond..."
while ! curl --silent localhost:9200 && [[ $count -ne 0 ]]; do