windows下 Elasticsearch 安装
一、安装jdk
a、新建 JAVA_HOME 环境变量,JAVA_HOME=C:\Java\jdk1.8.0_144
b、修改 path 环境变量,在path变量尾部添加%JAVA_HOME%\bin
c、新建 classpath 环境变量 ,.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
二、下载elasticsearch
https://www.elastic.co/guide/cn/elasticsearch/guide/current/running-elasticsearch.html
运行bin下的bat启动服务
三、可视化插件head
3.1 安装nodejs
下载:https://nodejs.org/en/download/ 。
配置环境变量 NODE_HOME D:\nodejs
验证环境变量是否配置正确
cmd —>echo %NODE_HOME%
cmd —>node -v
3.2 切换到nodejs目录下
cmd —>cd /d d:\nodejs\
3.3 在3.2切换的目录下,安装grunt
cmd —> d:\nodejs> npm install -g grunt-cli
3.4 去git下载 head插件zip包
https://github.com/mobz/elasticsearch-head
解压到d:\head\
3.5 安装pathomjs
输入命令 cd D:\head(你安装head的路径) 进入head的根目录下,然后执行命令:npm install
下面是下载时会显示的代码,其中有下载地址 和 存放地址 注意,如果下载慢,可以手动去下一个
> phantomjs-prebuilt@2.1.16 install d:\head\node_modules\phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
Saving to C:\Users\hhchen\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
(手动下载地址:http://phantomjs.org/download.html)
成功后如下:
> phantomjs-prebuilt@2.1.16 install d:\head\node_modules\phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
Saving to C:\Users\hhchen\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
Receiving...
[========================================] 100%
Received 17767K total.
Extracting zip contents
Removing d:\head\node_modules\phantomjs-prebuilt\lib\phantom
Copying extracted folder C:\Users\hhchen\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip-extract-1548905535580\phantomjs-2.1.1-windows -> d:\head\node_modules\phantomjs-prebuilt\lib\phantom
Writing location.js file
Done. Phantomjs binary available at d:\head\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 511 packages from 617 contributors and audited 1751 packages in 278.875s
found 24 vulnerabilities (17 low, 1 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
3.6 什么都别关 grunt server
3.7 在elasticsearch 目录D:\elasticsearch-6.6.0\config\ 下
elasticsearch.yml 增加两行
http.cors.enabled: true
http.cors.allow-origin: “*”
四、访问head,开启ES之旅
打开http://localhost:9100/ 就能访问到es啦!