centos7安装elasticsearch-head

1、安装Git(如果未安装)

yum install git wget
git  --version  #查看版本

2、安装Node

wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz
tar xf node-v16.13.1-linux-x64.tar.xz
sed -i '$a\#set maven\n\export PATH=$PATH:/data/nodejs/bin' /etc/profile
source /etc/profile

3、安装grunt(如果未安装,head插件的启动使用grunt)

 npm install -g grunt-cli  #安装grunt命令行工具grunt-cli
 npm install grunt --save-dev  #安装grunt及其插件
 grunt -version   #查看安装版本情况

4、下载并安装elasticsearch-head

# 选择一个目录下执行下面命令,别把head插件clone后放到 elasticsearch的plugins目录下,否则会报错

git clone git://github.com/mobz/elasticsearch-head.git   #git下载

cd elasticsearch-head  #进入目录

npm install  # 如果npm使用很多错误,尝试使用cnpm

npm install grunt --save  #安装grunt到模块中并保存

5、修改两处的配置

(1):修改elasticsearch 安装目录下的config/elasticsearch.yml

 # 增加如下字段
http.cors.enabled: true
http.cors.allow-origin: "*"

(2):修改elasticsearch-head下的Gruntfile.js

#其中增加一个
hostname: '0.0.0.0'  或者是 hostname: '*'

6、启动elasticsearch和head插件

#执行该命令
grunt server

其他

如果是学习环境建议关闭防火墙

systemctl stop firewalld.service  #停止firewall
systemctl disable firewalld.service  #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

如果端口被占用就去 Gruntfile.js 改端口

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值