Elasticsearch 5.0
The basic use of ES will use the head, but the version upgrade to 5.0, the head plug-in is not good to make. Let's see how to start the head plugin in 5.0!
Official Rough Tutorials
Running with built in server
Enable cors by adding http.cors.enabled:true in Elasticsearch configuration. Don ' t forget to also set http.cors.allow-origin because no Origin allowed by default. Http.cors.allow-origin: "*" is valid value, however it ' s considered as a security risk as your cluster are open to cross or Igin from anywhere.
Check Elasticsearch documentation on this parameter:
clone git://github.com/mobz/elasticsearch-head.gitcd elasticsearch-headnpm installgrunt server
Open Http://localhost:9100/
This would start a local webserver running on port 9100 serving Elasticsearch-head
Best option if is likely to connect to several different clusters
Deploying the 5.0 version of ES
The biggest difference between the 5.0 version of ES and the previous version is that there are many environment checks, such as jdk,max-files and so on.
Setting Kernel parameters
vi /etc/sysctl.conf# 增加下面的内容fs.file-max=65536vm.max_map_count=262144
Set Resource parameters
vi /etc/security/limits.conf# 修改* soft nofile 32768* hard nofile 65536
Modifying the parameters of a Elasticsearch
Modify the parameters used by es:
# Change the name of the cluster to avoid mixing with others ' clustersCluster. Name:Es-5.0-test# a different node namenode.name: node-101# Modify es the listening address, so that other machines can also access network.host:0.0.0< Span class= "Hljs-selector-class" >.0# The default is good http The. port:9200# adds new parameters so that head plug-ins can access eshttp.cors.enabled: truehttp.cors.allow-origin: "*"
Note that when setting the parameters: there are spaces behind! Install the deployment head First step, install Git
Need to download code from github, so install git first
install git
Once the installation is complete, you can download the code directly:
git://github.com/mobz/elasticsearch-head.git
After downloading, modify the next 777 permissions (Simple rude), because it is independent start head, so just put a position on the line, reference:
/usr/elk/head/*****
Step Two, install node
Because the head plug-in is essentially a NODEJS project, you need to install node and use NPM to install dependent packages. (NPM can be understood as MAVEN)
Go to the official website to download nodejs,https://nodejs.org/en/download/
The downloaded jar package is in XZ format, the general Linux may not be recognized, and you need to install XZ.
install xz
Then unzip the NODEJS installation package:
xz -d node*.tar.xztar -xvf node*.tar
After you have extracted the installation files for node, you need to configure the environment variables, edit the/etc/profile, add
set node environmentexport NODE_HOME=/usr/elk/node-v6.9.1-linux-x64export PATH=$PATH:$NODE_HOME/bin
Don't forget to do the following immediately
source /etc/profile
At this point, you can test if node is in effect:
[[email protected] node-v6.9.1-linux-x64]# echo $NODE_HOME/usr/elk/node-v6.9.1-linux-x64[[email protected] node-v6.9.1-linux-x64]# node -vv6.9.1[[email protected] node-v6.9.1-linux-x64]# npm -v3.10.8
Step three, install grunt
Grunt is a handy build tool for packaging compression, testing, execution, and so on, and the 5.0-in head plugin is launched through grunt. So you need to install Grunt:
install grunt-cli
After the installation is complete, check:
[[email protected] elasticsearch-head]# grunt -versiongrunt-cli v1.2.0grunt v0.4.5
Fourth step, modify head source code
Because the head code is also version 2.6, there are many restrictions on direct execution, such as the inability to access across machines. So users need to modify two places:
Modify Server Listener Address
Catalog: Head/gruntfile.js
connect: { server: { options: { port: 9100, hostname: ‘*‘, base: ‘.‘, keepalive: true } }}
Add hostname property, set to *
To modify the connection address:
Catalog: Head/_site/app.js
To modify the connection address of the head:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
Change localhost to the server address of your ES, such as:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.10.10:9200";
Fifth step, run head
First Open 5.0 ES.
Then, in the head directory, execute the package since the NPM install was downloaded:
install
Finally, start Nodejs
grunt server
Visit: target:9100
At this point, access http://xxx:9100
can access the head plugin.
Reference
Official Head Document
Category: Elasticsearch
Elasticsearch 5.0