ELK(5.0) head安装

来源:互联网 发布:淘宝女装店铺标志图片 编辑:程序博客网 时间:2024/06/06 00:18
安装完ELK之后想装一个head管理插件
发现ELK5.0+的版本 head插件无法在elasticsearch中直接安装了 需要自行下载安装

环境:
centOS 6.8
jdk1.8
Elasticsearch 5.0
Logstash 5.0
Kibana 5.0

1.去github下载代码,先要安装git
[root@linux1 ~]# yum -y install git

2.下载head
[root@linux1 ~]# git clone git://github.com/mobz/elasticsearch-head.git
[root@linux1 ~]# mv elasticsearch-head /usr/local/elasticsearch

3.下载安装nodejs、npm
下载
[root@linux1 ~]# wgethttps://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz

解压
[root@linux1 ~]# tar -zxvf node-v4.2.2-linux-x64.tar.gz
[root@linux1 ~]# mv node-v4.2.2-linux-x64 /usr/local/

设置软链接
[root@linux1 ~]# ln -s /usr/local/node-v4.2.2-linux-x64/bin/node /usr/sbin/node
[root@linux1 ~]# ln -s /usr/local/node-v4.2.2-linux-x64/bin/npm /usr/sbin/npm

设置npm代理镜像
[root@linux1 ~]# npm config set registry https://registry.npm.taobao.org
[root@linux1 ~]# npm info underscore (如果上面配置正确这个命令会有字符串response)

4.安装grunt
[root@linux1 ~]# npm install -g grunt

设置软链接
[root@linux1 ~]# ln -s /usr/local/node-v4.2.2-linux-x64/lib/node_modules/grunt/bin/grunt /usr/sbin/grunt

5.安装head
进入head目录下
[root@linux1 ~]# cd /usr/local/elasticsearch/elasticsearch-head
[root@linux1 elasticsearch-head]# npm install

6.配置head
[root@linux1 elasticsearch-head]# vi _site/app.js
找到
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
localhost改为对应的elasticsearch的ip

[root@linux1 elasticsearch-head]# vi Gruntfile.js
找到connect下的options,添加
connect: {
server: {
        options: {
          hostname: "0.0.0.0",                                         
                     port: 9100,
            base: '.',
            keepalive: true
        }  
    }  
}

7.修改elasticsearch配置
[root@linux1 elasticsearch]# vi elasticsearch.yml
在network下加入
http.host: 192.168.1.120
http.cors.enabled: true
http.cors.allow-origin: "*"

8.启动grunt
[root@linux1 elasticsearch]#cd elasticsearch-head
[root@linux1 elasticsearch-head]#grunt server &
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

然后用浏览器打开http://192.168.1.120:9100
成功打开 并且成功连接
0 0
原创粉丝点击