- 1. docker-compose.yml clickhouse metrics prometheus
- 1.1. prometheus 与 pushgateway 的区别
- 1.2. tree
- 1.3. config.xml
- 1.4. docker-compose.yml
- 1.5. prometheus.yml
- 1.6. restart.sh
- prometheus 是主动抓取方,一般用于需要主动采集的软件,例如 clickhouse。在配置文件 prometheus.yml 中填入 clickhouse 后会主动抓取相应 /metrics 的 metrics。
- pushgateway 是被动接收方,一般用于某些软件主动汇报 metrics 的情况,例如 Flink。在 Flink 配置文件中引入 jar 包并填入 pushgateway 的地址和端口即可。
搞清楚这两个的区别非常有助于了解下面的配置。
1.2. tree|-- clickhouse_dir | |-- clickhouse-server | | |-- config.xml | `-- clickhouse-server.bak | |-- ... |-- docker-compose.yml |-- prometheus_dir | |-- conf | | `-- prometheus.yml | `-- conf.bak | |-- ... `-- restart.sh1.3. config.xml
1.4. docker-compose.yml0.0.0.0 /metrics 8001 true true truetrue
# https://onlineyamltools.com/prettify-yaml # docker network create clickhouse-network version: '2' services: clickhouse-server: container_name: clickhouse-server image: 'clickhouse/clickhouse-server:latest' ports: - 8123:8123 - 8001:8001 ulimits: nofile: soft: 262144 hard: 262144 volumes: - '/mnt/hgfs/share/docker-composes/clickhouse/clickhouse_dir:/tmp/tmp' - '/mnt/hgfs/share/docker-composes/clickhouse/clickhouse_dir/clickhouse-server:/etc/clickhouse-server' depends_on: - prometheus prometheus: container_name: prometheus_clickhouse image: bitnami/prometheus:latest ports: - 9090:9090 volumes: - '/mnt/hgfs/share/docker-composes/clickhouse/prometheus_dir:/tmp/tmp' - '/mnt/hgfs/share/docker-composes/clickhouse/prometheus_dir/conf:/opt/bitnami/prometheus/conf' networks: default: external: name: clickhouse-network1.5. prometheus.yml
# A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=1.6. restart.sh` to any timeseries scraped from this config. - job_name: "prometheus" # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ["localhost:9090"] - job_name: "clickhouse" # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ["clickhouse-server:8001"]
#/bin/sh docker stop clickhouse-server docker stop prometheus_clickhouse docker rm clickhouse-server docker rm prometheus_clickhouse docker-compose up -d docker ps -a
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)