201611 月28
Elasticsearch 5.0 以上 elasticsearch-head 安装教程
elasticsearch 5.0/5.0.1以上版本的elasticsearch-head插件,使用node单独运行,会出现跨站访问的问题:
http://localhost:9200/_nodes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9100' is therefore not allowed access.
elasticsearch-head 安装教程如下:
1、安装node;
2、下载elasticsearch-head,安装node组件:
>git clone git://github.com/mobz/elasticsearch-head.git >cd elasticsearch-head >npm i >npm i grunt-cli -g >grunt server
3、elasticsearch.yml 增加配置项
http.cors.enabled: true http.cors.allow-origin: /http?:\/\/127.0.0.1(:[0-9]+)?/
4、Gruntfile.js 增加hostname配置项
connect: { server: { options: { port: 9100, hostname: '*', base: '.', keepalive: true } } }
5、修改配置文件后各自重启
http://127.0.0.1:9100/ 访问即可(http.cors.allow-origin 里配的是127.0.0.1哦)