为什么要使用elasticsearch-head
访问http://127.0.0.1:9200/看的的web界面并不是很友好,此时我可以使用elasticsearch-head插件来提供友好的web界面。
ElasticSearch-head是一个H5编写的ElasticSearch集群操作和管理工具,可以对集群进行傻瓜式操作。
- 显示集群的拓扑,并且能够执行索引和节点级别操作
- 搜索接口能够查询集群中原始json或表格格式的检索数据
- 能够快速访问并显示集群的状态
- 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果;
- 5.0版本之前可以通过plugin名安装,5.0之后可以独立运行。
方法1、安装elasticsearch-head插件
1.登录github.com搜索elasticsearch-head然后下载:
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
2.检查是否安装了node.js,如果没有安装,在官网上现在.pkg文件安装就可以了
npm -install
3.运行elasticsearch-head
npm run start
(1)启动日志:
(2)访问http://localhost:9100进入web界面:
4.在web界面上看到的集群未连接,此时要进行跨越请求配置:
cd /Users/shifeifei/Software/elasticsearch-6.2.4/config
vim elasticsearch.yml
文件尾部添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
重启elastiasearch服务,刷新http://localhost:9100页面
方法2、安装Elasticsearch-Head
1.插件安装方式(推荐)
#在Elasticsearch目录下
$/bin/plugin -install mobz/elasticsearch-head
如果提示
ERROR: unknown command [-install]. Use [-h] option to list available commands
是因为好像2.0以上的版本-install 变成了 install了。
elasticsearch/bin/plugin install mobz/elasticsearch-head
2.下载安装方式
从https://github.com/mobz/elasticsearch-head下载ZIP包。
在 elasticsearch 目录下创建目录/plugins/head/_site 并且将刚刚解压的elasticsearch-head-master目录下所有内容COPY到当前创建的/plugins/head/_site/目录下即可。
二、重启Elasticsearch。访问。
head 插件是最好安装的其中一个, elasticsearch head 是集群管理工具、数据可视化、增删改查工具, Elasticsearch 语句可视化(下面会讲到)
重启Elasticsearch。访问。
访问地址是http://{你的ip地址}:9200/_plugin/head/
http 端口默认是9200 。
https://www.sojson.com/blog/85.html
方法3、搭建ELK(6.4.0)日志分析系统----Elasticsearch插件篇
地址 : https://blog.csdn.net/kumara_00/article/details/82706955
安装Elasticsearch插件
下载安装包:
下载地址:https://github.com/mobz/elasticsearch-head
解压安装包
unzip elasticsearch-head-master.zip
安装nodejs
下载地址:https://nodejs.org/en/download/
解压安装包
tar -Jxv -f node-v10.8.0-linux-x64.tar.xz
解压完成后进入文件夹,使用pwd打印当前目录地址, vim /etc/profile然后配置环境变量:
运行 source /etc/profile,使/etc/profile文件生效
输入 node -v 检查安装是否成功,安装成功会显示node版本
安装npm
配置全局环境使用node和npm
ln -s /usr/elk/node-v10.8.0-linux-x64/bin/npm /usr/local/bin/npm
ln -s /usr/elk/node-v10.8.0-linux-x64/bin/node /usr/local/bin/node
建立链接后将node的bean目录配置到用户环境变量中
vi .bash_profile
#配置环境变量
PATH=$PATH:<PATH 1>:<PATH 2>:---:/usr/elk/node-v10.8.0-linux-x64/bin
#执行更改
source .bash_profile
#验证 随便找个目录
node -v
npm -v
运行命令安装npm
#安装当前目录
npm install grunt
#安装全局目录
npm install -g grunt-cli
修改Elasticsearch配置文件
修改Gruntfile.js
在elasticsearch-head-master目录下,使用命令 vim Gruntfile.js 修改其中参数如下:
启动elasticsearch-head
在elasticsearch-head-master/目录下,运行启动命令 grunt server
接着即可通过IP:9100端口访问页面
运行报错:
npm install grunt-contrib-jasmine
运行命令把缺的东西都安装好。然后可以启动,但是还有报错:
解决方案:
npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
启动后进入IP:9100访问页面
后台启动elasticsearch-head
后台启动grunt server命令 nohup grunt server &exit
如果想关闭head插件,使用linux查找进程命令 ps aux|grep head
结束进程 kill 进程号
Elasticsearch6.X中head连接不上es
解决办法 :
1、在es6.x中连接不到head。
需要在配置文件conf/elasticsearch.yml中添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
修改完,重启es和head,则可以连接
关闭ES:control+c或
2、使用命令kill杀掉服务器的ES进程即可。
1、查找ES进程
ps -ef | grep elastic
2、杀掉ES进程
kill- 9 2389(进程号)
3、重启ES
sh elasticsearch -d
2、
参考链接 :
head插件安装 : https://www.sogou.com/link?url=hedJjaC291OV7dVab-QfvHtdr0qpeLU_My-09JFxBhOo1k6h8MknKQ…
https://blog.csdn.net/kumara_00/article/details/82706955
https://segmentfault.com/a/1190000015145850
https://blog.csdn.net/qq_33863843/article/details/78864618?utm_source=distribute.pc_relevant.none-task