How do I install the search engine Elasticsearch ?, Elasticsearch search
The search engine is used in recent work. Because the current search engine is provided by LeanCloud, it is not very easy to use and does not support search by scope. In addition, the fee is 30 RMB per day, the number of requests is also limited. For these reasons, we have to deploy search engines on our servers.
After some research, we chose to use Elasticsearch based on our own technology. The following describes how to install Elasticsearch. We use the latest version 5.4.0.
I. Preparations before installation
1. Check the java version first.
Java-version
2. Installing the latest Elasticsearch requires the latest java 1.8
Reference https://www.java.com/zh_CN/download/manual.jsp
For Linux64-bit
Curl-L-O http://javadl.oracle.com/webapps/download/AutoDL? BundleId = 220305_d54c1d3a095b4ff2b6607d096fa80163
Rename the downloaded tar package
Tar package jre-8u131-linux-x64.tar.gz for mv download
Decompress the tar package
Tar-zxvf jre-8u131-linux-x64.tar.gz
To save disk space, delete the .tar.gz file.
Rm-f jre-8u131-linux-x64.tar.gz
3. java installation instructions
Https://www.java.com/zh_CN/download/help/linux_x64_install.xml
4. Use the Linux alternatives command to switch the java version
Http://www.cnblogs.com/zhangxiaoliu/p/6892093.html
Ii. Elasticsearch Installation Steps
Elasticsearch download link: https://www.elastic.co/downloads/elasticsearch
1. Download and decompress Elasticsearch
Wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.zip
Unzip elasticsearch-5.4.0.zip
2. Start
(Root cannot be used to start elasticsearch. elasticsearch officially reminds you that using root to start elasticsearch has security risks. I have created an elasticsearch user named es)
Useradd es
Passwd es. Press enter to set the password for es.
Chown-R es: es path/to/elasticsearch-5.4.0/
Start command
Cd elasticsearch-5.4.0
Bin/elasticsearch-d (-d is used as the daemon to start ES. For more parameters, see bin/elasticsearch -- help)
3. Check whether the test is successful.
Curl-XGET 'HTTP: // localhost: 9200? Pretty '(? Pretty will output the JSON return value in a formatted manner to make it easier to read ),
Sometimes, because ES is not fully started, it takes a while to get the result.