ning1875 / dynamic-sharding

用动态分片解决pushgateway高可用 单点 HA问题
https://ning1875.ke.qq.com/
47 stars 23 forks source link

English readme #3

Open jcdauchy opened 3 years ago

jcdauchy commented 3 years ago

Could it be possible to have a documentation on how to setup your pushgateway in HA mode ?

Thanks

ning1875 commented 3 years ago

Could it be possible to have a documentation on how to setup your pushgateway in HA mode ?

Thanks

  1. Download the dynamic-sharding package or build from source code
    #  wget https://github.com/ning1875/dynamic-sharding/releases/download/v2.0/dynamic-sharding-2.0.linux-amd64.tar.gz
  2. Modify the configuration file of dynamic-sharding.yml
# Mod the configuration file : the pgw address and consul server address
consul_server:
  # consul server addr
  addr: localhost:8500
  username:
  password:
  register_service_name: pushgateway
# web addr
http_listen_addr: :9292
# pgw addrs
pushgateway:
  port: 9091
  servers:
    - 1.1.1.1
    - 1.1.1.2
  1. Start dynamic-sharding service
  2. Dynamic-sharding as a back-end instance for load balancing
  3. Use the address of lb to push data
  4. Integration with promtheus: Use the consul_sd_configs to scrape pgw metrics
# Add the following text to your promtheus.yaml's scrape_configs section
scrape_configs:
  - job_name: pushgateway
    consul_sd_configs:
      - server: $cousul_api
        services:
          - pushgateway
    relabel_configs:
    - source_labels:  ["__meta_consul_dc"]
      target_label: "dc"
jcdauchy-moodys commented 3 years ago

Thanks a lot, will try this out and come back if needed.

jcdauchy-moodys commented 3 years ago

First question, I need to install consul on my K8s cluster, it is not embedded inside your code ?