Installation of Elasticsearch on Ubuntu OS
This document describes how to install Elasticsearch 7.9.2 on Ubuntu operating system. It is recommended that Ubuntu 22.04 LTS Live Server to be used.
Before Starting the Installation
Important for Installation
In order for the installation to be healthy, Apinizer Kubernetes servers must access the following addresses.
To install Elasticsearch:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz
Important
While updating the packages, Ubuntu tries to pull from the server located in Turkey. However, from time to time, there may be a problem at tr.archive.ubuntu.com. In this case, you need to make the following change.
sudo vi /etc/apt/sources.list
#Replace all addresses starting with .tr with "Replace All".
#Example:
#1) Operating System Configurations (All Servers)
POWERSHELL
|
#2) Installation of Elasticsearch
#2.1) Operating System Configuration and Installation of Elasticsearch Application (On All Elasticsearch Servers)
BASH
|
#2.2) Elasticsearch Installation (On All Elasticsearch Servers)
BASH
|
#2.3) Setting Elasticsearch Parameters According to the Environment (On All Elasticsearch Servers)
The following parameters must be adjusted and added according to your environment.
- cluster.initial_master_nodes
- network.host
- node.name
BASH
Important Here, the path.data address should be given as the address of the disk in the system where your log file is added.
YML
|
You can set the JVM (Java Virtual Machine) values and other JVM parameters used by Elasticsearch as follows.
BASH
Important Here, it can be up to half of the amount of RAM the operating system has and this value should not exceed 32GB
YML
|
#2.4) Setting Elasticsearch as Linux Service (On All Elasticsearch Servers)
sudo vi /opt/elasticsearch/elasticsearch-7.9.2/bin/elasticsearch-service.sh
#!/bin/sh
SERVICE_NAME=elasticsearch
PATH_TO_APP="/opt/elasticsearch/elasticsearch-7.9.2/bin/$SERVICE_NAME"
PID_PATH_NAME="/opt/elasticsearch/elasticsearch-7.9.2/bin/$SERVICE_NAME.pid"
SCRIPTNAME=elasticsearch-service.sh
ES_USER=$SERVICE_NAME
ES_GROUP=$SERVICE_NAME
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
mkdir $(dirname $PID_PATH_NAME) > /dev/null 2>&1 || true
chown $ES_USER $(dirname $PID_PATH_NAME)
$SUDO $PATH_TO_APP -d -p $PID_PATH_NAME
echo "Return code: $?"
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is already running ..."
fi
;;
stop)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stopping ..."
kill -15 $PID;
echo "$SERVICE_NAME stopped ..."
rm $PID_PATH_NAME
else
echo "$SERVICE_NAME is not running ..."
fi
;;
restart)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stopping ...";
kill -15 $PID;
sleep 1;
echo "$SERVICE_NAME stopped ...";
rm -rf $PID_PATH_NAME
echo "$SERVICE_NAME starting ..."
mkdir $(dirname $PID_PATH_NAME) > /dev/null 2>&1 || true
chown $ES_USER $(dirname $PID_PATH_NAME)
$SUDO $PATH_TO_APP -d -p $PID_PATH_NAME
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is not running ..."
fi
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac
BASH
BASH
BASH
|
You can use the following link for a compatible Kibana version.
POWERSHELL
|