elasticsearch-head是一个用于管理Elasticsearch的web前端插件,搞过ES的同学应该都了解。该插件在es5中可以以独立服务的形式进行安装使用。本文将介绍如何操作。
相关链接: https://github.com/mobz/elasticsearch-head http://mobz.github.io/elasticsearch-head/Step2, 下载源码并安装 git clone https://github.com/mobz/elasticsearch-head.git cd elasticsearch-head/ npm install
Step3,es配置修改&elasticsearch-head插件源码修改
① 修改elasticsearch.yml,增加跨域的配置(需要重启es才能生效) http.cors.enabled: true http.cors.allow-origin: "*" ② 编辑head/Gruntfile.js,修改服务器监听地址,增加hostname属性,将其值设置为*。 以下两种配置都是OK的 # Type1 connect: { hostname: '*', server: { options: { port: 9100, base: '.', keepalive: true } } }# Type 2 connect: { server: { options: { hostname: '*', port: 9100, base: '.', keepalive: true } } }
③ 编辑head/_site/app.js,修改head连接es的地址,将localhost修改为es的IP地址
# 原配置 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200"; # 将localhost修改为ES的IP地址 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://YOUR-ES-IP:9200";Step4,启动elasticsearch-head cd elasticsearch-head/ && ./node_modules/grunt/bin/grunt server 注意: ① 此时elasticsearch-head为前台启动,如果终端退出,那么elasticsearch-head服务也会随之关闭。 ② 在非elasticsearch-head目录中启动server会失败!因为grunt需要读取目录下的Gruntfile.js。 So,你需要将之放到后台进行运行,nohup,&,screen等各种方法请各位随意选择~ ps:我会用screen来做类似的操作~ Others 另外,开机启动、保持持久运行等可以考虑配置rc.local、supervisord等来实现(配置略)
转载于:https://www.cnblogs.com/thatsit/p/6347693.html
相关资源:elasticsearch可视化工具elasticsearch-head谷歌离线安装插件