Windows下安装elasticSearch5.6.3和head插件

来源:互联网 发布:win10桌面激活windows 编辑:程序博客网 时间:2024/06/05 18:27

序言:

在学习大数据的过程中,大数据的很多框架可能都需要搭建在linux环境中。很多人选择虚拟机 或者fedora等。我曾经也是这样。但是本文将Windows下安装搭建elasticSearch5.6.3和head插件 并且设置成开机自启动。对于初学elasticsearch的同学来说,更加直观和方便。下图是windows版本的示意图


1.确定配置了Java环境  1.8级以上    cmd  下java  -version 查看版本信息

2.官网下载并且解压elasticsearch-5.5.3 到任意目录下,在bin启动elasticsearch.bat 
可以使用http://localhost:9200/ 访问es,确认是否es启动正常。


3.head 插件的安装 

3.1下载head的插件压缩包,将其解压到上图 (步骤2)中的目录下(和bin,lib等同级目录即可)

在安装head时,还需要在windows中安装node和grunt的环境。

其中head是采用node.js 开发的,所以需要node。因为Grunt.js依赖于node.js的npm来管理和安装,所以,如果你还没有安装node.js,请查看怎么在windows下安装node.js

安装完node(node-v5.4.0-x64)后执行node -v 查看安装的版本

安装grunt  点击打开链接

3.2 安装完grunt 后,执行grunt -server 可能会出现下面的错误

但是呢出现grunt的模块没有安装的问题: 
Local Npm module “grunt-contrib-clean” not found. Is it installed? 
Local Npm module “grunt-contrib-concat” not found. Is it installed? 
Local Npm module “grunt-contrib-watch” not found. Is it installed? 
Local Npm module “grunt-contrib-connect” not found. Is it installed? 
Local Npm module “grunt-contrib-copy” not found. Is it installed? 
Local Npm module “grunt-contrib-jasmine” not found. Is it installed? 
Warning: Task “connect:server” not found. Use –force to continue. 
通过以下命令: 
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 
最后的一个安装不成功,但是不影响

再次执行grunt server 如果能够启动即可认为安装成功
4.配置两个文件
4.1 在es的config文件夹中elasticsearch.yml的最后加入
http.cors.enabled: true
http.cors.allow-origin: "*"
3.2  在head文件夹下修改Gruntfile
将hostname:'0.0.0.0'加入进去
connect: {
server: {
options: {
port: 9100,
base: '.',
hostname:'0.0.0.0',
keepalive: true
}
}
}


4.重新启动es和head插件的grunt服务
4.1 启动grunt服务

在cmd下进去head插件的目录中启动grunt服务。例如:我的路径
H:\source\ES\elasticsearch-5.5.3\head\node_modules\grunt\bin\grunt server 启动 grunt server
4.2 启动es服务
H:\source\ES\elasticsearch-5.5.3\bin\elasticsearch.bat
5.将es的启动服务制作成自启动和将grunt server的启动也制作成自启动
=======================================================================
5.0.将es的启动服务制作成自启动 H:\source\ES\elasticsearch-5.5.3\bin\elasticsearch-service.bat install 即可
然后--计算机--管理---服务---elasticsearch 设置成自启动
=======================================================================
5.1 我已经制作了启动grunt server的bat脚本 为startHead.bat
H:\source\ES\elasticsearch-5.5.3\head\node_modules\grunt\bin\startHead.bat
5.2 将上述startHead.bat 放入C:\Users\jone\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup 即可以自启动了

6.每次windows启动时,elasticSearch的进程和head启动完毕,可以进行开发测试。

原创粉丝点击