elasticsearch6.x安装head插件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013219624/article/details/83859927

1.安装依赖nodejs

wget --no-check-certificate  https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-x64.tar.xz
tar -xf node-v9.9.0-linux-x64.tar.xz
mv node-v9.9.0-linux-x64 /usr/local/nodejs

vim /etc/profile
export NODE_HOME=/usr/local/nodejs
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile

2.修改elasticsearch.yml(支持跨域访问)

# 添加
http.cors.enabled: true
http.cors.allow-origin: "*"

3.获取elasticsearch-head-master, 并安装必要组件

wget  https://github.com/mobz/elasticsearch-head/archive/master.zip
# 如无unzip 自行安装(yum install -y unzip)
unzip master.zip

cd elasticsearch-head-master

# package.json证书失效 替换
vim package.json
license Apache-2.0


npm install -g grunt-cli
npm install grunt --save-dev
grunt -version

4.修改配置

vim Gruntfile.js
connect => server => options 添加 hostname: '172.22.2.15'(本机IP)

vim app.js
localhost替换为安装es机器的IP (172.17.9.30)

5.测试

grunt server            启动
nohup grunt server &    后台启动

# 如无netstat 安装(yum install net-tools)
netstat -tunlp | grep 9100  (检查是否启动成功) 

http://172.22.2.15:9100

6.其他

在使用的时候会发现基本查询报404 需要修改vendor.js 将contentType全部替换为application/json;charset=UTF-8

猜你喜欢

转载自blog.csdn.net/u013219624/article/details/83859927