Tendermint 安装配置时常见错误及解决办法

2,470 阅读2分钟
  • ERROR: While parsing config: (186, 20): keys cannot contain new lines

配置文件 config.toml 第186行有语法错误。


  • 1. >>blockchainReactor validation error: Invalid commit -- wrong set size: 2 vs 1
  • 2. >>第一个添加的验证节点,被视为主验证节点,但是会出现主节点自己连接自己的情况,导致:dialing failed (attempts: 9): auth failure: secret conn failed: read tcp 192.168.0.221:50100->192.168.0.221:26656: read: connection reset by peer module=pex addr=c9a22e087554e19fe2930c867c2c410c7a7893dd@192.168.0.221:26656

对于问题1:新添加的验证节点的abci-data中的数据块与node中的数据块不一致,由于不知道是哪部分数据缺失,开发环境可以直接 tendermint unsafe_reset_all,但是在运行环境,建议先删除abci-kvstore中的数据,重新启动,若错误依然存在,再删除node中的数据,再重新启动。

在部署三个节点时出现了 2 vs 1,后面部署四个节点时出现了 4 vs 3,所以上面这个办法只是治标不治本,而且通过 curl localhost:26657/validators 请求,可以看到新验证节点的验证者是4个,而另外三个响应都是3个。

对于问题2:主验证节点对其他节点同步过来的连接信息没有做过滤处理。

这两个问题应该都是由于添加新节点的顺序不对造成的,解决办法:

  1. 首先在主验证节点机器终端中,输入:tendermint gen_validator,将生成的验证节点信息保存下来(可以使用:tendermint gen_validator >> priv_validators.json)
  2. 将 priv_validators.json 文件中公钥(pub_key)放到创世文件(genesis.json)中,旧新创世文件如下图:

  3. 在另一台机器终端上,输入:tendermint init,生成新节点信息
  4. 将 priv_validator_key.json 中的公私钥替换成 priv_validators.json 中的公私钥
  5. 然后使用 --p2p.persistent_peers/dial_peers 连接主节点
  6. 然后在终端中输入 a. tendermint init; b. tendermint testnet(生成验证节点数据,tendermint testnet --o /home/node:指定保存节点数据的路径); c. tendermint node

以上参考至Tendermint说明文档


  • dialing failed (attempts: 4): incompatible: peer is on a different network. Gottest-chain-aNPMLW, expected test-chain-9CqYLq module=pex addr=c9a22e087554e19fe2930c867c2c410c7a7893dd@192.168.0.221:26656

添加新的验证节点时,创世文件不一致导致的,多节点部署的创世文件必须是一致的。


  • timed out waiting for tx to be included in a block

等待响应的超时时间超过了默认设置的10s,但是不可设置超过10s,否则又会将导致增加全局HTTP写超时,具体参考此处。实际上此条交易已经写入内存池中,稍等片刻就会成功提交。


  • fast sync block verification failure
  • invalid commit -- wrong set size

这两个问题同时出现的话,就是由于验证节点的创世文件不一致导致的。