欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

elasticsearch安装head插件

程序员文章站 2023-09-07 18:01:42
安装Head插件 由于head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。 <1>安装Node.js 下载解压 配置并生效 查看版本验证 <2>下载head插件 如果未安装git ,则先安装git工具 <3>安装grunt <4>安装插件 在elastics ......

安装head插件

由于head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。

<1>安装node.js

下载解压

wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
xz –d node-v6.10.2-linux-x64.tar.xz
tar xvf node-v6.10.2-linux-x64.tar
mv node-v6.10.2-linux-x64 /usr/local/node

 配置并生效

vim /etc/profile
export node_home=/usr/local/node
export path=$path:$node_home/bin

source /etc/profile

查看版本验证

[elsearch@imok bin]$ node -v
v6.10.2
[elsearch@imok bin]$ npm -v
3.10.10

<2>下载head插件

如果未安装git ,则先安装git工具

yum install –y git

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

<3>安装grunt

cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org

<4>安装插件

npm install

在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行:

npm install grunt --save 

<5>修改配置 elasticsearch-head下gruntfile.js文件

修改connect配置节点

elasticsearch安装head插件

修改 _site/app.js 修改http://localhost:9200字段到本机es端口与ip

 elasticsearch安装head插件

 <6>修改 elasticsearch配置文件 

 修改elasticsearch.yml文件加入以下内容:

# 是否支持跨域
http.cors.enabled: true

# *表示支持所有域名
http.cors.allow-origin: "*"

elasticsearch安装head插件

<7>启动head插件服务(后台运行)

/elasticsearch-head/node_modules/grunt/bin/grunt server &

 elasticsearch安装head插件

<8>查看

如下图说明安装ok

elasticsearch安装head插件