Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

[learn ES series]-1. Understanding of ElasticSearch and environmental preparation and service building

Shulou Source: shulou.com Published: 2022-06-03 05:54:29 10月04日 Update

I. get to know ElasticSearch

Elasticsearch is a real-time distributed search and analysis engine that allows you to explore your data at a speed and scale that you have never had before. It is used as full-text search, structured search, analysis and a combination of these three functions.

Excerpt from Elasticsearch: an authoritative Guide

Elasticsearch is written in Java, which internally uses Lucene for indexing and search, but its purpose is to make full-text retrieval simple, by hiding the complexity of Lucene and instead providing a set of simple and consistent RESTful API.

However, Elasticsearch is not only a Lucene, but also more than just a full-text search engine. It can be accurately described as follows:

A distributed real-time document storage, each field can be indexed and searched. A distributed real-time analysis search engine can expand hundreds of service nodes and support PB-level structured or unstructured data.

Elasticsearch packages all the functions into a separate service so that you can communicate with the simple RESTful API it provides through the program, act as a web client in your favorite programming language, or even use the command line (to act as the client).

Second, environmental dependence

Because Elasticsearch is written in Java, the server needs to have a Java running environment.

Third, service (cluster) construction

Preparatory work:

Download the latest version of the program on the official website: decompress https://www.elastic.co/products/elasticsearch to the specified directory on the server

Focus on two files:

. / bin/elasticsearch service launcher. / config/elasticsearch.yml service configuration file 1. Run a single node instance

A single-node instance does not need to modify the configuration file and can be started directly.

. / bin/elasticsearch # start the service

(. / bin/elasticsearch-d # background running service)

Visit http://localhost:9200/?pretty in the browser and see this interface indicating that the ES service started successfully

two。 Set up a cluster

As shown in the figure, an ElasticSearch cluster consists of a master node and multiple slave nodes.

ElasticSearch cluster building is very simple, each node is running, and each has its own configuration information. Therefore, each node needs to copy a program code, modify their own configuration file information and run.

The specific configuration is as follows:

Master node configuration information:

/ / Cross-domain setting http.cors.enabled: truehttp.cors.allow-origin: "*" / / Cluster configuration cluster.name: Jack-ElasticSearchnode.name: masternode.master: truenetwork.host: 127.0.0.1 Slave node configuration information cluster.name: Jack-ElasticSearchnode.name: slave2network.host: 127.0.0.1http.port: 9202discovery.zen.ping.unicast.hosts: ["127.0.0.1"] 3. Run each node

Reference to run a single node instance

Tags: Node service configuration run search cluster information file program full-text distributed instance real-time engine structure analysis structure environment not only full-text search Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn MySQL Linux OPPO Reno