ELK实时日志分析平台(elk+kafka+metricbeat)-elasticsearch部署(五)

  1. 云栖社区>
  2. 博客>
  3. 正文

ELK实时日志分析平台(elk+kafka+metricbeat)-elasticsearch部署(五)

技术小阿哥 2017-11-27 17:19:00 浏览2223
展开阅读全文

192.168.30.121,192.168.30.122,192.168.30.123上配置elasticsearch集群:

  1. 在所有主机上添加elk用户

  2. 在所有主机上解压elasticsearch,并更改属主,组:

    wKioL1nJrjLj9hVsAABsNJXjSQ0844.png

    wKiom1nJrnuTHRmpAAASWIu9Lak227.png

  3. 修改192.168.30.121配置文件:

    #cat>elasticsearch/config/elasticsearch.yml<<EOF
    cluster.name: my-es
    node.name: node-1
    path.data: /usr/local/elk/elasticsearch/data
    path.logs: /usr/local/elk/elasticsearch/logs
    bootstrap.memory_lock: false
    network.host: 192.168.30.121
    http.port: 9200
    discovery.zen.ping.unicast.hosts: ["192.168.30.121", "192.168.30.122","192.168.30.123"]
    discovery.zen.minimum_master_nodes: 2
    node.master: true
    node.data: true
    EOF

    wKioL1nJrr-RRb6AAAAY4iF4dBk204.png

    wKioL1nJrsuyFPlrAAAbCptf6nA762.png

    wKiom1nJrxPzr7t4AAAOHw9rXwA501.png

  4. 修改192.168.30.122配置:

    #cat>elasticsearch/config/elasticsearch.yml<<EOF
    cluster.name: my-es
    node.name: node-2
    path.data: /usr/local/elk/elasticsearch/data
    path.logs: /usr/local/elk/elasticsearch/logs
    bootstrap.memory_lock: false
    network.host: 192.168.30.122
    http.port: 9200
    discovery.zen.ping.unicast.hosts: ["192.168.30.121", "192.168.30.122","192.168.30.123"]
    discovery.zen.minimum_master_nodes: 2
    node.master: true
    node.data: true
    EOF
    wKioL1nJr0zzNK70AAAYBzZc-Vo857.png

    wKiom1nJr5bRJGDoAAAbGvdTXMM114.png

    wKioL1nJr2ay1qnhAAAM6YBOglg038.png

  5. 修改192.168.30.123配置:

    #cat>elasticsearch/config/elasticsearch.yml<<EOF
    cluster.name: my-es
    node.name: node-3
    path.data: /usr/local/elk/elasticsearch/data
    path.logs: /usr/local/elk/elasticsearch/logs
    bootstrap.memory_lock: false
    network.host: 192.168.30.123
    http.port: 9200
    discovery.zen.ping.unicast.hosts: ["192.168.30.121", "192.168.30.122","192.168.30.123"]
    discovery.zen.minimum_master_nodes: 2
    node.master: true
    node.data: true
    EOF

    wKiom1nJsCbQTSwEAAA48kj2I30501.png

    启动:

    cd /usr/local/elk/elasticsearch/logs && nohup sudo -u elk  /usr/local/elk/elasticsearch/bin/elasticsearch &

    检查:

    wKiom1nJsGmhjRG_AABLvfdfJNg138.png

  6. 安装head:

    检查依赖包:

    wKiom1nJsOKht48-AAAk6hSKqcA241.png

    安装:

    wKioL1nJsLfT_plLAABLxHyoqdo921.png

    #git clone https://github.com/mobz/elasticsearch-head.git
    cd elasticsearch-head/
    npm config set registry https://registry.npm.taobao.org 
    npm install   #安装较慢,失败可多次执行


    修改vim Gruntfile.js
                    connect: {
                            server: {
                                    options: {
                                            hostname: "192.168.30.121",
                                            port: 9100,
                                            base: '.',
                                            keepalive: true
                                    }
                            }
                    }

            });

  7. 修改app.js:

    [root@k8s-etcd1elasticsearch-head]# vim _site/app.js

    this.base_uri =this.config.base_uri || this.prefs.get("app-base_uri") ||"http://192.168.30.121:9200";

  8. 在所有elasticsearch的配置文件追添以下两行,然后重启elasticsearch:

    http.cors.enabled: true
    http.cors.allow-origin: "*"

  9. 启动head:

    [root@k8s-etcd1 elk]# cdelasticsearch-head/ && nohup grunt server -d &

  10. 检测:

    wKioL1nJscLTX_ivAAEeRnqiLtc012.png


本文转自 zhuxtqw 51CTO博客,原文链接:http://blog.51cto.com/1054054/1968684,如需转载请自行联系原作者

网友评论

登录后评论
0/500
评论
技术小阿哥
+ 关注