环境

CentOS 7

下载安装

cd /usr/local
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head

安装nodejs

以下npm命令需要nodejs环境,没有安装的查看这里:linux安装nodejs

安装bzip2

yum install -y bzip2

安装grunt和grunt-cli

npm install -g grunt
npm install -g grunt-cli

安装elasticsearch-head

cd /usr/local/elasticsearch-head
#安装
npm install
#运行,然后打开 http://IP:9100/即可访问
npm run start 或者 grunt server
#运行方式二:后台运行
grunt server &

其他配置

修改head默认连接地址

elasticsearch-head默认连接的是http://localhost:9100,建议将localhost改成es对应的ip。
在head目录下,找到_site/app.js,编辑并搜索localhost

cd /usr/local/elasticsearch-head/_site
vim app.js
把localhost换成IP即可

在这里插入图片描述


配置elasticsearch允许跨域访问

cd /usr/local/elasticsearch-7.6.0/config/
vim elasticsearch.yml
#在最下面添加这2行
http.cors.enabled: true
http.cors.allow-origin: "*"

保存退出,重新启动es,刷新head
在这里插入图片描述

posted on 2020-08-25 14:11  风停了,雨来了  阅读(311)  评论(0)    收藏  举报