Windows环境下搭建 ElasticSearch

1.在https://www.elastic.co/cn/downloads/elasticsearch网站上下载windows 环境zip包,解压。

2.下载nodejs,安装。

3.下载Head配置插件:https://github.com/mobz/elasticsearch-head,解压到第一步elasticsearch包路径下。

4.nodejs安装完后,cmd到nodejs根目录下,输入指令:npm install -g grunt-cli ,等待安装完成。

5.到elasticsearch-head解压路径下,修改Gruntfile.js,在connect-server-options下添加hostname: "*"。

6.修改elasticsearch解压包的config文件夹下的elasticsearch.yml,添加如下代码:

##已存在示例,将注释代码去掉既可
cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"]   ##启动elasticsearch.bat闪退后,查看log日志提示需要配置。
cluster.initial_master_nodes: ["node-1"]  ##启动elasticsearch.bat闪退后,查看log日志提示需要配置。
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true

 7.启动elasticsearch.bat闪退后,查看logs文件夹下的my-application.log日志提示需要配置discovery.seed_hosts,cluster.initial_master_nodes。

8.cmd到elasticsearch-head目录输入命令npm install,若安装报各种关于package.json的解析错误,使用'npm cache clean --force'命令清除缓存再安装。如果报错信息如下:

 就是phantomjs下载不下来,可以去github或者gitee下载。https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip

http://npm.taobao.org/dist/phantomjs/

下载后放到C:\Users\DSJ\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip。再回到

 elasticsearch-head目录执行npm i --verbose,再执行npm install。

9.接着输入grunt server 启动nodejs,访问 http://localhost:9100

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值