由于公司用的是es6,而升级es涉及代码大改就先不折腾,自己本地搭个7.x版本玩玩先。
es运行需要在jdk环境,我选择官网最新的 es 7.11.1,对应 jdk 11
【ES官网】
解压后执行以下命令
//进入es文件目录下 cd elasticsearch-7.11.1/ //启动es(加上-d 是后台启动,不是后台启动的话,关闭当前终端es就会自动关闭) ./bin/elasticsearch ./bin/elasticsearch -d
启动成功后访问:http://localhost:9200
运行ES-Head得先安装 Node.js 环境,地址:https://nodejs.org/en/download/ 或者执行brew install node
brew install node
再安装npm:sudo brew install npm
sudo brew install npm
再安装:sudo npm install -g grunt -cli
sudo npm install -g grunt -cli
查看grunt是否安装成功grunt -version
grunt -version
如果下面步骤出现__Fatal error: Unable to find local grunt.__
Fatal error: Unable to find local grunt.
则再执行:npm install grunt --save-dev
npm install grunt --save-dev
注意:如果你的es非本地,则可修改 /elasticsearch-head/_site/app.js,将localhost:9200 改成es服务对应的ip和端口
grunt server
Running "connect:server" (connect) task Waiting forever... Started connect web server on http://localhost:9100
安装后访问es-head,发现**[集群健康值: 未连接]**
F12一看,发现es-head某些请求有报错跨域了
经百度,需修改es.yml配置
vim /Users/hyuga/develop/elasticsearch-7.11.1/config/elasticsearch.yml
文件追后追加:
http.cors.enabled: true http.cors.allow-origin: "*"
然后关闭es服务,再启动即可。
再看下es-head控制台**[集群健康值: green (0 of 0)]**
搞定!!!
后面搭个架子耍下es7的demo.
【mac本地下载安装elasticsearch7.4和kibana7.4教程】
【Mac 下安装和配置ES-HEAD(elasticsearch数据库)】
【elasticsearch-head 无法连接elasticsearch的原因和解决】
评论