Methods of payment Abuse

Installing Elasticsearch in Ubuntu 22.04

16.04.2023, 03:11

Elasticsearch is an open source search engine and analytics engine that allows you to store, search, and analyze data in real-time. Elasticsearch uses a distributed architecture and is built on Apache Lucene, and is characterized by high performance, scalability and usability. Elasticsearch is widely used in search, analytics, and log analysis.

What can Elasticsearch do?

It has the following capabilities:

  1. Data storage and search: Elasticsearch allows you to store and index a variety of data types, including text, numbers, geospatial data, and customizable data types.
  2. Full-text search: Elasticsearch provides full-text search with support for complex queries such as search phrases, Wildcard queries, Fuzzy search and more.
  3. Distributed Architecture: Elasticsearch utilizes a distributed architecture, which allows you to scale and handle large amounts of data.
  4. APIS: Elasticsearch offers various APIs for data management and indexing, including REST APIs and Java APIs.
  5. Data Aggregations: Elasticsearch supports aggregations that allow you to analyze data and extract summary information such as average, sum, minimum and maximum.
  6. Search Scripting Solution: Elasticsearch is used for search scripting in a large number of applications and systems, including search portals, monitoring systems, version control systems, and others.
  7. Scalability functionality: Elasticsearch offers scalability and multitasking functionality to ensure high availability and performance in large systems.

Installation Process

The installation instructions for Elasticsearch will be roughly the same for different versions of Ubuntu. First, you will need to update the package list:

sudo apt update

Install the OpenJDK 11 package, which is required for Elasticsearch to work:

sudo apt install openjdk-11-jdk

Add the Elasticsearch key and repository to APT:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

Note: A different version of Elasticsearch may be specified in the URL instead of "7.x".

Update the package list and install Elasticsearch:

sudo apt update
sudo apt install elasticsearch

Configure Elasticsearch by editing the configuration file /etc/elasticsearch/elasticsearch/elasticsearch.yml:

sudo nano /etc/elasticsearch/elasticsearch.yml

Let's look at some of the most important settings:

  • cluster.name: the name of the Elasticsearch cluster
  • node.name: the name of the Elasticsearch node
  • network.host: IP address or hostname of the host on which Elasticsearch will be running
  • http.port: Elasticsearch HTTP API port (default is 9200)
  • memory.locked: true to allow Elasticsearch to lock memory in the page area, which reduces the likelihood of context switching and improves performance.

Start Elasticsearch and configure autorun:

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

Verify that Elasticsearch is running by sending a request to its API:

curl http://localhost:9200/

You should see a response with status and version information about Elasticsearch, such as:

{
  "name" : "my-elasticsearch-node",
  "cluster_name" : "my-elasticsearch-cluster",
  "cluster_uuid" : "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
  "version" : {
    "number" : "7.15.1",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "83c34f456ae29d60e94d886e455e6a3409bba9ed",
    "build_date" : "2021-10-07T21:56:19.031608185Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Installing Elasticsearch on Ubuntu should complete successfully.