This is the 26th day of my participation in the August Text Challenge.More challenges in August

What is es

Es is a distributed search engine. It’s a tool. It’s a database. Can realize fast data analysis, fast data search, fast data storage. Anyway two word description, == fast ==

The bottom layer of ES relies on Lucene, known as ELK along with LogStash and Kibana, and is a logging technology. It’s also a way of presenting data.

Elasticsearch is a real-time, distributed storage, search, and analytics engine. It can be used for many purposes, but one context whereIt excels is indexing streams of semi-structured data, such as logs or decoded network packets. Es is a real-time, distributed search and analysis engine. It can be used in a variety of business scenarios, but is best at indexing streams of semi-structured data, such as log information and decoding network packet informationCopy the code

Support cluster construction

Elasticserach website

Get start

Reference documentation

Storage is not the biggest feature, fast lookup is (inverted index)

What are the features of ES

  • Distributed search engine
  • Fast and stable
  • Based on Lucene
  • RestFul interfaces
  • Open source software developed in Java
  • Construction of the cluster

The history of the es

Compass Shay Banon founded Compass in 2004 as the predecessor of ES, a high version of Compass that was distributed and scalable

It is now widely used by major enterprises, such as Wikipedia, Github, etc

Usage scenarios

  1. Full-text search
  2. Multiple data sources
  3. Read the database

Inverted index

The keyword is the key and the content is the value. Create indexes

May I have an Inverted Index? There are Inverted indexes and Inverted indexes. Generally speaking, a forward index uses a key to find a value, and a reverse index uses a value to find a key.

1 Reference 2

1. Install

1.1 Windows Installation

  1. JDK is required for preparation
  2. Download address
  3. You can use elasticSearch.bat if you unzip it

1.2 Installation using Docker

  1. Download mirrorDocker pull docker. Elastic. Co/elasticsearch/elasticsearch: 7.4.1
  2. Create a containerDocker run - p - 9200-9200 p, 9300:9300 - e discovery. Type = "single - node" docker. Elastic. Co/elasticsearch/elasticsearch: 7.4.1

1.3 Installation in Linux

  1. You cannot use the root user to run ES. Therefore, you need to create a user first
    1. adduser ymy
    2. passwd ymy
    3. Enter your password
    4. Su ymy (switch user)
  2. Download the zip package, download it from the official website
  3. unzip
  4. Run. / bin/elasticsearch

Check whether the command is successfully executed

  1. curl http://localhost:9200
  2. Postman access
  3. Browser access

Some common centos startup errors and solutions

  1. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

Each process maximum at the same time open the file number is too small, can through the following two commands to view the current number of modify/etc/security/limits file, increase the configuration, the user exit to > > login effect soft nofiles 65536 hard nofiles 65536

  1. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Conf sysctl -p Run the sysctl -p command to take effect

  1. The following error message is displayed during startup: Solution:

Vim/etc/elasticsearch/elasticsearch. Yml modify [# cluster. Initial_master_nodes: [“node-1”, “node-2”] cluster.initial_master_nodes: [“node-1”]

  1. 3.5 Access after Normal Operation

Curl “http://127.0.0.1:9200” can be accessed without using an external IP address

Vim config/elasticsearch.yml add: network.host: 0.0.0.0

The installation

It can be installed on a variety of platforms, and it can also run on MAC and Windows, with different installers

Note that:

  1. A JDK environment is required, and the environment must meet the minimum release environment required by ES
  2. An MVN environment is required

Official installation method

deb:

The curl - L - O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-amd64.deb sudo DPKG -i Elasticsearch - 7.10.1 - amd64. Deb sudo/etc/init. D/elasticsearch startCopy the code

rpm:

The curl - L - O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-x86_64.rpm sudo RPM -i Elasticsearch -7.10.1-x86_64. RPM sudo service elasticSearch startCopy the code

mac:

The curl - L - O tar XZVF - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-darwin-x86_64.tar.gz Elasticsearch - 7.10.1 - Darwin - x86_64. Tar. Gz CD elasticsearch - 7.10.1. / bin/elasticsearchCopy the code

brew:

brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
elasticsearch
Copy the code

linux:

The curl - L - O tar XZVF - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-linux-x86_64.tar.gz Elasticsearch - 7.10.1 - Linux - x86_64. Tar. Gz CD elasticsearch - 7.10.1. / bin/elasticsearchCopy the code

win:

Download the Elasticsearch 7.10.1 Windows zip file from the Elasticsearch Download Page. Extract the contents of the zip  file to a directory on your computer, for example, C:\Program Files. Open a command prompt as an Administrator and navigate to the directory that contains the extracted File, for example: CD C:\Program Files\ ElasticSearch -7.10.1 Start ElasticSearch: bin\ elasticSearch.batCopy the code

Verify that the installation is successful

The curl http://127.0.0.1:9200Copy the code

Or you can view it using your local browser

http://localhost:9200/ { "name" : "DESKTOP-UJF63TK", "cluster_name" : "elasticsearch", "cluster_uuid" : "L6jwth8nrjoi-p7y8ssjpw ", "version" : {"number" : "7.6.1", "build_flavor" : "default", "build_type" : "zip", "build_hash" : "aa751e09be0a5072e8570670309b1f12348f023b", "build_date" : "2020-02-29T00:15:25.529771z ", "build_snapshot" : false, "lucene_version" : "Minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1"}, "tagline" : "You Know, for Search"}Copy the code

run

/bin/elasticSearch -d -d indicates that elasticSearch is run as a daemonCopy the code

Docker installation es

Official website Installation

Download mirror: docker pull docker. Elastic. Co/elasticsearch/elasticsearch: 7.4.2

Docker run -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” docker run -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” Docker. Elastic. Co/elasticsearch/elasticsearch: 7.4.2

If an error is encountered

docker: Error response from daemon: driver failed programming external connectivity on endpoint elated_yalow (97ad2075a86d22cd3d1d9a09e3722473fc82cdd1079079181599d019b7a3a613):  (dbus: connection closed by user).
Copy the code

Solution :systemctl restart docker

Background daemon running:

docker run -itd -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” Docker. Elastic. Co/elasticsearch/elasticsearch: 7.4.2

Docker installation elasticsearch – head

docker pull mobz/elasticsearch-head:5

docker run -itd -p 9100:9100 docker.io/mobz/elasticsearch-head:5