From ddffcd8fac8af0ff78e63cca583af5c77a062891 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Mon, 8 Dec 2014 13:44:44 -0800 Subject: [PATCH] HADOOP-11329. Add JAVA_LIBRARY_PATH to KMS startup options. Contributed by Arun Suresh. --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../hadoop-kms/src/main/conf/kms-env.sh | 6 ++++++ hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh | 11 ++++++++++- .../hadoop-kms/src/site/apt/index.apt.vm | 9 +++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d4962766be..d9219cc9ed 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -519,6 +519,8 @@ Release 2.7.0 - UNRELEASED HADOOP-11354. ThrottledInputStream doesn't perform effective throttling. (Ted Yu via jing9) + HADOOP-11329. Add JAVA_LIBRARY_PATH to KMS startup options. (Arun Suresh via wang) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-kms/src/main/conf/kms-env.sh b/hadoop-common-project/hadoop-kms/src/main/conf/kms-env.sh index 88a2b8644e..44dfe6afcd 100644 --- a/hadoop-common-project/hadoop-kms/src/main/conf/kms-env.sh +++ b/hadoop-common-project/hadoop-kms/src/main/conf/kms-env.sh @@ -47,3 +47,9 @@ # The password of the SSL keystore if using SSL # # export KMS_SSL_KEYSTORE_PASS=password + +# The full path to any native libraries that need to be loaded +# (For eg. location of natively compiled tomcat Apache portable +# runtime (APR) libraries +# +# export JAVA_LIBRARY_PATH=${HOME}/lib/native diff --git a/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh b/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh index 24a1f54f96..f6ef6a5d0c 100644 --- a/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh +++ b/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh @@ -31,7 +31,15 @@ BASEDIR=`cd ${BASEDIR}/..;pwd` KMS_SILENT=${KMS_SILENT:-true} -source ${HADOOP_LIBEXEC_DIR:-${BASEDIR}/libexec}/kms-config.sh +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-${BASEDIR}/libexec}" +source ${HADOOP_LIBEXEC_DIR}/kms-config.sh + + +if [ "x$JAVA_LIBRARY_PATH" = "x" ]; then + JAVA_LIBRARY_PATH="${HADOOP_LIBEXEC_DIR}/../lib/native/" +else + JAVA_LIBRARY_PATH="${HADOOP_LIBEXEC_DIR}/../lib/native/:${JAVA_LIBRARY_PATH}" +fi # The Java System property 'kms.http.port' it is not used by Kms, # it is used in Tomcat's server.xml configuration file @@ -50,6 +58,7 @@ catalina_opts="${catalina_opts} -Dkms.admin.port=${KMS_ADMIN_PORT}"; catalina_opts="${catalina_opts} -Dkms.http.port=${KMS_HTTP_PORT}"; catalina_opts="${catalina_opts} -Dkms.max.threads=${KMS_MAX_THREADS}"; catalina_opts="${catalina_opts} -Dkms.ssl.keystore.file=${KMS_SSL_KEYSTORE_FILE}"; +catalina_opts="${catalina_opts} -Djava.library.path=${JAVA_LIBRARY_PATH}"; print "Adding to CATALINA_OPTS: ${catalina_opts}" print "Found KMS_SSL_KEYSTORE_PASS: `echo ${KMS_SSL_KEYSTORE_PASS} | sed 's/./*/g'`" diff --git a/hadoop-common-project/hadoop-kms/src/site/apt/index.apt.vm b/hadoop-common-project/hadoop-kms/src/site/apt/index.apt.vm index 11b84d39c7..80d9a4858a 100644 --- a/hadoop-common-project/hadoop-kms/src/site/apt/index.apt.vm +++ b/hadoop-common-project/hadoop-kms/src/site/apt/index.apt.vm @@ -159,6 +159,15 @@ hadoop-${project.version} $ sbin/kms.sh start NOTE: You need to restart the KMS for the configuration changes to take effect. +** Loading native libraries + + The following environment variable (which can be set in KMS's + <<>> script) can be used to specify the location + of any required native libraries. For eg. Tomact native Apache Portable + Runtime (APR) libraries: + + * JAVA_LIBRARY_PATH + ** KMS Security Configuration *** Enabling Kerberos HTTP SPNEGO Authentication