“This is the fourth day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

Introduction to the

Elasticsearch is a software that you need to install and configure.

Description of ELK technology stack

Elastic has a full product line of Elasticsearch, Logstash, Kibana, etc. The first three are the ELK stack.

Logstash is a data collector that collects and analyzes data from various formats and channels, formats and outputs it to Elasticsearch, and finally collects, analyzes, and searches data through Kibana’s user-friendly Web interface.

ELK is actually a pipeline structure, data from Logstash to Elasticsearch to Kibana for visualization. Each of these three components can also be used separately, such as Logstash to export data not only to Elasticsearch, but also to databases, caches, etc

Elastic

The Elastic website: www.elastic.co/cn/

Elastic has a complete product line of Elasticsearch, Logstash, Kibana, and more. These are the ELK stacks.

Elasticsearch

Elasticsearch website: www.elastic.co/cn/products…

Function:

Distributed search engines: Baidu, Google, site search

Full text search: provide fuzzy search and other highly automatic query methods, and relevance ranking, highlighting and other functions

Data analysis engine (grouped aggregation) : e-commerce site — Top10 mobile phone sales in a week

Near real-time processing of large amounts of data: Horizontal scaling to handle large numbers of events per second, while automatically managing how indexes and queries are distributed across the cluster for extremely smooth operation.

As mentioned above, Elasticsearch has the following features:

Fast, scalable, most relevant search results

  • Distributed: Each node can be used as an entry point for automatic node load balancing
  • JSON: The input and output format is JSON
  • Restful style, all apis follow Rest principles, easy to use
  • Near real time search, data updates are almost completely synchronous in Elasticsearch, data retrieval is near real time
  • Easy installation: no other dependencies, easy to install after downloading, simple modification of a few parameters can build a cluster
  • Support for very large data: Structured and unstructured data that can scale up to petabytes

version

The latest version of Elasticsearch is 7.x, the most common version of Elasticsearch in the enterprise is 6.x, we will explain it in 6.2.4, we need JDK1.8 or above.

Installation and configuration

To quickly see the effect I installed Elasticsearch directly on the local macOS. Environment requirements: JDK8 or later

Step 1: put the software prepared in today’s material folder into a position without Chinese without space, decompress it

Step 2: Modify the configuration file

1. Change the path for storing index data and log data

Lines 33 and 37, make sure you open the comment after you make the changes

path.data: /Users/xxx/Documents/class/es/data
#
# Path to log files:
#
path.logs: /Users/xxx/Documents/class/es/log
Copy the code

Step 3: Go to the bin directory and double-click the command file in the figure

If the startup fails, you need to change the size of the VM memory. Find the JVMS. Options file to change the size

  • Xms refers to setting the amount of memory used when the program is started. Generally speaking, the program will start faster, but it can also cause the machine to temporarily slow down.
  • Xmx refers to setting the maximum memory size that can be occupied during the running of the program. An OutOfMemory exception is thrown if the program takes more memory to run than this setting.

access

The startup background output is as follows

9300: communication interface between cluster nodes, receiving TCP protocol 9200: client access interface, receiving Http protocol We can access http://127.0.0.1:9200 in the browser

Install kibana

What Kibana is

Elasticsearch Kibana is a node.js based Elasticsearch index library data collection tool. You can use the Elasticsearch aggregation function to generate various charts, such as bar charts, line charts, pie charts, etc.

It also provides a console for manipulating Elasticsearch index data, and provides some API tips to help you learn the syntax of Elasticsearch.

The installation

Since Kibana relies on Node, node.js needs to be installed first

The Node version is displayed

node -v
Copy the code

Then install Kibana, in line with ElasticSearch, also 6.2.4

Configured to run

configuration

Go to the confifig directory in the installation directory and modify line 21 of the kibana.yml file:

run

Go to the bin directory in the installation directory:

The listening port for Kibana was found to be 5601

We visit: http://127.0.0.1:5601

The console

Select the DevTools menu on the left to enter the console page

On the right side of the page, you can enter a request to access Elasticsearch

Install ik word dividers

Lucene’s IK tokenizer was not maintained in 2012, so now we are going to use a version of the IK tokenizer to maintain and upgrade it, and develop an integrated plugin for Elasticsearch. The version remains the same github.com/medcl/elast…

The installation

  1. Unzip elasticSearch-analysis-IK-6.2.4. zip, copy the folder to elasticSearch-6.2.4. \plugins, and rename the folder ik

  1. Restart ElasticSearch to load the IK splitter

Install the Head plugin

Elasticsearch – head profile

Elasticsearch-head is an interface for performing foolproof operations on a cluster. You can integrate it into ES via plug-ins (preferred) or install it as a standalone WebApp.

Es-head has three main operations:

  1. Displays the topology of the cluster and is able to perform index and node-level operations
  2. The search interface enables you to query the retrieved data in the cluster in raw JSON or table format
  3. Quickly access and display the status of the cluster

Official documentation: github.com/mobz/elasti…

Elasticsearch – Head install (based on Google Chrome)

  1. Direct download zip, address: fifiles.cnblogs.com/fifiles/san…
  2. Unpack the
  3. Click “Load unzipped Zip” in Google Chrome, go to the ElasticSearch-head folder, and open it to install.