mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
Check glibc version (#62728)
Java 15 requires at last glibc 2.14, but we support older Linux OSs that ship with older versions. Rather than continue to ship Java 14, which is now EOL and therefore unsupported, ES will detect this situation and print a helpful message, instead of the cryptic error that would otherwise be printed. Users on older OSs will have to set JAVA_HOME instead of using the bundled JVM. This doesn't affect v8.0.0 because these older Linux OSs will not be supported, and all the supported ones have glibc 2.14.
This commit is contained in:
parent
77bfb32635
commit
54d97ecc60
@ -35,6 +35,43 @@ ES_HOME=`dirname "$ES_HOME"`
|
||||
# now set the classpath
|
||||
ES_CLASSPATH="$ES_HOME/lib/*"
|
||||
|
||||
|
||||
# On systems that are built upon glibc, We need to check the version of
|
||||
# glibc because Elasticsearch bundles JDK 15, which requires glibc >= 2.14
|
||||
check_glibc_version() {
|
||||
local GETCONF="$( getconf GNU_LIBC_VERSION 2>/dev/null )"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# Must be on a POSIX system that isn't using glibc.
|
||||
return 0
|
||||
fi
|
||||
|
||||
local GLIBC_VERSION="$( echo "$GETCONF" | cut -d' ' -f2 )"
|
||||
local MAJOR="$( echo $GLIBC_VERSION | cut -d. -f1 )"
|
||||
local MINOR="$( echo $GLIBC_VERSION | cut -d. -f2 )"
|
||||
|
||||
local STATUS=pass
|
||||
|
||||
if [[ "$MAJOR" -lt 2 ]]; then
|
||||
STATUS=fail
|
||||
elif [[ "$MAJOR" -eq 2 && "$MINOR" -lt 14 ]]; then
|
||||
STATUS=fail
|
||||
fi
|
||||
|
||||
if [[ "$STATUS" == "fail" ]]; then
|
||||
cat >&2 <<EOF
|
||||
|
||||
ERROR: The JDK bundled with Elasticsearch requires glibc >= 2.14, but
|
||||
you have version $GLIBC_VERSION. Please set the JAVA_HOME environment variable
|
||||
to point to a working JDK installation. For more information, see:
|
||||
|
||||
https://www.elastic.co/support/matrix#matrix_jvm
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# now set the path to java
|
||||
if [ ! -z "$JAVA_HOME" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
@ -44,6 +81,7 @@ else
|
||||
# macOS has a different structure
|
||||
JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
|
||||
else
|
||||
check_glibc_version
|
||||
JAVA="$ES_HOME/jdk/bin/java"
|
||||
fi
|
||||
JAVA_TYPE="bundled jdk"
|
||||
|
Loading…
x
Reference in New Issue
Block a user