ELK Stack 6.x with docker

作者: eason02 | 来源:发表于2018-01-29 13:29 被阅读868次

    关键词: elasticsearch logstash kibana ELK 6.x

    ELK Stack 6.x with docker

    久等了,终于更新了,也算是对一段时间研究的沉淀吧,原理不多说了,直接贴上docker-compose.yml file,docker发布了docker for mac,之前net: host的配置可能不太适用这个版本,避免过多的设置,加多了一个docker-compose.yml.docker_for_mac供苹果用户使用

    logstash默认开放filebeat的port是5044

    Prerequisite

    • OS : Centos 7.x
    • Docker engine > 1.12.x
    • Docker-compose > 1.11.x

    Clone GIT(如果你愿意)

    cd ~
    git clone https://github.com/easonlau02/elasticstack.git
    

    现在支持四个版本

    5.3.1/5.6.3/6.0.0/6.1.2
    

    以6.1.2为例子

    一、启动elk service最简单的方式

    用法:

    cd ~/elasticstack/
    chmod +x auto_up_elk_service.sh
    ./auto_up_elk_service.sh
    usage: ./up_service.sh <linux|mac>  <5.3.1 5.6.3 6.0.1 6.1.2> <your_hostname>
    
    • For linux user
    ./auto_up_elk_service.sh linux 6.1.2
    
    • For Mac user
    ./auto_up_elk_service.sh mac 6.1.2 <your_hostname>
    

    二、使用版本文件启动elk service

    1.如果你是MAC用户,需要修改以下配置,使用你的hostname替换下面compose file中的<your_es_host>
    ~/elasticstack/6.1.2/docker-compose.yml.docker_for_mac
    
    2.启动ELK service
    • For linux user
    cd ~/elaticstack/6.1.2
    docker-compose -f docker-compose.yml.linux up -d
    
    • For Mac user
    cd ~/elasticstack/6.1.2
    docker-compose -f docker-compose.yml.docker_for_mac up -d
    
    3. 通过<your_hostname>:5601,你会看到如下截图:
    Kibana Status
    Kibana

    你会看到 Couldn't find any Elasticsearch data, 那是因为我们只启动了ELK service,需要使用beatselasticsearch或者logstash发送data,关于filebeat for docker,可以参考如下,一个相当轻量级的image:
    filebeat-alpine: https://github.com/easonlau02/filebeat-alpine
    之后有时间会把相关的filebeat搭建过程放到简书。

    4. 自定义配置(仍然以6.1.2为例)

    这个solution使用eason02/elk-data-volume:6.1.2来管理所有的配置文件,所以如果你需要添加或者修改如下folder的配置的话:

    ~/elasticstack/6.1.2/elasticsearch/config/
    ~/elasticstack/6.1.2/logstash/config/
    ~/elasticstack/6.1.2/kibana/config/
    

    然后执行相关的eason02/elk-data-volume:6.1.2的build scripts来构建新的配置image:

    cd ~/elasticstack/6.1.2/
    chmod +x build_data_volumes_for_elk.sh
    ./build_data_volumes_for_elk.sh
    

    重启ELK service就可以直接生效了:

    • For linux user
    cd ~/elaticstack/6.1.2
    docker-compose -f docker-compose.yml.linux restart
    
    • For Mac user
    cd ~/elasticstack/6.1.2
    docker-compose -f docker-compose.yml.docker_for_mac restart
    

    ** 文章所有步骤都是经过实践检验并可行,若有问题,下方请评论。

    ——END——
    作者 : Eason,专注各种技术、平台、集成,不满现状,喜欢改改改
    文章、技术合作
    Email : eason.lau02@hotmail.com

    相关文章

      网友评论

      • 708cd27b3b37:你好 你这个镜像制作的过程是怎么样的 我想自己制作最新的镜像 image: eason02/elk-data-volume:6.1.2
      • Mrr_Yang:我是在腾讯云上部署实验的,启动后 es 无法链接,显示下面这个提示
        ------------------
        plugin:elasticsearch@6.1.2 Unable to connect to Elasticsearch at http://localhost:9200.

        -----------------
        我的是1g内存,是不是跟内存有关?
        Mrr_Yang:@eason02 好的👌 到家试试
        eason02:@Mrr_Yang 你试试curl localhost:9200
        eason02:应该是,默认是2g,估计是es启动失败
      • cqxxxxxxxx:问下1核2g能跑起来吗
        eason02:@cqxxxxxxxx 512应该没问题,官方建议1g以上,你可以把git folder拉下来,该对应版本的jvm配置,然后再build一下data-volume,https://github.com/easonlau02/elasticstack/blob/master/6.0.0/build_data_volumes_for_elk.sh
        cqxxxxxxxx:@eason02 今天用docker启了好几次都oom了,设成512可以不。
        eason02:@cqxxxxxxxx 默认2g,会耗尽内存的,建议4g,欢迎加星!https://github.com/easonlau02/elasticstack/blob/master/6.0.0/elasticsearch/config/jvm.options
        # Xms represents the initial size of total heap space
        # Xmx represents the maximum size of total heap space

        -Xms2g
        -Xmx2g

      本文标题:ELK Stack 6.x with docker

      本文链接:https://www.haomeiwen.com/subject/uaknnxtx.html