码迷,mamicode.com
首页 > Windows程序 > 详细

一. Windows安装Elastic Search和Head插件

时间:2018-07-25 17:05:33      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:elastics   nodejs   跨域   cors   mob   star   hub   tar   local   

一.安装包下载

  • Node: https://nodejs.org/en/download/

  • ES: https://www.elastic.co/downloads/elasticsearch

  • Head: https://github.com/mobz/elasticsearch-head


二.安装Node

    安装Node是为了后续安装Head插件,Node安装比较简单,需要配置环境变量


三.安装ES

    1.将ES安装包解压到指定目录

    2.修改config下的elasticsearch.yml

    注意:在elasticsearch.yml中必须加入http.cors.enabled: true和http.cors.allow-origin: "*",不然Head连接不上ES,请求跨域问题


四.安装Head插件

    1.将Head插件解压后放到ES跟目录下,5.x之前版本放在plugin下

    2.修改_site/app.js

    this.prefs = services.Preferences.instance();
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
if( this.base_uri.charAt( this.base_uri.length - 1 ) !== "/" ) {
// XHR request fails if the URL is not ending with a "/"
this.base_uri += "/";
    }


    3.修改Gruntfile.js

    connect: {
server: {
    options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}

    4.执行命令

    进入到head根目录

    npm install

    npm run start

五.测试

    1.先npm run start启动Head:127.0.0.1:9100

    2.在直接运行elasticsearch.bat启动ES: 127.0.0.1:9200


一. Windows安装Elastic Search和Head插件

标签:elastics   nodejs   跨域   cors   mob   star   hub   tar   local   

原文地址:http://blog.51cto.com/13883677/2150073

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!