一. Windows安装Elastic Search和Head插件

一.安装包下载

  • 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


猜你喜欢

转载自blog.51cto.com/13883677/2150073