16. ICG综合实战

/ Docker / 没有评论 / 1520浏览

使用docker-compose进行一次实战练习。

编写docker-compose.yml文件

version: '3.1'

volumes:
  grafana_data: {}

services:
  influxdb: 
    image: tutum/influxdb:0.9
    restart: always
    environment:
      - PRE_CREATE_DB=cadvisor
    ports: 
      - "8083:8083"
      - "8086:8086"
    volumes:
      - /Users/huzd/docker/ICG/data/influxdb:/data
  cadvisor:
    image: zcube/cadvisor
    links: 
      - influxdb:influxsrv
    command: -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxsrv:8086
    restart: always
    ports:
      - "8080:8080"
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro

  grafana: 
      user: "104"
      image: grafana/grafana   
      restart: always
      links:
        - influxdb:influxsrv
      ports:
        - "3000:3000"
      volumes:
        - grafana_data:/var/lib/grafana
      environment: 
        - HTTP_USER=admin
        - HTTP_PAAS=admin
        - INFLUXDB_HOST=influxsrv
        - INFLUXDB_PORT=8086
                  

启动

➜  ICG docker-compose up                   
Creating network "icg_default" with the default driver
Pulling cadvisor (zcube/cadvisor:)...
latest: Pulling from zcube/cadvisor
59bf1c3509f3: Pull complete
d0b827d9ac39: Pull complete
9e212323cb96: Pull complete
620d71f14d3b: Pull complete
2211168bc141: Pull complete
Digest: sha256:35d631ec3b313cef7e4ad27cc98c894b01035e58887a1926ec7b4209eefb52c8
Status: Downloaded newer image for zcube/cadvisor:latest
Creating icg_influxdb_1 ... done
Creating icg_grafana_1  ... done
Creating icg_cadvisor_1 ... done
Attaching to icg_influxdb_1, icg_grafana_1, icg_cadvisor_1
influxdb_1  | => The initialization script had been executed before, skipping ...
influxdb_1  | => Starting InfluxDB in foreground ...
influxdb_1  | 
influxdb_1  |  8888888           .d888 888                   8888888b.  888888b.
influxdb_1  |    888            d88P"  888                   888  "Y88b 888  "88b
influxdb_1  |    888            888    888                   888    888 888  .88P
influxdb_1  |    888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
influxdb_1  |    888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
influxdb_1  |    888   888  888 888    888 888  888   X88K   888    888 888    888
influxdb_1  |    888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
influxdb_1  |  8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"
influxdb_1  | 
influxdb_1  | 2022/08/01 03:28:15 InfluxDB starting, version 0.9.6.1, branch 0.9.6, commit 6d3a8603cfdaf1a141779ed88b093dcc5c528e5e, built 2015-12-10T23:40:23+0000
influxdb_1  | 2022/08/01 03:28:15 Go version go1.4.2, GOMAXPROCS set to 2
influxdb_1  | 2022/08/01 03:28:16 Using configuration at: /config/config.toml
influxdb_1  | [metastore] 2022/08/01 03:28:16 Using data dir: /data/meta
influxdb_1  | [metastore] 2022/08/01 03:28:16 Node at localhost:8088 [Follower]
influxdb_1  | [metastore] 2022/08/01 03:28:16 Skipping cluster join: already member of cluster: nodeId=1 raftEnabled=true peers=[localhost:8088]
influxdb_1  | [metastore] 2022/08/01 03:28:17 Node at localhost:8088 [Leader]. peers=[localhost:8088]
influxdb_1  | [metastore] 2022/08/01 03:28:17 spun up monitoring for 1
influxdb_1  | [metastore] 2022/08/01 03:28:17 Updated node id=1 hostname=localhost:8088
influxdb_1  | [store] 2022/08/01 03:28:17 Using data dir: /data/db
influxdb_1  | [wal] 2022/08/01 03:28:17 WAL starting with 30720 ready series size, 0.50 compaction threshold, and 52428800 partition size threshold
influxdb_1  | [wal] 2022/08/01 03:28:17 WAL writing to /data/wal/_internal/monitor/1
influxdb_1  | [wal] 2022/08/01 03:28:17 reading WAL files to flush to index
influxdb_1  | [wal] 2022/08/01 03:28:17 writing 2 series from WAL file /data/wal/_internal/monitor/1/01.000001.wal to index
influxdb_1  | [handoff] 2022/08/01 03:28:17 Starting hinted handoff service
influxdb_1  | [monitor] 2022/08/01 03:28:17 'hh' registered for diagnostics monitoring
influxdb_1  | [handoff] 2022/08/01 03:28:17 Using data dir: /data/hh
influxdb_1  | [subscriber] 2022/08/01 03:28:17 opened service
influxdb_1  | [monitor] 2022/08/01 03:28:17 Starting monitor system
influxdb_1  | [monitor] 2022/08/01 03:28:17 'build' registered for diagnostics monitoring

访问web

  1. http://localhost:8083

image-20220801164458756


  1. http://localhost:8080/containers/

    image-20220801164557586

  2. http://localhost:3000/?orgId=1

image-20220801164632453

配置

image-20220801164711440

配置详解:

image-20220801164732303