安装插件ElasticSearch-Head

安装插件ElasticSearch-Head

1.1 安装nodejs(需要nodejs环境)

a. 下载node.js

wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
xz -d node-v6.9.2-linux-x64.tar.xz
tar -xvf node-v6.9.2-linux-x64.tar
rm -rf node-v6.9.2-linux-x64.tar
mv node-v6.9.2-linux-x64 /usr/local/
cd /usr/local/
mkdir node
mv node-v6.9.2-linux-x64 node

b. 设置环境变量

vi /etc/profile
在文件最后添加
export NODE_HOME=/usr/local/node/node-v6.9.2-linux-x64
export PATH=$NODE_HOME/bin:$PATH

c. 编译使配置立即生效

source /etc/profile

d. 验证是否安装成功

node -v
npm -v

1.2 安装ElasticSearch-Head

a.下载head wget https://github.com/mobz/elasticsearch-head/archive/master.zip
b. 解压,删除压缩包

unzip master.zip
rm -rf master.zip

c. 修改配置

修改Gruntfile.js hostname属性,添加主机ip
在这里插入图片描述
修改elasticsearch配置文件 conifig/elasticsearch.yml:
增加新的参数,这样head插件可以访问es,解决跨域访问问题
http.cors.enabled: true
http.cors.allow-origin: “*”

注意:重启es后生效

1.3 使用npm命令安装node模块

a. 进入到elasticsearch-head-master目录

使用命令 cd /usr/local/elasticsearch-head-master

b. 运行命令 npm install

如果速度较慢或者安装失败,可以使用国内镜像:npm install -g cnpm --registry=https://registry.npm.taobao.org

注意:
1、在elasticsearch-head目录下执行:npm install

它会自动的从相应的地址进行下载对应的依赖包,从而放入到node_modules中去;
如果报错,也可以执行下面的语句安装
#忽略脚本继续进行安装
npm install phantomjs-prebuilt@2.1.14 --ignore-scripts

2、在elasticsearch-head下使用npm run start启动,可能会报警告:
[root@redis1 elasticsearch-head-master]# npm run start

> elasticsearch-head@0.0.0 start /usr/local/elasticsearch/elasticsearch-head-master
> grunt server

>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?

使用命令安装缺失的插件(根据实际报错修改):
npm install grunt-contrib-clean grunt-contrib-concat grunt-contrib-watch grunt-contrib-connect grunt-contrib-copy grunt-contrib-jasmine

3、使用grunt server命令启动报错处理:
[root@redis1 elasticsearch-head-master]# grunt server
-bash: grunt: 未找到命令

安装grunt快捷命令:   
npm install -g grunt-cli
d.启动

切回到head的主目录下,grunt server 或npm run start启动

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坚持是一种态度

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值