环境
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

浙公网安备 33010602011771号