当前位置:网站首页>长安链同步节点配置与启动
长安链同步节点配置与启动
2022-07-01 08:16:00 【帅气的梧桐述】
节点证书生成
1、默认脚本生成同步节点配置
在使用
./prepare_pk.sh
生成链配置的时候,默认
crypto-config\wx-org1.chainmaker.org\node
里边生成了两类节点的证书文件,一个是共识节点consensus1,一个是同步节点common1。
2、通过 chainmaker-cryptogen 或者自建的 CA证书服务 生成同步节点证书
同步节点配置生成
在启动节点配置文件中,只有共识节点的启动配置,如果需要启动同步节点,则需要自己新增一份同步节点配置,具体步骤如下:
1. 复制部署包
$ cd build/release
$ cp -rf chainmaker-v2.0.0-wx-org1.chainmaker.org chainmaker-v2.0.0-wx-org1.chainmaker.org_common1
2. 把chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/bin下所有的.sh脚本中所有wx-org1.chainmaker.org替换为wx-org1.chainmaker.org_common1
3. 重命名
$ cd build/release/chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/config
$ mv wx-org1.chainmaker.org wx-org1.chainmaker.org_common1
4. 拷贝chainmaker-cryptogen扩展生成的crypto-config/wx-org1.chainmaker.org/node/common1 到 chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/config/wx-org1.chainmaker.org_common1/certs/node下
5. 修改chainmaker.yml
把chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/config/wx-org1.chainmaker.org_common1/chainmaker.yml中所有路径中包含的wx-org1.chainmaker.org替换为wx-org1.chainmaker.org_common1。注意这里是指所有的路径,千万别把node模块里边的org_id改了,这个org_id表示的是同步节点所属的组织。
修改node模块,把 certs/node/consensus1/consensus1.sign.key 修改为 certs/node/common1/common1.sign.key
修改node模块,把 certs/node/consensus1/consensus1.sign.crt 修改为 certs/node/common1/common1.sign.crt
修改net模块,把 certs/node/consensus1/consensus1.tls.key 修改为 certs/node/common1/common1.tls.key
修改net模块,把 certs/node/consensus1/consensus1.tls.crt 修改为 certs/node/common1/common1.tls.crt
修改net模块,把 listen_addr: /ip4/0.0.0.0/tcp/11301 修改为 listen_addr: /ip4/0.0.0.0/tcp/11306
修改rpc模块,把 certs/node/consensus1/consensus1.tls.crt 修改为 certs/node/common1/common1.tls.crt
修改rpc模块,把 certs/node/consensus1/consensus1.tls.key 修改为 certs/node/common1/common1.tls.key
修改rpc模块,把 port: 12301 修改为 port: 12306
修改monitor模块,把 port: 14321 修改为 port: 14326
修改pprof模块,把 port: 24321 修改为 port: 24326
6. 修改chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/config/wx-org1.chainmaker.org_common1/chainconfig/bc1.yml中的trust_roots模块。
把所有 ../config/wx-org1.chainmaker.org 修改为 ../config/wx-org1.chainmaker.org_common1
7. 启动节点
$ cd build/release/chainmaker-v2.0.0-wx-org1.chainmaker.org_common1/bin
$ ./start.sh
8. End
异常解决
问题1:同步节点无法正常启动
[Blockchain] blockchain/chainmaker_server.go:192 init blockchain[chain1] failed, fail to initialize identity management service: [setup cert member failed, organization information in certificate and in input parameter do not match [certificate: wx-org1.chainmaker.org, parameter: wx-org1.chainmaker.org_common1]]
此异常导致的原因就是在修改chainmaker.yml中所有路径中包含的wx-org1.chainmaker.org替换为wx-org1.chainmaker.org_common1时把node模块里边的org_id也替换为wx-org1.chainmaker.org_common1了,这个org_id表示的是同步节点所属的组织,节点的组织ID为wx-org1.chainmaker.org,所以将之还原为不带common1的后缀即可。
问题2:同步节点同步区块报错
2022-06-29 16:10:37.641 [ERROR] [Storage] @chain1 [email protected]/blockstore_impl.go:525 chain[chain1] failed to write log, block[1], err:out of order
2022-06-29 16:10:37.641 [ERROR] [Core] @chain1 common/committer.go:90 out of order
2022-06-29 16:10:37.641 [ERROR] [Core] @chain1 common/block_helper.go:961 cache add block err: out of order
2022-06-29 16:10:37.641 [ERROR] [Sync] @chain1 sync/routine.go:70 process msg failed, reason: failed add block to chain
2022-06-29 16:11:12.561 [ERROR] [Storage] @chain1 blockfiledb/blockfile.go:478 out of order, b.entry.index: 2 and l.lastIndex+uint64(1): 1
2022-06-29 16:11:12.561 [ERROR] [Storage] @chain1 blockfiledb/blockfile.go:481 your block file db is damaged or not use this feature before, please check your disable_block_file_db setting in chainmaker.yml
此异常的原因为第一次因错误配置导致启动后有部分区块数据已经写到文件或者db中了,后边修改配置文件重新启动后,会导致新同步节点无法从其他共识节点同步到区块数据,此时需要把前边不正确启动所产生的区块数据清理,清理方式为到节点配置文件的data目录,删掉下边的文件夹,如果有用到mysql的需要把mysql与节点相关的数据库全部删掉,重启节点即可恢复。
边栏推荐
- Thread safety analysis of [concurrent programming JUC] variables
- 《MATLAB 神经网络43个案例分析》:第30章 基于随机森林思想的组合分类器设计——乳腺癌诊断
- CPU设计实战-第四章实践任务一简单CPU参考设计调试
- 2022 Chinese cook (technician) simulation test and Chinese cook (technician) practice test video
- Use threejs simple Web3D effect
- Manually dig XSS vulnerabilities
- Maneuvering target tracking -- current statistical model (CS model) extended Kalman filter / unscented Kalman filter matlab implementation
- Learn the knowledge you need to know about the communication protocol I2C bus
- Codeforces Round #803 (Div. 2) VP补题
- [no title] free test questions for constructor municipal direction general foundation (constructor) and theoretical test for constructor municipal direction general foundation (constructor) in 2022
猜你喜欢
【入门】提取不重复的整数
Airsim radar camera fusion to generate color point cloud
[getting started] extract non repeating integers
CPU设计实战-第四章实践任务一简单CPU参考设计调试
[dynamic planning] p1020 missile interception (variant of the longest increasing subsequence)
Soft keyboard height error
使用beef劫持用户浏览器
Airsim雷达相机融合生成彩色点云
Huawei machine test questions column subscription Guide
Koltin35, headline Android interview algorithm
随机推荐
Koltin35, headline Android interview algorithm
Deep learning systematic learning
0 basic introduction to single chip microcomputer: how to use digital multimeter and precautions
[no title] free test questions for constructor municipal direction general foundation (constructor) and theoretical test for constructor municipal direction general foundation (constructor) in 2022
leetcode T31:下一排列
【入门】取近似值
Burpsuite -- brute force cracking of intruder
Provincial election + noi Part VI skills and ideas
Connect timed out of database connection
栈实现计算器
When using charts to display data, the time field in the database is repeated. How to display the value at this time?
軟鍵盤高度報錯
Agrometeorological environment monitoring system
使用 setoolkit 伪造站点窃取用户信息
[introduction] approximate value
谈谈数字化转型的几个关键问题
2022.6.30 省赛+蓝桥国赛记录
Data analysis notes 11
[redis] it takes you through redis installation and connection at one go
[untitled]