1. 程式人生 > >elasticsearch-5.5.1安裝head客戶端

elasticsearch-5.5.1安裝head客戶端

elk head eleaticsearch

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: true
http.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?


本文出自 “胡哥” 博客,請務必保留此出處http://huwenjie.blog.51cto.com/3552670/1956969

elasticsearch-5.5.1安裝head客戶端