Elasticsearch Introduction
Elasticsearch is a full-text search server that can also be used as a NoSQL database to store documents and data in any format, while at the same time doing big data analysis. Elasticsearch has the following characteristics:
1. Full-text search engine, ES is a resume on the lucebe of the Kaiyuan Soso engine, can be used for full-text search, geographical information search
2. Document storage and querying, you can store any format of the document to NoSQL, and can query the document according to the criteria
3. Big Data analytics, ES claims to be able to perform big data analysis in real-time, from terabytes to petabytes of data
4. ES provides a REST API to simplify the operation of ES, so you can use the cry justifying in any language, and also provide Java api,spring boot to encapsulate the rest API, simplifying development
5. Es is often used in conjunction with traditional databases, and ES is responsible for querying, searching, and statistical analysis of big data.
The basic concepts in Elasticsearch
Mastering the basic concepts in ES is the first step in understanding ES
1. Index:index is a collection of documents (document), which contains the type below, for further categorization of documents, which can be understood as Index in ES equivalent to a database, type equivalent to a table in a database, ES makes it easy to combine index and type to search for data, but the database does not.
2. Type: Used to further organize the document, an index can have more than one type, such as user information is a type, the user's payment record is a type
3. Document: Documents are basic information that ES can store and search, similar to database table row data, document is in JSON format, documents belong to type
4. Node: Nodes are an ES Server in a cluster for storing and querying documents. An app can have only one node, or it can be a cluster of multiple nodes to store and search for data. Each node has a node name, and the name of the owning cluster.
5. Cluster: Nodes of the same cluster name will be combined into ES clusters, which can be used to jointly complete the storage and search of the data. The default cluster name is Elasticsearch.
6. Shards (partition) and replicas (replication): Each index theoretically can contain a large amount of data, more than the storage limit of a single node, and a single node processing such large data, will significantly limit the storage and search performance, in order to solve this problem, ES will further subdivide the index physically into multiple partitions, and these partitions are assigned to multiple nodes according to the configuration, and the partition of index is called the primary partition, and the replicated partition is called the replication partition, the benefit is that the data is not lost and the query performance is improved.
Windows under Elasticsearch Environment installation
1. Download Elasticsearch
Enter Elasticsearch official website: www.elastic.co/downloads/elasticsearch, download the Windows version of the installation package zip, download the current latest version of 6.4.0.
2. Before installing Elasticsearch, confirm that the system has installed more than JDK1.8 version, Elasticsearch run dependent on the JDK locale, unzip the installation package to the specified directory, here I put on the C drive.
3. Start Elasticsearch: Enter the installation directory C:\elasticsearch-6.4.0\bin execute Elasticsearch.bat, when correctly enabled, it shows as follows:
The normal display in the browser opens:
4. Installing the Elasticsearch-head Plugin
Elasticsearch Head is a visualization tool for cluster management, data visualization, incremental deletion and query.
The 4.1 Elasticsearch-head plugin relies on the node environment, so we have to install the node environment first:
Go to the official website nodejs.org/en/download/download the Windows version of the installation package, download the latest version of 8.11.4, the default installation, always next.
After the installation is complete, the DOS window input node–v command verifies that the installation is correct:
4.2 Installing the Grunt build tool: The role of installing the grunt tool is to use this tool to Qigong head plugin
In the DOS window into the node installation directory, the NPM command to install GRUNT:NPM install-g grunt-cli, after the installation is completed by Grunt–version display version number is installed properly
4.3 Installing the Elasticsearch-head plug-in
Go to github address download plugin Github.com/mobz/elasticsearch-head, here I unzip the installation package to C:\elasticsearch-head-master
Modify the server listener address: Modify the C:\elasticsearch-head-master directory under the Gruntfile.js file, increase the Hostname property increase hostname: ' * ' Configuration
Modify the address of Head connection Elasticsearch: Modify the App.js file in the C:\elasticsearch-head-master\_site directory to change localhost to es IP address
Change localhost to Elasticsearch server address, such as: 114.aaa.bb.cc:9200, I do this is a native test, so do not modify, use localhost.
Modify the Elasticsearch configuration file: Edit the C:\elasticsearch-6.4.0\config/elasticsearch.yml file to add the following two lines of configuration
To install the Heah plugin:
In the DOS window switch to the C:\elasticsearch-head-master directory to execute the NPM command: NPM Install, this process I install time is longer.
To access the browser, the normal display is as follows:
OK, to this need to install the software has been installed completely, it should be noted that the Elasticsearch-head directory must start the service in order to succeed, Because the grunt tool reads the configuration from the Gruntfile.js file in the directory, the Elasticsearch and Elasticsearch-head plug-ins are foreground-initiated, and if the terminal is a DOS window, then the Elasticsearch and head services will also stop the service.
Reference: "Spring Boot2 Essence"--li Jia Zhi