1. 下载
-
命令下载
git clone git://github.com/mobz/elasticsearch-head.git
- 浏览器访问github地址下载 https://github.com/mobz/elasticsearch-head
2. 安装
- 需要Nodejs环境 Nodejs下载地址,安装教程macOS 中如何安装 Node.js_macos nodejs_村雨遥的博客-CSDN博客
- 安装grunt和grunt-cli
npm install -g grunt
npm install -g grunt-cli
- 在elasticsearch-head目录执行以下命令
cd elasticsearch-head
npm install grunt --save-dev
3. 启动
- 在es目录执行启动命令
npm start
4. 配置
- 修改head启动时的默认连接es地址
vim elasticsearch-head/_site/app.js
将http://localhost:9200
改为http://IP:9200
- 修改服务器的监听地址
vim elasticsearch-head/Gruntfile.js
在文件中增加 hostname: '*',如下图
4. 可能发生的问题
- 跨域问题,需要修改elasticseach的配置文件elasticsearch.yml, 修改对应的ip以及跨域的设置
**注意此处指的是elasticseach,而不是elasticseach-head**
http.cors.enabled: true
http.cors.allow-origin: "*"