2321321 发表于 2017-1-5 15:35:14

ELK(elasticsearch5.0)head插件安装配置

elk升级部署到elasticsearch5.0后,安装elasticsearch-head插件遇到一个小问题:版本5.0以后,则不再elasticsearch/bin/plugin -install mobz/elasticsearch-head这种形式安装head插件,而是通过npm管理配置,步骤复杂了点。
head官网:https://github.com/mobz/elasticsearch-head#running-with-built-in-server

1
2
3
4
5
Running as a plugin of Elasticsearch
Install elasticsearch-head:
– for Elasticsearch 5.x:
    site plugins are not supported. Run elasticsearch-head as a standalone server
#以独立服务运行




官网大致安装步骤:


1
2
3
4
5
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
grunt server
open http://localhost:9100





具体流程;
1)下载并配置nodejs:


1
2
3
4
5
6
7
8
9
10
11
# xz -d node-v6.9.2-linux-x64.tar.xz
# tar xf node-v6.9.2-linux-x64.tar -C /usr/local/
# cd /usr/local/
# ln -s node-v6.9.2-linux-x64/ node
# cat /etc/profile.d/node.sh
export nodePATH=/usr/local/node
export PATH=$PATH:$nodePATH/bin
export nodePATH PATH
# # node -v
v6.9.2
#




2、下载elasticsearch-head插件并配置:

https://github.com/mobz/elasticsearch-head

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
yum install git -y
# git clonegit://github.com/mobz/elasticsearch-head.git
# chown root.elsearch -Relasticsearch-head/
# chmod 775 elasticsearch-head/ -R
配置elasticsearch.yml:
# cat config/elasticsearch.yml|grep -v"$^"|grep -v "#"
node.name: hyxdelk
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
#
#elasticsearch配置允许跨域访问,这样head插件可以访问es。
#http.cors.enabled: true
#http.cors.allow-origin: "*"




3、npm 安装并修改head源代码(默认监听127.0.0.1):
grunt是一个很方便的构建工具,可以进行打包压缩、测试、执行等等的工作,5.0里的head插件就是通过grunt启动的。因此需要安装一下grunt:


1
2
3
4
5
6
7
8
9
# npm install -g grunt--registry=https://registry.npm.taobao.org
# npm install -g grunt-cli
# npm install
#修改head源码:
# cp app.js app.js.bak
this.base_uri = this.config.base_uri ||this.prefs.get("app-base_uri") ||"http://192.168.1.225:9200";
# cp Gruntfile.js Gruntfile.js.bak
hostname: '0.0.0.0',
#hostname: '*',




4、后台启动grunt server并访问:


1
2
# ./node_modules/grunt/bin/gruntserver &
ps aux|grep head|grep –v grep






http://192.168.1.225:9100 并连接 http://192.168.1.225:9200


?唯一! 发表于 2017-1-9 11:39:22

盗取博客连个链接都没有,这样好么?可耻

qianxucqbb 发表于 2017-3-9 12:00:17

学习学习
页: [1]
查看完整版本: ELK(elasticsearch5.0)head插件安装配置