From dee2fb5c433b785583f412788dc438f2f9399033 Mon Sep 17 00:00:00 2001 From: sreekarjami Date: Wed, 28 Apr 2021 22:21:43 +0000 Subject: [PATCH 1/4] tar install script Signed-off-by: sreekarjami --- opensearch/linux/opensearch-tar-install.sh | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 opensearch/linux/opensearch-tar-install.sh diff --git a/opensearch/linux/opensearch-tar-install.sh b/opensearch/linux/opensearch-tar-install.sh new file mode 100755 index 0000000000..1b4e108371 --- /dev/null +++ b/opensearch/linux/opensearch-tar-install.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +OPENSEARCH_HOME=`dirname $(realpath $0)`; cd $OPENSEARCH_HOME +KNN_LIB_DIR=$OPENSEARCH_HOME/plugins/opensearch-knn/knnlib +##Security Plugin +bash $OPENSEARCH_HOME/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s + +##Perf Plugin +chmod 755 $OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_bin/performance-analyzer-agent +chmod -R 755 /dev/shm +chmod 755 $OPENSEARCH_HOME/bin/performance-analyzer-agent-cli +echo "done security" +PA_AGENT_JAVA_OPTS="-Dlog4j.configurationFile=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_config/log4j2.xml \ + -Xms64M -Xmx64M -XX:+UseSerialGC -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:InitialCodeCacheSize=4096 \ + -XX:InitialBootClassLoaderMetaspaceSize=30720 -XX:MaxRAM=400m" + +OPENSEARCH_MAIN_CLASS="com.amazon.opendistro.opensearch.performanceanalyzer.PerformanceAnalyzerApp" \ +OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=plugins/opensearch-performance-analyzer \ +OPENSEARCH_JAVA_OPTS=$PA_AGENT_JAVA_OPTS + +if ! grep -q '## OpenSearcho Performance Analyzer' $OPENSEARCH_HOME/config/jvm.options; then + CLK_TCK=`/usr/bin/getconf CLK_TCK` + echo >> $OPENSEARCH_HOME/config/jvm.options + echo '## OpenDistro Performance Analyzer' >> $OPENSEARCH_HOME/config/jvm.options + echo "-Dclk.tck=$CLK_TCK" >> $OPENSEARCH_HOME/config/jvm.options + echo "-Djdk.attach.allowAttachSelf=true" >> $OPENSEARCH_HOME/config/jvm.options + echo "-Djava.security.policy=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_config/es_security.policy" >> $OPENSEARCH_HOME/config/jvm.options +fi +echo "done plugins" + +##Check KNN lib existence in OpenSearch TAR distribution +echo "Checking kNN library" +FILE=`ls $KNN_LIB_DIR/libKNNIndex*.so` +if test -f "$FILE"; then + echo "FILE EXISTS $FILE" +else + echo "TEST FAILED OR FILE NOT EXIST $FILE" +fi + +##Set KNN Dylib Path for macOS and *nix systems +if echo "$OSTYPE" | grep -qi "darwin"; then + if echo "$JAVA_LIBRARY_PATH" | grep -q "$KNN_LIB_DIR"; then + echo "KNN lib path has been set" + else + export JAVA_LIBRARY_PATH=$JAVA_LIBRARY_PATH:$KNN_LIB_DIR + echo "KNN lib path not found, set new path" + echo $JAVA_LIBRARY_PATH + fi +else + if echo "$LD_LIBRARY_PATH" | grep -q "$KNN_LIB_DIR"; then + echo "KNN lib path has been set" + else + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$KNN_LIB_DIR + echo "KNN lib path not found, set new path" + echo $LD_LIBRARY_PATH + fi +fi + +##Start OpenSearch +bash $OPENSEARCH_HOME/bin/opensearch "$@" From f7cc5b1941714769e306e03e495651e8f65c52cc Mon Sep 17 00:00:00 2001 From: sreekarjami Date: Wed, 28 Apr 2021 22:25:09 +0000 Subject: [PATCH 2/4] tar install script Signed-off-by: sreekarjami --- opensearch/linux/opensearch-tar-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensearch/linux/opensearch-tar-install.sh b/opensearch/linux/opensearch-tar-install.sh index 1b4e108371..ec4c34fff2 100755 --- a/opensearch/linux/opensearch-tar-install.sh +++ b/opensearch/linux/opensearch-tar-install.sh @@ -31,7 +31,7 @@ OPENSEARCH_MAIN_CLASS="com.amazon.opendistro.opensearch.performanceanalyzer.Perf OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=plugins/opensearch-performance-analyzer \ OPENSEARCH_JAVA_OPTS=$PA_AGENT_JAVA_OPTS -if ! grep -q '## OpenSearcho Performance Analyzer' $OPENSEARCH_HOME/config/jvm.options; then +if ! grep -q '## OpenSearch Performance Analyzer' $OPENSEARCH_HOME/config/jvm.options; then CLK_TCK=`/usr/bin/getconf CLK_TCK` echo >> $OPENSEARCH_HOME/config/jvm.options echo '## OpenDistro Performance Analyzer' >> $OPENSEARCH_HOME/config/jvm.options From 8763d963454a93ce5648c8e8d84b5ae5fa99ee11 Mon Sep 17 00:00:00 2001 From: sreekarjami Date: Wed, 28 Apr 2021 22:26:05 +0000 Subject: [PATCH 3/4] tar install script Signed-off-by: sreekarjami --- opensearch/linux/opensearch-tar-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensearch/linux/opensearch-tar-install.sh b/opensearch/linux/opensearch-tar-install.sh index ec4c34fff2..df69d0124f 100755 --- a/opensearch/linux/opensearch-tar-install.sh +++ b/opensearch/linux/opensearch-tar-install.sh @@ -34,7 +34,7 @@ OPENSEARCH_JAVA_OPTS=$PA_AGENT_JAVA_OPTS if ! grep -q '## OpenSearch Performance Analyzer' $OPENSEARCH_HOME/config/jvm.options; then CLK_TCK=`/usr/bin/getconf CLK_TCK` echo >> $OPENSEARCH_HOME/config/jvm.options - echo '## OpenDistro Performance Analyzer' >> $OPENSEARCH_HOME/config/jvm.options + echo '## OpenSearch Performance Analyzer' >> $OPENSEARCH_HOME/config/jvm.options echo "-Dclk.tck=$CLK_TCK" >> $OPENSEARCH_HOME/config/jvm.options echo "-Djdk.attach.allowAttachSelf=true" >> $OPENSEARCH_HOME/config/jvm.options echo "-Djava.security.policy=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_config/es_security.policy" >> $OPENSEARCH_HOME/config/jvm.options From e697ec8b7c72bb3e61c5ff615afb722a07a76c27 Mon Sep 17 00:00:00 2001 From: sreekarjami Date: Thu, 29 Apr 2021 22:24:03 +0000 Subject: [PATCH 4/4] Change setting for PA Signed-off-by: sreekarjami --- opensearch/linux/opensearch-tar-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensearch/linux/opensearch-tar-install.sh b/opensearch/linux/opensearch-tar-install.sh index df69d0124f..d51781facf 100755 --- a/opensearch/linux/opensearch-tar-install.sh +++ b/opensearch/linux/opensearch-tar-install.sh @@ -37,7 +37,7 @@ if ! grep -q '## OpenSearch Performance Analyzer' $OPENSEARCH_HOME/config/jvm.op echo '## OpenSearch Performance Analyzer' >> $OPENSEARCH_HOME/config/jvm.options echo "-Dclk.tck=$CLK_TCK" >> $OPENSEARCH_HOME/config/jvm.options echo "-Djdk.attach.allowAttachSelf=true" >> $OPENSEARCH_HOME/config/jvm.options - echo "-Djava.security.policy=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_config/es_security.policy" >> $OPENSEARCH_HOME/config/jvm.options + echo "-Djava.security.policy=$OPENSEARCH_HOME/plugins/opensearch-performance-analyzer/pa_config/opensearch_security.policy" >> $OPENSEARCH_HOME/config/jvm.options fi echo "done plugins"