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

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,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值