Elasticsearch 5.0--head Plug-in Deployment Guide
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:
git clone git://github.com/mobz/elasticsearch-head.git
CD elasticsearch-head
npm install
grunt Server
Open Http://localhost:9100/
This would start a local webserver running on port 9100 serving Elasticsearch-head
Best option if your is likely to connect to several different clusters deploy 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
# Add the following content
fs.file-max=65536
vm.max_map_count=262144
#sysctl-p to make it effective
Set Resource parameters
vi/etc/security/limits.conf
# Modify
* Soft Nofile 32768
* Hard nofile 65536
user nofile 65536
user As unlimited
user hard Nproc 2048
#重新登陆即可生效
Modify the number of processes
Ulimit-u 2048
Modifying the parameters of a elasticsearch
Modify the parameters used by es:
# Change the name of a cluster to avoid mixing with other people's clusters
cluster.name:es-5.0-test
# change node name
node.name:node-101
# Modify the listener address of ES, So other machines can also access
network.host:0.0.0.0
# default is good
http.port:9200
# Add new parameters so the head plugin can access es
Http.cors.enabled:true
http.cors.allow-origin: "*"
Note that when you set the parameter: there are spaces behind it.
Install deployment Head
The first step is to install Git
Need to download code from github, so install git first
Yum-y Install git
Once the installation is complete, you can download the code directly:
git clone 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.
Yum-y Install XZ
Then unzip the NODEJS installation package:
xz-d node*.tar.xz
TAR-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 environment
export node_home=/usr/elk/node-v6.9.1-linux-x64
export 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:
[Root@localnode1 node-v6.9.1-linux-x64]# echo $NODE _home
/usr/elk/node-v6.9.1-linux-x64
[root@localnode1 node-v6.9.1-linux-x64]# node-v
v6.9.1
[root@localnode1 node-v6.9.1-linux-x64]# npm-v
3.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:
sudo ln-s/usr/local/bin/npm/usr/bin/npm sudo ln-s/usr/local/bin/node/usr/bin/node #建立软连接, otherwise root cannot find NPM NPM init # Generate Package.json otherwise error sudo npm install-g grunt-cli
After the installation is complete, check:
[Root@localnode1 elasticsearch-head]# grunt-version
grunt-cli v1.2.0
Grunt 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 the server listening address
Catalog: Head/gruntfile.js
Connect: {
server: {
options: {
port:9100,
hostname: ' * ',
base: '. ',
keepalive:true
}
}
}
Add hostname property, set to * Modify 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:
Finally, start Nodejs
Grunt Server
visit: target:9100
This time, access to http://xxx:9100 can access the head plugin.
Reference
Official Head Document
Reprint Address: http://www.cnblogs.com/xing901022/p/6030296.html