fabric生产环境搭建八:fabric的运维监控

fabric提供了完善的监控数据。并且在orderer和peer中内置了http server, 通过RESTful的方式对外发布服务,叫做 Operations Service

fabric种可监控的数据指标为:

危险的异次元门~~~>

用户可以直接访问RESTful接口获取数据,但往往通过和第三方监控平台集成。

本文讨利用和Prometheus+Grafana工具,来实现fabric的监控。

其中Prometheus主要完成对宿主机、容器、区块链数据指标的收集,Grafana主要完成对数据的展示和告警

基本步骤为:

  1. 开启对Prometheus支持
  2. 启动Prometheus
  3. 启动Grafana

1. 开启对Prometheus支持

首先要打开orderer和peer的封印,使其支持Prometheus。

在orderer容器的yaml配置中添加以下环境变量:[单向碑~~~>]()

ORDERER_METRICS_PROVIDER=prometheus
ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:17050

在peer容器的yaml配置中添加以下环境变量:[单向碑~~~>]():

CORE_METRICS_PROVIDER=prometheus
CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:18050

修改完成后重启orderer和peer

2. 启动Prometheus

先安装相关镜像

# prometheus镜像
docker pull prom/prometheus

# grafana镜像,供展示
docker pull grafana/grafana

用docker方式运行Prometheus,yaml文件详见:[神秘的传送门]()

配置prometheus容器中的/etc/prometheus/prometheus.yml文件,连接到orderer和peer端口:

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["192.168.101.23:9090"]
  - job_name: 'fabric'
    static_configs:
      - targets: ['192.168.101.23:18050']
      - targets: ['192.168.101.23:18051']
      - targets: ['192.168.101.23:17050']
      - targets: ['192.168.101.23:17051']
      - targets: ['192.168.101.23:17052']
  • 由于docker奇葩的网络设置,注意target里面的地址要写外网真实地址,不要写localhost或者127.0.0.1,尤其是在mac或者windows环境中,否则prometheus会替换成docker里面的主机名,在页面上访问不了

启动Prometheus

docker-compose -f prometheus.yaml up

打开网页看看效果:

http://localhost:9090/targets

3. 启动Grafana

准备grafana配置文件,详见:[不起眼的传送门]()

docker-compose -f grafana.yaml up

打开网页看看效果:

http://localhost:3000

初始登陆账号为admin/admin,然后添加data source,添加Dash board, 添加Pannel一系列操作了

至于Prometheus和grafana一系列华丽的操作,就不展开讲了,感兴趣的可以查看官方文档:

  • https://grafana.com/docs/grafana/v7.5/
  • https://prometheus.io/docs/introduction/overview/

基本思路是,grafana属于页面展示,数据来源是Prometheus, 简单的把Prometheus当作一个数据库看待 ,Prometheus提供了一种查询语言叫做PromQL,通过PromQL查询Prometheus的数据,在grafana中展示。

展示一下本项目中简单的grafana页面吧:

Ref

  • https://hyperledger-fabric.readthedocs.io/en/release-2.2/operations_service.html
  • https://hyperledger-fabric.readthedocs.io/en/release-2.2/metrics_reference.html#orderer-metrics
  • https://juejin.cn/post/6956839519257624613
  • https://www.cnblogs.com/xiao987334176/p/9930517.html


《 “fabric生产环境搭建八:fabric的运维监控” 》 有 4 条评论

  1. can i order generic cytotec without insurance The main factor that increases your chances of having a multiple pregnancy is the use of infertility treatment, but there are other factors

  2. can i get generic cytotec pills While some African leaders remain hopeful, the Africa Progress Panel, a group of eminent individuals headed by former UN Secretary General Kofi Annan, believes that the conference commitments were too vague The lack of commitment to defined and measurable sustainable development goals at the Rio 20 summit is a profoundly disturbing outcome

  3. 19 were higher with Tamoxin tamoxifen citrate compared with placebo buy priligy online safe AJNR American Journal of Neuroradiology 26 10 2645 2651

  4. Offspring with the C1qa tm1b EUCOMM Wtsi reporter tagged deletion allele, hereafter referred to as C1qa GT neo, retain one wild type C1qa allele to prevent developmental abnormalities that may result from a complete deletion of C1q during development priligy cvs Therefore, you can get all of the advantages without adding a lot of calories to your diet

回复 agodelo 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

About Me

一位程序员,会弹吉他,喜欢读诗。
有一颗感恩的心,一位美丽的妻子,两个可爱的女儿
mail: geraldlee0825@gmail.com
github: https://github.com/lisuxiaoqi
medium: https://medium.com/@geraldlee0825