ELK 学习笔记之 elasticsearch head插件安装

mac2022-06-30  78

elasticsearch head插件安装:

 

准备工作:

安装nodejs和npm

 

https://nodejs.org/en/download/

 

 

node-v6.11.2-linux-x64.tar.xz

由于是xz压缩文件,所以要先安装

yum -y install xz

$xz -d ***.tar.xz

$tar -xvf  ***.tar

配置环境变量

# set node environment

export NODE_HOME=/usr/local/node-v6.11.2-linux-x64

export PATH=$PATH:$NODE_HOME/bin

验证环境变量是否生效

[sky@hadoop1 bin]$ node -v

v6.11.2

[sky@hadoop1 bin]$ npm -v

3.10.10

使用npm安装grunt

npm install -g grunt-cli

grunt -version

 

下载elasticsearch-head

https://github.com/mobz/elasticsearch-head

解压zip上传

 

安装

 

到elasticsearch-head-master目录下,运行命令:

 

npm install

 

如果速度较慢或者安装失败,可以使用国内镜像:

 

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

cnpm install

修改&elasticsearch-head插件源码修改

修改elasticsearch.yml,增加跨域的配置(需要重启es才能生效)

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

编辑head/Gruntfile.js,修改服务器监听地址,增加hostname属性,将其值设置为*

connect: { hostname: '*', server: { options: { port: 9100, base: '.', keepalive: true } } } connect: { server: { options: { hostname: '*', port: 9100, base: '.', keepalive: true } } }

编辑head/_site/app.js,修改head连接es的地址,将localhost修改为esIP地址

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.151:9200"; 启动elasticsearch-head

nohup grunt server &

 

大功告成!!!不容易啊。

 

转载于:https://www.cnblogs.com/AK47Sonic/p/7440860.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)