win7安装Elasticsearch和Elasticsearch-Head插件

1、环境搭建

  1)Java环境搭建可以参考相关的资料,这里不做详细介绍

  2)nodejs环境搭建

  到官方网站下载相应的zip包:https://nodejs.org/dist/v8.9.1/node-v8.9.1-win-x64.zip,解压到相应的目录,并把其添加到PATH环境变量中,打开cmd执行,node  -v

  

  说明nodejs环境搭建成功

2、ElasticSearch包下载和安装

  进入官网:https://www.elastic.co/,选择对应版本的zip包下载,下载完成之后解压到相应的目录

   

  cmd命令行进入到bin目录,直接执行elasticsearch.bat,如果不报异常,说明启动成功,打开浏览器访问:http://localhost:9200/

  

  

3、安装elasticsearch-head插件

  1)进入github,下载zip包:https://codeload.github.com/mobz/elasticsearch-head/zip/master

   下载完成之后,解压到与刚刚elasticsearch解压的同级目录

    

  2)cmd进入到上述解压目录,执行命令:npm  run  start,这时候会报错

  

   3)上述提示需要安装grunt,执行命令:npm  install  grunt,可能出现下面警告

  

  这里需要修改elasticsearch-head-master\package.json配置文件,打开并找到license位置,把原来的Apache2内容修改为Apache-2.0

  

  修改完成之后,重新执行npm  install  grunt 命令

  4)根据2)中的报错提示,还需要一些grunt插件,通过命令对应安装就ok

  npm install grunt-contrib-clean --registry=https://registry.npm.taobao.org

  npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org

  npm install grunt-contrib-watch --registry=https://registry.npm.taobao.org
  npm install grunt-contrib-connect --registry=https://registry.npm.taobao.org
  npm install grunt-contrib-copy --registry=https://registry.npm.taobao.org
  npm install grunt-contrib-jasmine --registry=https://registry.npm.taobao.org

  

4、修改对应的配置文件

  1)首先修改elsaticsearch的配置文件,解决head插件请求ElasticSearch跨域的问题,打开配置文件:elasticsearch-5.6.4-master\config\elasticsearch.yml

  新增参数:

  

  2)修改elasticsearch-head-master插件的配置文件,打开配置文件:elasticsearch-head-master\Gruntfile.js,

  找到connect的那一项,在options里面添加属性:hostname: '*',

  

5、启动

  1)启动ElasticSearch,cmd命令行进入到elsaticsearch-5.6.4\bin目录,直接执行elasticsearch.bat

  2)启动elsaticsearch-head插件,cmd进入到elasticsearch-head-master目录,执行命令:grunt  server

  

6、浏览器访问

  打开浏览器,访问http://localhost:9100

  至此,win7的ElasticSearch环境搭建成功

posted @ 2017-12-02 11:26  练子  阅读(742)  评论(0编辑  收藏  举报