Linux环境安装配置ES的Head插件

Linux环境安装配置ES的Head插件

一.Nodejs安装配置

1.去node官网下载nodejs

image-20210921111708898

2.解压到一个合适位置

tar -xf ./node-v14.17.6-linux-x64.tar.xz -C /use/

3.建立软连接,方便以后随时随地使用相关命令

cd node-v14.17.6-linux-x64/
ln -s bin/npm /usr/local/bin/
ln -s bin/node /usr/local/bin/

4.配置环境变量

vim /etc/profile

#nodejs
export NODE_HOME=/use/node-v14.17.6-linux-x64
export PATH=$NODE_HOME/bin:$PATH

5.检查是否配置成功

image-20210921114722690

6.安装cnpm(可不安装)

 npm install -g cnpm --registry=https://registry.npm.taobao.org

二.安装head插件

7.head的github网址为https://github.com/mobz/elasticsearch-head ,直接git clone网速会很慢,这里访问中国的站点的该资源https://github.com.cnpmjs.org/mobz/elasticsearch-head

git clone https://github.com.cnpmjs.org/mobz/elasticsearch-head.git

8.修改Gruntfile.js:

cd /use/elasticsearch-head/
vim Gruntfile.js

新增一行

image-20210921142335776

9.修改app.js

cd _site/
vim app.js

把localhost修改为你的公网ip

image-20210921142825137

再修改es:

 vim ./elasticsearch-6.2.4/config/elasticsearch.yml

追加

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

image-20210921144432636

最后启动es,es-head,然后公网访问:

(这里是之前已经写过的索引)

image-20210921145009923


版权声明:本文为qq_43318840原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。