win 10 用docker-compose启动elk(基于jhipster)

jhipster请自行查阅是什么。
elk的官网下载地址就不说了,自行去官网下载,注意3个的版本要保持一致。
win 10的docker和docker-compose安装请自行安装,不会的可以搜索我的相关博客。

下面直接上yaml文件:这个yaml文件是在官网上下载的,大家也可与去自行下载。

# Production ready docker configuration
version: '2'
services:
    jhipster-elasticsearch:
        image: jhipster/jhipster-elasticsearch:latest
        ports:
            - 9200:9200
            - 9300:9300
        # Uncomment this as well as the volume section down below
        # to have elasticsearch data persisted to a volume
        # you will need to create a named volume with `docker volume create log-data`
        #volumes:
        #   - log-data:/usr/share/elasticsearch/data

    jhipster-logstash:
        image: jhipster/jhipster-logstash:latest
        environment:
            - INPUT_TCP_PORT=5000
            - INPUT_UDP_PORT=5000
            - INPUT_HTTP_PORT=5001
            - ELASTICSEARCH_HOST=jhipster-elasticsearch
            - ELASTICSEARCH_PORT=9200
            - LOGSTASH_DEBUG=false
        ports:
            - 5000:5000
            - 5000:5000/udp
            - 5001:5001
        # Uncomment this section and add a logstash.conf file in log-conf/
        # to have logstash config loaded from a volume
        #volumes:
        #    - ./log-conf/:/usr/share/logstash/pipeline/

    jhipster-console:
        image: jhipster/jhipster-console:latest
        ports:
            - 5601:5601
        #environment:
        #    - ELASTICSEARCH_URL=http://jhipster-elasticsearch:9200

    jhipster-import-dashboards:
        image: jhipster/jhipster-import-dashboards:latest
        environment:
            - ELASTICSEARCH_URL=http://jhipster-elasticsearch:9200
        depends_on:
            - jhipster-elasticsearch

    jhipster-curator:
        image: jhipster/jhipster-curator:latest
        environment:
            - ES_HOST=jhipster-elasticsearch
            - ES_PORT=9200
            - UNIT_COUNT=14
            - UNIT=days

    jhipster-alerter:
        image: jhipster/jhipster-alerter:latest
        environment:
            - ES_HOST=jhipster-elasticsearch
            - ES_PORT=9200
        volumes:
            - ../alerts/rules/:/opt/elastalert/rules/
            - ../jhipster-alerter/config.yaml:/opt/elastalert/config.yaml

    jhipster-zipkin:
        image: jhipster/jhipster-zipkin:latest
        environment:
            - ES_HOSTS=http://jhipster-elasticsearch:9200
            # Change localhost:5601 by the URL by which your client access Kibana
            - ZIPKIN_UI_LOGS_URL=http://localhost:5601/app/kibana#/discover/d0682f20-e0e9-11e7-9c68-0b9a0f0c183c?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-30d,mode:quick,to:now))&_a=(columns:!(X-B3-TraceId,app_name,level,message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'logs-*',key:X-B3-TraceId,negate:!f,params:(query:'trace',type:phrase),type:phrase,value:'trace'),query:(match:(X-B3-TraceId:(query:'{traceId}',type:phrase))))),index:'logs-*',interval:auto,query:(language:lucene,query:''),sort:!('@timestamp',desc))
        ports:
            - 9411:9411

# Uncomment to use the log-data volume
# volumes:
#     log-data:
#         driver: local
 

当前目录,直接 docker-compose up -d 即可

启动不报错之后,直接访问:localhost:5601  

下面是你的jhipster的骨架微服务项目里的logstash记得打开,熟悉改为true,然后你的代码里就可以往elk里写入日志了

win 10 用docker-compose启动elk(基于jhipster)_第1张图片

win 10 用docker-compose启动elk(基于jhipster)_第2张图片 启动 微服务的demo之后,可与看到访问的日志。

你可能感兴趣的:(分布式架构-容器化时代,springCloud系列)