赞
踩
上一篇:https://mp.csdn.net/mp_blog/creation/editor/128927000
https://docs.chainmaker.org.cn/quickstart/通过命令行体验链.html
下载源码:
- git clone -b v2.3.0 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
- git clone -b v2.3.0 https://git.chainmaker.org.cn/chainmaker/chainmaker-cryptogen.git
# 编译证书生成工具
- cd chainmaker-cryptogen
- make
- cd chainmaker-go/tools
- ln -s ../../chainmaker-cryptogen/ .
# 启动cert模式的链
- cd chainmaker-go/scripts
- # 配置1个4节点的链
- ./prepare.sh 4 1
- # 编译及制作安装包
- ./build_release.sh
- # 启动所有节点:
- ./cluster_quick_start.sh normal
使用第单机模式下生成的安装包
https://docs.chainmaker.org.cn/instructions/多机部署.html,参考5.2.2
进入chainmaker-go/build/release目录下,修改4个目录的chainmaker.yml,将网络模块的种子节点配置(net下的seeds),127.0.0.1配置是四台服务器的ip
-
- vim chainmaker-v2.3.1-wx-org1.chainmaker.org/config/wx-org1.chainmaker.org/chainmaker.yml
-
- net:
- provider: LibP2P
- listen_addr: /ip4/0.0.0.0/tcp/11301
- seeds:
- -"/ip4/10.0.51.249/tcp/11301/p2p/QmXPot83DyuTrmUHNoJyTTDPDDPXtF4KM9TRGxR1js48RF"
- - "/ip4/10.0.51.163/tcp/11302/p2p/QmfUJPDKpjMdkuLsdDjX1qcvmoc4QrQ8xcC6TxQ7fDobDR"
- - "/ip4/10.0.51.65/tcp/11303/p2p/QmQ3k3uEwc2zAiKmrMNJgBMdid6YSAkW559Wwe3g4xFjyc"
- - "/ip4/10.0.51.217/tcp/11304/p2p/QmQQE7e7RjLZisdrJ3GdqLE2JLFU31SoAA3LZuaxdTZ4pL"
-
- vim chainmaker-v2.3.1-wx-org2.chainmaker.org/config/wx-org2.chainmaker.org/chainmaker.yml
- vim chainmaker-v2.3.1-wx-org3.chainmaker.org/config/wx-org3.chainmaker.org/chainmaker.yml
- vim chainmaker-v2.3.1-wx-org4.chainmaker.org/config/wx-org4.chainmaker.org/chainmaker.yml
(1)为4台节点服务器安装docker和docker-compose
- #安装docker
- $ yum install docker-io
- $ service docker restart
- Redirecting to /bin/systemctl restart docker.service
- # 安装docker-compose
- $ 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
- $ sudo chmod +x /usr/local/bin/docker-compose
(2)为4台链安装文件启用监控
- vim chainmaker-v2.3.1-wx-org1.chainmaker.org/config/wx-org1.chainmaker.org/chainmaker.yml
-
- ---------
- monitor:
- enabled: true
(3)配置prometheus监控目标
- vim prometheus.yml
- -------
- - job_name: 'wx-org1.chainmaker.org'
- scrape_interval: 1s
- static_configs:
- - targets: ['10.0.51.249:14321']
- - job_name: 'wx-org2.chainmaker.org'
- scrape_interval: 1s
- static_configs:
- - targets: ['10.0.51.249:14322']
- - job_name: 'wx-org3.chainmaker.org'
- scrape_interval: 1s
- static_configs:
- - targets: ['10.0.51.249:14323']
- - job_name: 'wx-org4.chainmaker.org'
- scrape_interval: 1s
- static_configs:
- - targets: ['10.0.51.249:14324']
(4) 重启prometheus
- [root@server ~]# kill -9 $(pidof prometheus)
- [root@server ~]# lsof -i:9090
- [root@server ~]# nohup /usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" &
(5) 访问prometheus服务,看到四台目录已经添加:
方式一:这里我已经有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
- cd chainmaker-v2.3.1-wx-org1.chainmaker.org/bin
- ./start.sh
4. 访问prometheus的target, 四个目标已经启动:
5. 访问grafana,导入官方提供的dashboard
长安链官方提供的dashboard在chainmaker-go/monitor/dashboard.json目录 下
参考:https://docs.chainmaker.org.cn/dev/监控运维.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。