ubuntu install elasticsearch

precondition##

This environment is operated on Ubuntu 18.04 by default.

We first need to configure the java environment, which requires Java8 or newer packages. Generally, you can check whether the Java version is compatible when you execute the following command:

sudo apt install default-jdk

Elasticsearch PGP Public Key##

We need to download and install the public key before installation, otherwise there is no way to install Elasticsearch using apt.

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Install Elasticsearch

First add the source:

sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main"| sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

Next, we can update the source to cut Es after all:

sudo apt-get update && sudo apt-get install elasticsearch

This is installed.

Elasticsearch command management##

We can use the systemd method for Elasticsearch management

systemd

Set boot up:

sudo systemctl daemon-reload
sudo systemctl enable elasticsearch

start up:

sudo systemctl start elasticsearch

shut down:

sudo systemctl stop elasticsearch

Check whether the installation is successful:

First we need to execute the command to start it (if it has already been started, then there is no need to execute the following start command):

sudo systemctl start elasticsearch

Then execute the following command:

curl -XGET '127.0.0.1:9200/?pretty'

If the returned data is as follows, the installation is successful:

{" name":"NLJug1O","cluster_name":"elasticsearch","cluster_uuid":"hVZpdHvgT9CeE1ywsNt16w","version":{"number":"6.2.4","build_hash":"ccec39f","build_date":"2018-04-12T20:37:28.497551Z","build_snapshot":false,"lucene_version":"7.2.1","minimum_wire_compatibility_version":"5.6.0","minimum_index_compatibility_version":"5.0.0"},"tagline":"You Know, for Search"}

Note: Elasticsearch needs to be started for a while. If you execute the above command immediately after startup, you may be prompted to refuse the connection, just try a few more times.

Configure Elasticsearch

Elasticsearch loads its configuration from the /etc/elasticsearch/elasticsearch.yml file by default.

RPM also has another system configuration file (/etc/sysconfig/elasticsearch), which allows you to set the following parameters:

Parameters Explanation
JAVA_HOME Set the custom Java path to be used
MAX_OPEN_FILES Maximum number of open files, default 65536
MAX_LOCKED_MEMORY Maximum lock memory size. If you use bootstrap.memory_lock option in elasticsearch.yml, please set unlimited
MAX_MAP_COUNT The maximum value of the memory map area that a process may have. If you use mmapfs as the index storage type, make sure to set it to a higher value. Please check the linux kernel documentation for more information about max_map_count. This is set through sysctl before elasticsearch is started. The default is 262144
ES_PATH_CONF Configuration file directory (need to include elasticsearch.yml and log4j2.properties files), the default path is: /etc/elasticsearch
ES_JAVA_OPTS Any additional JVM system properties you may want to apply.
RESTART_ON_UPGRADE The configuration package will be restarted when it is upgraded. The default is false. This means you manually restart the elasticsearch instance after installing the package. The reason for this is to ensure that, when updating in the cluster, the redistribution of shards is caused in the case of high-traffic networks and reducing the response time of your cluster.

Package directory layout##

Type Description Default Path Settings
home Elasticsearch home directory or $ES_HOME /usr/share/elasticsearch
bin binary script, including elasticsearch to start a node and elasticsearch-plugin to install plugins /usr/share/elasticsearch/bin
conf Configuration file, including elasticsearch.yml /etc/elasticsearch ES_PATH_CONF
conf Environmental variables, including heap size, file descriptors. /etc/default/elasticsearch
data The location of the data file for each index/shard allocated on the node. Can accommodate multiple locations. /var/lib/elasticsearch path.data
logs Log file location. /var/log/elasticsearch path.logs
plugins Plugin file location. Each plugin will be contained in a subdirectory. /usr/share/elasticsearch/plugins
repo Shared file system repository location. Can accommodate multiple locations. The file system repository can be placed in any subdirectory of the specified directory. Not configured path.repo

Recommended Posts

ubuntu install elasticsearch
How to install Elasticsearch on Ubuntu 20.04
ubuntu18.04 install docker
ubuntu12.04 install python3
Ubuntu install guide
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
ubuntu install Jenkins
docker install ubuntu
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
ubuntu 18.04 install teamviewer
ubuntu install sendmail
Ubuntu install Elasticsearch and elasticsearch-analysis-ik word segmentation
Install apache+PHP under Ubuntu
install vscode on ubuntu18
Install node.js under Ubuntu
ubuntu install zsh terminal
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Centos install elasticsearch tutorial
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Install nodejs10 on Ubuntu16
ubuntu install harbor warehouse
Install mysql on Ubuntu 14.04
Install Pytorch+CUDA on Ubuntu 16.04
Install Python3 on Ubuntu 14.04
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
ubuntu16.04 install node.js, npm
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
pcduino ubuntu install os
Install python in Ubuntu
Install JDK in Ubuntu19.10
Install Python3 on Ubuntu 16.04
Install ROS under ROS Ubuntu 18.04[2]
Install MySQL under Ubuntu
Install KDE on Ubuntu16.04.2
ubuntu install nginx server
Install Yarm-PM2 under Ubuntu
Install Docker on Ubuntu18
Install Python3.7 on Ubuntu
Install flashplayer on Ubuntu
Install Elasticsearch 6 on centos7
ubuntu: install camera driver
ubuntu14.04 install jdk1.8 tutorial
Docker practice (1): install Docker on Ubuntu 16.04
Install VMware Tools in Ubuntu 18.04
ubuntu16.04 install caffe cpu version
Install ubuntu on virtual machine
Windows 10 install Linux subsystem Ubuntu
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install QQ robot on Ubuntu 16.04
Ubuntu install the latest Python 3.