Elastic Command
Elastic Command
sudo su - elasticadmin
chmod 777 /tmp/jdk-8u161-linux-x64.tar.gz
chmod 777 /tmp/elasticsearch_7.8.0.tar
chmod 777 /tmp/repository-azure-7.8.0.zip
chmod 777 /tmp/support-diagnostics-8.1.1.tar.gz
#
----------------------------------------------------------------------------------
# Update .bash_profile and .bashrc
sudo su - elastic
# custom prompt
export PS1='\u@\h:\w \$ '
#
----------------------------------------------------------------------------------
#
----------------------------------------------------------------------------------
# I. JAVA Install (JDK 1.8.0_161)
sudo su - elastic
mkdir -p /opt/app/java
gunzip /tmp/jdk-8u161-linux-x64.tar.gz
tar -C /opt/app/java -xf /tmp/jdk-8u161-linux-x64.tar
export JAVA_HOME=/opt/app/java/jdk1.8.0_161
export PATH=${PATH}:${JAVA_HOME}/bin
exit
sudo su - elastic
env|grep JAVA_HOME
env|grep PATH
which java
vi $HOME/.bash_profile
export JAVA_HOME=/opt/app/java/jdk1.8.0_161
export PATH=$PATH:$JAVA_HOME/bin
exit
#
----------------------------------------------------------------------------------
#
----------------------------------------------------------------------------------
# II. Elasticsearch Install (v7.8.0)
sudo su - elastic
mkdir -p /opt/app/elastic/7.8.0
tar -C /opt/app/elastic/7.8.0 -xf /tmp/elasticsearch_7.8.0.tar
mv -f /opt/app/elastic/7.8.0/elasticsearch_7.8.0/* /opt/app/elastic/7.8.0
rm -rf /opt/app/elastic/7.8.0/elasticsearch_7.8.0
vi $HOME/.bash_profile
export ES_HOME=/opt/app/elastic/7.8.0
export ES_PATH_CONF=${ES_HOME}/config
export ES_CLASSPATH=${ES_HOME}/lib
exit
sudo su - elastic
env|grep ES_HOME
env|grep ES_PATH_CONF
env|grep ES_CLASSPATH
mkdir -p /opt/app/elastic/7.8.0/certs
cp /opt/app/elastic/7.8.0/att_config_files/elasticsearch.yml
/opt/app/elastic/7.8.0/config
cp /opt/app/elastic/7.8.0/att_config_files/non_prod_license_exp_20200829.json
/opt/app/elastic/7.8.0/config
mv /opt/app/elastic/7.8.0/config/role_mapping.yml
/opt/app/elastic/7.8.0/config/role_mapping.yml_`date +'%Y%m%d'`
cp /opt/app/elastic/7.8.0/att_config_files/role_mapping.yml
/opt/app/elastic/7.8.0/config
cp /opt/app/elastic/7.8.0/att_config_files/jvm.options
/opt/app/elastic/7.8.0/config
#
----------------------------------------------------------------------------------
#
***********************************************************************************
***************************************************************
### *** kj8351 07/14/2020 ***
### Retrieve credentials from Keyvault - elastcpockeyvault
### Not using AZ commands
access_token=$(curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-
version=2018-02-01&resource=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fvault.azure.net' -H Metadata:true | jq --
raw-output -r '.access_token')
#
----------------------------------------------------------------------------------
# Elasticsearch Install (v7.8.0) - AZURE REPOSITORY PLUGIN
cd /home/elastic
echo y | $ES_HOME/bin/elasticsearch-plugin install file:///tmp/repository-azure-
7.8.0.zip
/opt/app/elastic/7.8.0/bin/elasticsearch-plugin list -v
#
----------------------------------------------------------------------------------
### Config Changes
sed -i 's/\CHANGE_JVM_MIN_HEAP_SIZE/Xms8g/g'
/opt/app/elastic/7.8.0/config/jvm.options
sed -i 's/\CHANGE_JVM_MAX_HEAP_SIZE/Xmx8g/g'
/opt/app/elastic/7.8.0/config/jvm.options
sed -i 's/\CHANGE_ELASTIC_CLUSTER_NAME/elastic-att-poc/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
machine_hostname=`echo $HOSTNAME`
sed -i "s/CHANGE_ELASTIC_HOSTNAME/$machine_hostname/g"
/opt/app/elastic/7.8.0/config/elasticsearch.yml
#
----------------------------------------------------------------------------------
# III. Elasticsearch Install (v7.8.0) - DATA & MASTER & INGEST NODE
sed -i 's/CHANGE_ELASTIC_IS_NODE_MASTER/true/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
sed -i 's/CHANGE_ELASTIC_IS_NODE_DATA/true/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
sed -i 's/CHANGE_ELASTIC_IS_NODE_INGEST/true/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
#
----------------------------------------------------------------------------------
# IV. Elasticsearch Install (v7.8.0) - COORDINATING NODE
sed -i 's/CHANGE_ELASTIC_IS_NODE_MASTER/false/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
sed -i 's/CHANGE_ELASTIC_IS_NODE_DATA/false/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
sed -i 's/CHANGE_ELASTIC_IS_NODE_INGEST/false/g'
/opt/app/elastic/7.8.0/config/elasticsearch.yml
#
----------------------------------------------------------------------------------
# Install Support Diagnostic Utility
sudo su - elastic
mkdir -p /opt/app/elastic/7.8.0/diagnostic
gunzip /tmp/support-diagnostics-8.1.1.tar.gz
tar -C /opt/app/elastic/7.8.0/diagnostic -xf /tmp/support-diagnostics-8.1.1.tar
test -f /opt/app/elastic/7.8.0/diagnostic/support-diagnostics-8.1.1/scripts/
diagnostics.sh && echo "Diagnostic installed successfully"
#
----------------------------------------------------------------------------------
# Install Elasticsearch service
exit
whoami | grep elasticadmin && echo "Logged in as elasticadmin"
sudo su - root
cp /opt/app/elastic/7.8.0/att_config_files/elasticsearch.service
/etc/systemd/system/elasticsearch.service
test -f /etc/systemd/system/elasticsearch.service && echo "Elasticsearch service
created"
/bin/systemctl daemon-reload
/bin/systemctl status elasticsearch -l
/bin/systemctl enable elasticsearch
/bin/systemctl status elasticsearch -l
exit
#
----------------------------------------------------------------------------------
#
-----------------------------------------------------------------------------------
------------------------------------------
### POST INSTALL CONFIGURATION TASKS
### Note - Once all 3 data nodes and 1 coordinating node are installed and all 4
servers have the Elasticsearch service running
#
-----------------------------------------------------------------------------------
------------------------------------------
# Setup passwords for system users - elastic, apm_system, kibana_system,
logstash_system, beats_system, remote_monitoring_user
# Right now, for this cluster I have used the "interactive" method and entered the
passwords through the command line
# However, we will automate this through keyvault secrets and run the command
/opt/app/elasticsearch/7.8.0/bin/elasticsearch-setup-passwords in batch mode
/opt/app/elasticsearch/7.8.0/bin/elasticsearch-setup-passwords interactive -u
"https://elastic-eastus2-poc-node1-vm-01.az.3pc.att.com:9200"
elastic, apm_system, kibana_system, logstash_system, beats_system,
remote_monitoring_user: Same password - OurPraiseForAHigherPower786!@
#
-----------------------------------------------------------------------------------
---------------------------------------------------