MAC下elasticsearch-head安装使用

elasticsearch-head是elasticsearch的可视化工具

在mac下安装elasticsearch-head

1. elasticsearch-head依赖node grunt,先安装node

brew install node

安装成功后使用node -v验证

v18.0.0

(修改 registry可以减少下载时间npm config set registry https://registry.npm.taobao.org)

2. 安装grunt

npm install grunt

  注意npm install -g grunt //这样安装启动时提示Fatal error: Unable to find local grunt.

安装成功后使用grunt -version验证

grunt-cli v1.4.3

grunt v1.0.1

3. 安装head

npm install

可能报错

npm ERR! code 1
npm ERR! path /Users/anenyang/application/elasticsearch-head-master/node_modules/phantomjs-prebuilt
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! PhantomJS not found on PATH
npm ERR! Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
npm ERR! Saving to /var/folders/hm/cqxgt21d5tx28gmfs46kqhnw0000gn/T/phantomjs/phantomjs-2.1.1-macosx.zip
npm ERR! Receiving...
npm ERR! Error making request.
npm ERR! Error: aborted
npm ERR!     at connResetException (node:internal/errors:692:14)
npm ERR!     at TLSSocket.socketCloseListener (node:_http_client:414:19)
npm ERR!     at TLSSocket.emit (node:events:539:35)
npm ERR!     at node:net:715:12
npm ERR!     at TCP.done (node:_tls_wrap:581:7)
npm ERR! 
npm ERR! Please report this full log at https://github.com/Medium/phantomjs

使用

npm install -g

4. 修改head连接elastic的ip,打开_site/app.js,搜索9200,修改ip到elastic服务的ip

5. 启动head

npm run start

显示

> elasticsearch-head@0.0.0 start
> grunt server

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

6.在浏览器打开localhost:9100

如果显示未连接,需要修改elastic的elasticsearch.yml,添加

http.cors.enabled: true
http.cors.allow-origin: "*"

重启elastic后,刷新head。

 

posted @ 2022-07-21 15:29  jason47  阅读(790)  评论(0编辑  收藏  举报