使用Prometheus监控Tendermint多节点网络

:docker部署多节点Tendermint网络

1.拉取Prometheus的Docker镜像

docker image pull prom/prometheus

2.根据拉取的镜像配置dokcer-compose.xml文件

version: '3'

services:
  node0:
    container_name: node0
    image: "tendermint/localnode"
    ports:
      - "26656-26657:26656-26657"
    environment:
      - ID=0
      - LOG=${LOG:-tendermint.log}
    volumes:
      - ./build:/tendermint:Z
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.2

  node1:
    container_name: node1
    image: "tendermint/localnode"
    ports:
      - "26659-26660:26656-26657"
    environment:
      - ID=1
      - LOG=${LOG:-tendermint.log}
    volumes:
      - ./build:/tendermint:Z
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.3

  node2:
    container_name: node2
    image: "tendermint/localnode"
    environment:
      - ID=2
      - LOG=${LOG:-tendermint.log}
    ports:
      - "26661-26662:26656-26657"
    volumes:
      - ./build:/tendermint:Z
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.4

  node3:
    container_name: node3
    image: "tendermint/localnode"
    environment:
      - ID=3
      - LOG=${LOG:-tendermint.log}
    ports:
      - "26663-26664:26656-26657"
    volumes:
      - ./build:/tendermint:Z
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.5

  node4:
    container_name: node4
    image: "tendermint/localnode"
    environment:
      - ID=4
      - LOG=${LOG:-tendermint.log}
    ports:
      - "26665-26666:26656-26657"
    volumes:
      - ./build:/tendermint:Z
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.6
//配置prometheus服务
  node5:
    container_name: prometheus
    image: "prom/prometheus"
    user: root
    environment:
      - ID=5
    ports:
      - "9090:9090"
    volumes:
      - ./Prometheus:/prometheus:Z
      - ./Prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
      - /etc/localtime:/etc/localtime
    networks:
      localnet:
        ipv4_address: 192.167.10.7
networks:
  localnet:
    driver: bridge
    ipam:
      driver: default
      config:
      -
        subnet: 192.167.10.0/16

问题:运行prometheus服务的时候,会报如下错误:

msg=“Error opening query log file” file=/prometheus/queries.active
err=“open /prometheus/queries.active: permission denied”

解决方法: 在docker-compose.yml文件中增加user: root配置

3.运行多节点网络和Prometheus项目

docker-compose -f docker-compose.yml up

4.测试网络

curl -s ‘localhost:26657/broadcast_tx_commit?tx=“abcd”’

5.查看各节点metrics

http://localhost:9090

如下图所示:
在这里插入图片描述

http://localhost:9090/targets

如下图所示:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值