Elasticsearch Initial use (installation, head configuration, Word breaker configuration)

Source: Internet
Author: User
Tags get ip git client

1.ElasticSearch Simple Description

A.elasticsearch is a Lucene-based search server with distributed multiuser capabilities, Elasticsearch is an open source project (Apache License terms) developed in Java, based on a restful web interface that enables real-time search, Stable, reliable, fast, high performance, easy to install and use, and its scale-out capability is very strong, do not need to restart the service.

B.elasticsearch is a very useful real-time distributed search and analysis engine that can help us quickly handle large-scale data, as well as full-text retrieval, structured search and analysis.

C. Many websites currently use Elasticsearch for full-text searches, such as GitHub, StackOverflow, wikis, and so on.

D.elasticsearch based on the full-text search engine Lucene, and Lucene is the most advanced and efficient New century search engine framework, but Lucene is only a framework, to make full use of its functions, we need a high learning cost, While Elasticsearch uses Lucene as an internal engine, it encapsulates a powerful restful API that allows developers to achieve more efficient searches without having to understand the complex logic behind them.

E. About Lucene I've written a few blogs in the front, and open source on GitHub is a demo, the blog address is: http://www.cnblogs.com/hanyinglong/p/5387816.html

F.elasticsearch Official website: https://www.elastic.co/products/elasticsearch/

2. Prepare the installation files

A. 工欲善其事 its prerequisite, through the above simple description presumably you already know what Elasticsearch is doing, then we need to use it, and before using it must be installed, so in this blog I will briefly describe the Easticsearch installation, Elasticsea Configuration of Rch_head, the configuration of the word breaker plugin.

B. Elasticsearch installation package: Https://www.elastic.co/downloads/elasticsearch, download the latest tar package.

C. Elasticsearch_head configuration package,: Https://github.com/mobz/elasticsearch-head, download the latest ZIP compression package.

D. Participle plugin,: Https://github.com/medcl/elasticsearch-analysis-ik, clone the source code to operate.

E. Because Elasticsearch is written in Java, it needs Java support in its running environment, execute commands under Linux: java-version, check if the jar package is installed, if installed, you can continue the installation work, otherwise install the Java Jar Package , how to install please see blog: http://www.cnblogs.com/hanyinglong/p/5025635.html. (JDK installation more than 7)

F. The software and system used for this operation are as follows: Virtual machines (Vmware), CentOS systems installed in virtual machines, Xshell, xftp, installation packages above, Git, Maven, as for how to use them we'll talk about them.

3.ElasticSearch Installation

A. With the simple preparations above, you now have an environment that can be installed and released, and if not, please refer to the instructions above for your own installation.

B. Use Xshell to connect CentOS, after successful connection, use the command to jump to local to create your own folder Kencery, under this folder to create Elasticsearch folder, the command is as follows;

B.1 (1): CD usr/local/(2): MkDir kencery (3): CD kencery/(4): MkDir Elasticsearch (5): CD elasticsearch/

C. Then use XFTP to copy the Elasticsearch package downloaded in the prepare installation file to the west of the Elasticsearch folder:

    

D. Unzip the uploaded elasticsearch-2.3.1.tar.gz package and name it after decompression: Elasticsearch, as for the installation package contains the above content, please use the command ls-l to view it yourself.

D.1 TAR-ZXVF elasticsearch-2.3.1.tar.gz

D.2 MV elasticsearch-2.3.1 Elasticsearch

E. Run the script launch after entering the Elasticsearch file, the command is as follows:

E.1 CD Elasticsearch

E.2 Call Start command:./bin/elasticsearch (If you start with root, you will normally get an error here).

F. The solution to invoke the start command error under the root account

F.1 when using the root account to invoke the startup command, an error message appears, with the following error message:

Why would F.2 do that? This is due to the setup considerations in the system, because Elasticsearch can receive user input scripts and execution, in order to system security considerations, do not allow the root account to start, it is recommended to elasticsearch create a separate user to run Elasticsearch.

F.3 Create Elasticsearch user group and Elasticsearch user, the command is as follows:

Groupadd Elasticsearch

Useradd elasticsearch (user name)-G Elasticsearch (group name)-p elasticsearch (password)

F.4 Change the Elasticsearch folder and the owning user of the internal file and the group as Elasticsearch, after the modification is complete:

Chown-r Elasticsearch:elasticsearch Elasticsearch

      

F.5 switch to the Elasticsearch user, execute the start command again, then the boot succeeds

The G.elasticsearch back-end startup command is:./bin/elasticsearch-d

H. Use IP access after installation is complete

H.1 when the installation is completed we certainly hope that he can be accessed through IP in other LAN, but the execution: http://192.168.37.137:9200/, always can not connect successfully, and CentOS under the localhost, 127.0.0.1 are able to connect successfully.

H.2 this time we need to modify the configuration file, first use ifconfig query your Linux IP is how much, get IP.

H.3 jump to elasticsearch config profile, use vim to open elasticsearch.yml, find the inside of the "network.host", change it to the IP you have just queried, save.

CD elasticsearch/config/

Vim Elasticsearch.yml

H.4 Restart the Elasticsearch, and then use http://192.168.37.137:9200/access, if the connection is not successful, you need to consider whether the port is the reason, configure the port, restart the firewall.

H.5 using Http://192.168.37.137:9200/Access, Access results: The Elasticsearch installation was successful. ‘

      

H.6 Elasticsearch After the installation is complete, you want to have a visual environment to operate it, then down configuration: Elasticsearch Head

4.elasticsearch_head Configuration

A.elasticsearch Head is a cluster management, data visualization, increase and deletion check, query statement visualization tool, it is installed in two ways, one is to use the command installation, one is to download the package installation.

B. Command installation

B.1 Cd/usr/local/kencery/elasticsearch/elasticsearch

B.2./bin/plugin-install Mobz/elasticsearch-head (*)

Prompt error, error message: Error:unknown command [-install]. Use [-h] option to list available commands, this is because elasticsearch in more than 2.0 of the version will-install into the install.

B.3 execute the command./bin/plugin install Mobz/elasticsearch-head.

B.4 For more information see: Https://github.com/mobz/elasticsearch-head the Readme.md file below.

C. download package Installation

C.1 Download the package when we have downloaded the package to the local computer, so the download down the package (elasticsearch-head-master) decompression Elasticsearch-head-master folder.

C.2 Creating directory head under Elasticsearch installation plugin

cd/usr/local/kencery/elasticsearch/elasticsearch/plugins/

mkdir Head

C.3 jump to the Head folder and copy all the files under the Elasticsearch-head-master folder you just unzipped to the head directory:

      

c.4 Restart Elasticsearch, using http://192.168.37.137:9200/_plugin/head/to access the browser, the installation is successful.

      

D. Security issues

As can be seen, the plug-in can make any additions and deletions to the data, so it is not recommended to use it in a formal environment, if used, you must also limit the IP can be used.

5. Participle plugin Configuration

A. IK Analyzer is an open source, Java-based language development of the lightweight Chinese word breaker toolkit, initially, it is the open source project Lucene as the application of the main body, combined with the dictionary word segmentation and Grammar analysis algorithm of Chinese word segmentation components, Since the 3.0 release, IK has gradually become a common word breaker for Java, independent of Lucene project, and provided the default optimization implementation of Lucene, IK implements a simple word segmentation ambiguity elimination algorithm, which marks the IK word breaker from the simple dictionary participle to the simulation semantic segmentation derivation

B. When finished installing Elasticsearch, the default already contains a word breaker, is standard, this word-breaker support in English is also possible, but the support for Chinese is very poor:

http://192.168.37.137:9200/_analyze?analyzer=standard&pretty=true&text=helloworld,%E6%AC%A2%E8%BF%8E% E6%82%a8

    

C. Install the IK Word segmentation method.

C.1 first through git to download the source, open the GIT client input command: Git clone Https://github.com/medcl/elasticsearch-analysis-ik, if not installed git, download the zip package directly.

C.2 after downloading into the downloaded folder:

      

C.3 is using MAVEN to compile the project because of its source use Maven, if MAVEN is not installed, refer to the blog installation: http://www.cnblogs.com/hanyinglong/p/5030907.html, The command prompt runs as an administrator:

      

The compilation succeeds below will prompt succes.

C.4 Open the compiled target\releases, unzip the package, and then go into the unpacked compressed package to see a few jar packages and configuration files.

D. Create folder IK under plugin installation of Elasticsearch

cd/usr/local/kencery/elasticsearch/elasticsearch/plugins/

mkdir IK

E. Jump to the IK folder and copy the files in the C.4 to the IK folder:

    

F. Restart Elasticsearch, using http://192.168.37.137:9200/_analyze?analyzer=ik&pretty=true&text=helloworld,%E6% Ac%a2%e8%bf%8e%e6%82%a8 access the browser, if the word breaker, the configuration is successful.

    

A little bit every day, is progress

If there is a problem with the article, please point out that I will revise it in the first time.

Elasticsearch Initial use (installation, head configuration, Word breaker configuration)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.