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
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 #以独立服务运行
官网大致安装步骤:
git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install grunt server open http://localhost:9100
具体流程;
1)下载并配置nodejs:
[[email protected] ~]# xz -d node-v6.9.2-linux-x64.tar.xz [[email protected] ~]# tar xf node-v6.9.2-linux-x64.tar -C /usr/local/ [[email protected] ~]# cd /usr/local/ [[email protected] local]# ln -s node-v6.9.2-linux-x64/ node [[email protected] node]# cat /etc/profile.d/node.sh export nodePATH=/usr/local/node export PATH=$PATH:$nodePATH/bin export nodePATH PATH [[email protected] node]# [[email protected] ~]# node -v v6.9.2 [[email protected] ~]#
2、下载elasticsearch-head插件并配置:
https://github.com/mobz/elasticsearch-head
yum install git -y [[email protected] plugins]# git clonegit://github.com/mobz/elasticsearch-head.git [[email protected] elasticsearch]# chown root.elsearch -Relasticsearch-head/ [[email protected] elasticsearch]# chmod 775 elasticsearch-head/ -R 配置elasticsearch.yml: [[email protected] elasticsearch]# 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: "*" [[email protected] elasticsearch]# #elasticsearch配置允许跨域访问,这样head插件可以访问es。 #http.cors.enabled: true #http.cors.allow-origin: "*"
3、npm 安装并修改head源代码(默认监听127.0.0.1):
grunt是一个很方便的构建工具,可以进行打包压缩、测试、执行等等的工作,5.0里的head插件就是通过grunt启动的。因此需要安装一下grunt:
# npm install -g grunt--registry=https://registry.npm.taobao.org # npm install -g grunt-cli [[email protected] elasticsearch-head]# npm install #修改head源码: [[email protected] _site]# 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"; [[email protected] elasticsearch-head]# cp Gruntfile.js Gruntfile.js.bak hostname: ‘0.0.0.0‘, #hostname: ‘*‘,
4、后台启动grunt server并访问:
[[email protected] elasticsearch-head]# ./node_modules/grunt/bin/gruntserver & ps aux|grep head|grep –v grep
http://192.168.1.225:9100 并连接 http://192.168.1.225:9200
时间: 2024-10-09 11:06:41