ES is a distributed full-text search server based on Lucene. It is a bit similar to the full-text index of SQL Server. It is both a full-text search engine based on word segmentation and segmentation. It has the functions of word segmentation, synonyms, and stem queries. However, ES is naturally distributed and real-time attributes. This essay demonstrates the installation of ElasticSearch in a Windows environment and the Head plug-in for managing ElasticSearch.
ElasticSearch official website: http://www.elasticsearch.org
1. Install Java SE environment
Before installing the Elasticsearch engine, you must install the software environment required by ES, install the Java JDK and configure the JAVA_HOME environment variable:
1. Download and install the Java SE development package from Java Se Download, as shown in the figure:
ElasticSearch is sensitive to JRE versions. If the wrong version will cause ElasticSearch to fail to run. To download the archived JRE, please download the appropriate version from Java Archive.
2. After the Java SE development package is installed, you need to create a JAVA_HOME environment variable on the server.
Click the properties of "This PC" -> Advanced System Settings -> Environment Variables, create a new user environment variable JAVA_HOME, and set the variable value: C:/Program Files/Java/jdk1.8.0_121
Note: In Windows systems, the meaning of the usage of "% environment variable name %" is to obtain the value of the specified environment variable and create the JAVA_HOME environment variable because installing ElasticSearch requires reference to the Java SE development package.
3. Disable automatic update of Java JDK
Due to the impact of ElasticSearch receiving the JRE version, automatic update of JRE must be prohibited. Click the Java icon on the Control Panel.
, open the Java control panel, switch to the Update tab (tab), deselect "Check for Updates Automatically", and prohibit the system from automatically performing automatic updates of JDR.
2. Install ElasticSearch
After installing Java JDK and configuring the JAVA_HOME environment variable, you can install the Elasticsearch full-text search engine. First, you need to download a specific version of the ES installation file.
1. Download ElasticSearch version 2.4.4
Download the ElasticSearch installation package from the official download center ElasticSearch Download. When the poster took a screenshot, the latest version of ES is 5.1.2. This article uses the old version 2.4.4. Open past releases to select the past version to install, and download the zip file format. The reason why the poster chose to install version 2.4.4 is that version 5.1.2 does not support the Head plug-in.
2. Turn on ElasticSearch service
Unzip the zip file to the C drive, enter the C:/elasticsearch-2.4.4/bin directory, double-click to execute elasticsearch.bat, and the script file executes the ElasticSearch installation program, wait for a while, open the browser, enter http://localhost:9200, and explicitly indicate the following screen, indicating that ES installation is successful.
3. Install the head plug-in
In order to facilitate management of ES, this article uses the head plug-in, which is the primary management tool, displays ES clusters, indexes and other information in the browser, which is very useful.
1. Install the plug-in in the command line
Press and hold Windows+R, enter cmd, open the command line tool, enter the bin directory of ElasticSearch, and use the ES command to install the plug-in
cd C:/elasticsearch-2.4.4/binplugin install mobz/elasticsearch-head
2. Manage ElasticSearch through web pages
Enter http://localhost:9200/_plugin/head/ in your local browser. If you see the following screenshot, it means that the head plug-in is installed successfully.
4. Install ElasticSearch into Windows Service (Service)
1. Open the DOS command line interface, switch to the bin directory of ElasticSearch, and execute
service.bat install
2. Start the ElasticSearch service
service.bat start
3. In the run interface, enter services.msc to view the ElasticSearch service
Five, Recommended reading books
Recommended book: "Elasticsearch Server Development (2nd Edition)", which uses the curl tool to call the ES API. In fact, using the Head plug-in, in the Any Request tab, the URL of the API that sends requests to the ES server can be easily constructed, realizing the same function:
For example: Use the curl tool to send commands to the ES server to obtain the health status of the cluster:
curl -XGET http://127.0.0.1:9200/_cluster/health?pretty
Use the Head plugin to send a Request to the ES server to obtain the health status of the cluster:
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.