0、安装准备:
ES官网下载:elasticsearch
github下载:elasticsearch-head
辅助环境:jdk,nodejs
开始安装
1 安装ElasticSearch
解压elasticsearch压缩包即可,进入bin目录,运行elasticsearch启动脚本
默认http端口是9200,启动完成后访问 http://127.0.0.1:9200
image.png
2.1 安装图形化界面elasticsearch-head(参考github官方启动)
* `git clone git://github.com/mobz/elasticsearch-head.git`
* `cd elasticsearch-head`
* `npm install`
* `npm run start`
* `open` [http:// localhost:9100 /](http://localhost:9100/)
npm install时遇到的坑: phantomjs-prebuilt@2.1.16 安装失败:脱坑方法:
执行命令:npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
然后重试npm install
--ignore-scripts参数用于npm install在安装phantomjs-prebuilt@2.1.16时忽略package.json中设置的脚本
2.2 安装图形化界面elasticsearch-head(旧版)
a. 安装nodejs(略)
cmd 执行命令 node -v,输出对应信息即为安装成功
b. 安装grunt(启动elasticsearch-head需要)
在elasticsearch-head目录下执行命令1:npm install -g grunt-cli
在elasticsearch-head目录下执行命令2:npm install
c. 启动elasticsearch-head
在elasticsearch-head目录下执行命令:grunt server
启动成功后访问 http://127.0.0.1:9100
image.png
3 连接elasticsearch
a. 配置elasticsearch可跨域
在elasticsearch/config/elasticsearch.yml文件中追加:
# 允许跨域-
http.cors.enabled: true
http.cors.allow-origin: "*"
b. 重启elasticsearch
c. 在elasticsearch-head页面连接http://127.0.0.1:9200
image.png