elasticsearch-5.5.1安装head客户端

来源:互联网 发布:蜂云网络 51订货网 编辑:程序博客网 时间:2024/06/04 19:34

1、安装nodejs、npm、grunt

curl -sL -o /etc/yum.repos.d/khara-nodejs.repo https://copr.fedoraproject.org/coprs/khara/nodejs/repo/epel-7/khara-nodejs-epel-7.repo
 然后安装 yum install -y nodejs nodejs-npm

查看版本号,验证是否安装成功

# node -v

v6.11.2

# npm -v

3.10.10

打印版本号,证明安装成功。

2、安装grunt、grunt-cli

# npm install -g grunt-cli

# npm install -g grunt

下载head源码,下载地址

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

存放在/data/ELK/目录下

# mv elasticsearch-head head

# cd head

执行以下命令开始安装依赖

npm install -g cnpm --registry=https://registry.npm.taobao.org
3、安装完成之后,对elasticesearch进行以下配置

在/data/ELK/elasticesearch/config/elasticesearch.yml文件末端新增以下内容:

http.cors.enabled: truehttp.cors.allow-origin: "*"
4、修改head相关配置

在/data/ELK/head/Gruntfile.js文件中找到 connect,新增hostname

connect: {        server: {            options: {                hostname: '0.0.0.0',                port: 9100,                base: '.',                keepalive: true            }        }    }   
5、启动head服务

在/data/ELK/head目录下启动服务器

nohup grunt server & //后台运行命令

# losf -i:9100 查看端口是否正常启动监听

6、访问后台

在浏览器中访问

http://192.168.40.249:9100


总结:启动grunt server时抛出以下异常,需要逐个安装(npm install grunt-contrib-clean)。

>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?