当前位置:   article > 正文

区块链学习4-长安链并发测试(2)_部署链_长安链压测

长安链压测

 上一篇:https://mp.csdn.net/mp_blog/creation/editor/128927000

二、部署链和prometheus配置

1. 单机模式下部署长安链

https://docs.chainmaker.org.cn/quickstart/通过命令行体验链.html

下载源码:

  1. git clone -b v2.3.0 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
  2. git clone -b v2.3.0 https://git.chainmaker.org.cn/chainmaker/chainmaker-cryptogen.git

#  编译证书生成工具

  1. cd chainmaker-cryptogen
  2. make
  3. cd chainmaker-go/tools
  4. ln -s ../../chainmaker-cryptogen/ .


# 启动cert模式的链

  1. cd chainmaker-go/scripts
  2. # 配置14节点的链
  3. ./prepare.sh 4 1
  4. # 编译及制作安装包
  5. ./build_release.sh
  6. # 启动所有节点:
  7. ./cluster_quick_start.sh normal

2. 多机模式下部署链

使用第单机模式下生成的安装包

https://docs.chainmaker.org.cn/instructions/多机部署.html,参考5.2.2

1. 网络模块的种子节点配置:

进入chainmaker-go/build/release目录下,修改4个目录的chainmaker.yml,将网络模块的种子节点配置(net下的seeds),127.0.0.1配置是四台服务器的ip

  1. vim chainmaker-v2.3.1-wx-org1.chainmaker.org/config/wx-org1.chainmaker.org/chainmaker.yml
  2. net:
  3. provider: LibP2P
  4. listen_addr: /ip4/0.0.0.0/tcp/11301
  5. seeds:
  6. -"/ip4/10.0.51.249/tcp/11301/p2p/QmXPot83DyuTrmUHNoJyTTDPDDPXtF4KM9TRGxR1js48RF"
  7. - "/ip4/10.0.51.163/tcp/11302/p2p/QmfUJPDKpjMdkuLsdDjX1qcvmoc4QrQ8xcC6TxQ7fDobDR"
  8. - "/ip4/10.0.51.65/tcp/11303/p2p/QmQ3k3uEwc2zAiKmrMNJgBMdid6YSAkW559Wwe3g4xFjyc"
  9. - "/ip4/10.0.51.217/tcp/11304/p2p/QmQQE7e7RjLZisdrJ3GdqLE2JLFU31SoAA3LZuaxdTZ4pL"
  10. vim chainmaker-v2.3.1-wx-org2.chainmaker.org/config/wx-org2.chainmaker.org/chainmaker.yml
  11. vim chainmaker-v2.3.1-wx-org3.chainmaker.org/config/wx-org3.chainmaker.org/chainmaker.yml
  12. vim chainmaker-v2.3.1-wx-org4.chainmaker.org/config/wx-org4.chainmaker.org/chainmaker.yml

2. 【配置开启长安链的prometheus监控】:

(1)为4台节点服务器安装docker和docker-compose

  1. #安装docker
  2. $ yum install docker-io
  3. $ service docker restart
  4. Redirecting to /bin/systemctl restart docker.service
  5. # 安装docker-compose
  6. $ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  7. $ sudo chmod +x /usr/local/bin/docker-compose

(2)为4台链安装文件启用监控

  1. vim chainmaker-v2.3.1-wx-org1.chainmaker.org/config/wx-org1.chainmaker.org/chainmaker.yml
  2. ---------
  3. monitor:
  4. enabled: true

(3)配置prometheus监控目标

  1. vim prometheus.yml
  2. -------
  3. - job_name: 'wx-org1.chainmaker.org'
  4. scrape_interval: 1s
  5. static_configs:
  6. - targets: ['10.0.51.249:14321']
  7. - job_name: 'wx-org2.chainmaker.org'
  8. scrape_interval: 1s
  9. static_configs:
  10. - targets: ['10.0.51.249:14322']
  11. - job_name: 'wx-org3.chainmaker.org'
  12. scrape_interval: 1s
  13. static_configs:
  14. - targets: ['10.0.51.249:14323']
  15. - job_name: 'wx-org4.chainmaker.org'
  16. scrape_interval: 1s
  17. static_configs:
  18. - targets: ['10.0.51.249:14324']

(4) 重启prometheus

  1. [root@server ~]# kill -9 $(pidof prometheus)
  2. [root@server ~]# lsof -i:9090
  3. [root@server ~]# nohup /usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" &

(5) 访问prometheus服务,看到四台目录已经添加:

3. 将包分发到各个服务器上

方式一:这里我已经有ansible环境,因此直接使用ansible

ansible ${ip} -m unarchive -a "src=${源文件} dest=${目标服务器上节点安装包的存放路径}"

方式二:也可以通过其他方式上传。总之四个tar包分别放在四台服务器的某个目录下,解压。

tar -zxvf chainmaker-v2.3.1-wx-org4.chainmaker.org-20230206171500-x86_64.tar.gz

3. 启动4个节点

  1. cd chainmaker-v2.3.1-wx-org1.chainmaker.org/bin
  2. ./start.sh

4. 访问prometheus的target, 四个目标已经启动:

5. 访问grafana,导入官方提供的dashboard

长安链官方提供的dashboard在chainmaker-go/monitor/dashboard.json目录 下

参考:https://docs.chainmaker.org.cn/dev/监控运维.html

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/676006
推荐阅读
相关标签
  

闽ICP备14008679号