问题
使用FISCO BCOS 3.x PRO版本host网络模式,扩容成功,但是扩容的节点无法加入到观察者列表,控制台报错:
{
"code":-4008,
"msg":"waiting for message response timed out"
}
环境配置
FISCO BCOS版本:3.5.0
虚拟机版本:ubuntu-22.04.4
jdk版本:jdk1.8.0_202
(所有虚拟机的防火墙都处于关闭状态)
ip | 主机名 | 机构 |
---|---|---|
192.168.110.132(tars管理服务部署节点) | FISCO2 | agencyA |
192.168.110.133 | FISCO3 | agencyB |
192.168.110.131(扩容节点) | FISCO4 | agencyC |
步骤
- 在FISCO2,FISCO3两台虚拟机搭建pro host版本的链,分别对应agencyA和agencyB:
使用console可以看到部署成功的节点:
[group0]: /apps> getGroupPeers
peer0: 20c976b763b1b7427e48198cabf5a75805989e7f0c481f3cff7c53a8e4ae6cb75308716c50376d4443dd35aae3ca7fd3ace27180339e9a94e608dca29895c1f1
peer1: 2a8ea604f5295d5197679c5b387c25ed1e863e98a3fd9944767f3f41a934e27079896056e19c7c4118f50322c10007ef7f68767d3c27f1d61940dae4c2a573aa
[group0]: /apps> getSealerList
[
Sealer{
nodeID='20c976b763b1b7427e48198cabf5a75805989e7f0c481f3cff7c53a8e4ae6cb75308716c50376d4443dd35aae3ca7fd3ace27180339e9a94e608dca29895c1f1',
weight=1
},
Sealer{
nodeID='2a8ea604f5295d5197679c5b387c25ed1e863e98a3fd9944767f3f41a934e27079896056e19c7c4118f50322c10007ef7f68767d3c27f1d61940dae4c2a573aa',
weight=1
}
]
- 另有一台虚拟机FISCO4,想在这台机器上扩容一个agencyC,配置文件如下:
gateway&rpc扩容配置:
[tars]
tars_url = "http://127.0.0.1:3000"
tars_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJhZG1pbiIsImlhdCI6MTcwOTI1ODcyMCwiZXhwIjoxNzk4NjgyNzIwfQ.aBophmKcpcfgRwsGG1i-kIrIuBUCp9LkHxGqTufKlvk"
tars_pkg_dir = "binary/"
[chain]
chain_id="chain0"
rpc_sm_ssl=false
gateway_sm_ssl=false
# the ca path of the expanded rpc service
# must ensure that the path configuration is correct, otherwise the ssl verification will fail
rpc_ca_cert_path="generated/rpc/chain0/ca"
# the ca path of the expanded gateway service
# must ensure that the path configuration is correct, otherwise the ssl verification will fail
gateway_ca_cert_path="generated/gateway/chain0/ca"
[[agency]]
name = "agencyC"
# enable data disk encryption for rpc/gateway or not, default is false
enable_storage_security = false
# url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details
# key_center_url =
# cipher_data_key =
[agency.rpc]
deploy_ip=["192.168.110.131"]
listen_ip="0.0.0.0"
listen_port=10200
thread_count=4
[agency.gateway]
deploy_ip=["192.168.110.131"]
listen_ip="0.0.0.0"
listen_port=40300
peers=["192.168.110.132:30300", "192.168.110.133:30301", "192.168.110.131:40300"]
节点扩容配置:
[tars]
tars_url = "http://127.0.0.1:3000"
tars_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJhZG1pbiIsImlhdCI6MTcwOTI1ODcyMCwiZXhwIjoxNzk4NjgyNzIwfQ.aBophmKcpcfgRwsGG1i-kIrIuBUCp9LkHxGqTufKlvk"
tars_pkg_dir = "binary/"
[chain]
chain_id="chain0"
[[group]]
group_id="group0"
# the genesis configuration path of the expanded group
genesis_config_path = "generated/chain0/group0/config.genesis"
# use sm-crypto or not
sm_crypto=false
auth_check=true
init_auth_address="0x4bf9de7cd28becdc540c0ca7110d25f6a427efad"
[[agency]]
name = "agencyC"
[[agency.group]]
group_id = "group0"
[[agency.group.node]]
node_name = "node0"
deploy_ip = "192.168.110.131"
# enable data disk encryption for bcos node or not, default is false
enable_storage_security = false
# url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details
# key_center_url =
# cipher_data_key =
monitor_listen_port = "3901"
# monitor log path example:"/home/fisco/tars/framework/app_log/"
monitor_log_path = ""
enable_hsm=false
- 使用以上配置生成rpc,gateway,node:
- 将证书从FISCO2 的~/fisco/BcosBuilder/pro/generated/rpc/chain0/agencyCBcosRpcService/192.168.110.131/sdk 拷贝到FISCO4 ~/fisco/console/conf下,并且使用cp -n config-example.toml config.toml拷贝重命名配置文件,修改配置文件如下:
[cryptoMaterial]
certPath = "conf" # The certification path
disableSsl = "false" # Communication with nodes without SSL
useSMCrypto = "false" # RPC SM crypto type
# The following configurations take the certPath by default if commented
# caCert = "conf/ca.crt" # CA cert file path
# sslCert = "conf/sdk.crt" # SSL cert file path
# sslKey = "conf/sdk.key" # SSL key file path
# The following configurations take the sm certPath by default if commented
# caCert = "conf/sm_ca.crt" # SM CA cert file path
# sslCert = "conf/sm_sdk.crt" # SM SSL cert file path
# sslKey = "conf/sm_sdk.key" # SM SSL key file path
# enSslCert = "conf/sm_ensdk.crt" # SM encryption cert file path
# enSslKey = "conf/sm_ensdk.key" # SM ssl cert file path
[network]
messageTimeout = "300000"
defaultGroup="group0" # Console default group to connect
peers=["127.0.0.1:10200"] # The peer list to connect
[account]
keyStoreDir = "account" # The directory to load/store the account file, default is "account"
# accountFilePath = "" # The account file path (default load from the path specified by the keyStoreDir)
accountFileFormat = "pem" # The storage format of account file (Default is "pem", "p12" as an option)
# accountAddress = "" # The transactions sending account address
# Default is a randomly generated account
# The randomly generated account is stored in the path specified by the keyStoreDir
# password = "" # The password used to load the account file
[threadPool]
# threadPoolSize = "16" # The size of the thread pool to process message callback
# Default is the number of cpu cores
- 启动控制台,获取节点信息如下:
[group0]: /apps> getGroupPeers
peer0: 20c976b763b1b7427e48198cabf5a75805989e7f0c481f3cff7c53a8e4ae6cb75308716c50376d4443dd35aae3ca7fd3ace27180339e9a94e608dca29895c1f1
peer1: 2a8ea604f5295d5197679c5b387c25ed1e863e98a3fd9944767f3f41a934e27079896056e19c7c4118f50322c10007ef7f68767d3c27f1d61940dae4c2a573aa
peer2: eab8e7eb2b7998f6fc09f4f25cb0a4e0ea19cc26fcc6416a44aed608641b823740d1a06f96fec0953b255821197f08ff8a170a8c75eb2a7b875a66733d43355c
[group0]: /apps> getSealerList
[
Sealer{
nodeID='20c976b763b1b7427e48198cabf5a75805989e7f0c481f3cff7c53a8e4ae6cb75308716c50376d4443dd35aae3ca7fd3ace27180339e9a94e608dca29895c1f1',
weight=1
},
Sealer{
nodeID='2a8ea604f5295d5197679c5b387c25ed1e863e98a3fd9944767f3f41a934e27079896056e19c7c4118f50322c10007ef7f68767d3c27f1d61940dae4c2a573aa',
weight=1
}
]
- 将新扩容的节点加入观察者列表,报错:
[group0]: /apps> addObserver eab8e7eb2b7998f6fc09f4f25cb0a4e0ea19cc26fcc6416a44aed608641b823740d1a06f96fec0953b255821197f08ff8a170a8c75eb2a7b875a66733d43355c
{
"code":-4008,
"msg":"waiting for message response timed out"
}
```log
2024-03-04 13:54:59.888 DEBUG org.fisco.bcos.sdk.v3.transaction.manager.TransactionProcessor 211 sendTransactionAsync -- sendTransactionAsync, group: group0, to: 0000000000000000000000000000000000001003, tx hash: 0xbd30ce98b774571a820abe614bdde6e16171dc2e7766a288296e2e1219e88f80
2024-03-04 13:59:59.890 ERROR org.fisco.bcos.sdk.v3.client.ClientImpl 1444 parseResponseIntoJsonRpcResponse -- parseResponseIntoJsonRpcResponse failed, method: sendTransaction, retErrorMessage: waiting for message response timed out, retErrorCode: -4008
2024-03-04 13:59:59.891 ERROR org.fisco.bcos.sdk.v3.client.ClientImpl 1458 parseResponseIntoJsonRpcResponse -- parseResponseIntoJsonRpcResponse failed for decode the message exception, response: Response{errorCode=-4008, errorMessage='waiting for message response timed out', content=}, errorMessage: get response failed, errorCode: -4008, error message: waiting for message response timed out org.fisco.bcos.sdk.v3.client.exceptions.ClientException: get response failed, errorCode: -4008, error message: waiting for message response timed out
at org.fisco.bcos.sdk.v3.client.ClientImpl.parseResponseIntoJsonRpcResponse(ClientImpl.java:1455) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
at org.fisco.bcos.sdk.v3.client.ClientImpl$3.onResponse(ClientImpl.java:1330) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
at org.fisco.bcos.sdk.v3.transaction.manager.TransactionProcessor.lambda$sendTransactionAsync$0(TransactionProcessor.java:207) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
2024-03-04 13:59:59.893 ERROR org.fisco.bcos.sdk.v3.model.callback.TransactionCallback 31 onError -- transaction exception, errorCode: -4008, errorMessage: waiting for message response timed out
2024-03-04 13:59:59.896 ERROR console.Console 171 main -- ContractException, e: org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException: waiting for message response timed out
at org.fisco.bcos.sdk.v3.transaction.codec.decode.ReceiptParser.getErrorStatus(ReceiptParser.java:74) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
at org.fisco.bcos.sdk.v3.transaction.codec.decode.ReceiptParser.parseTransactionReceipt(ReceiptParser.java:44) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
at org.fisco.bcos.sdk.v3.contract.precompiled.consensus.ConsensusService.addObserver(ConsensusService.java:119) ~[fisco-bcos-java-sdk-3.6.0.jar:?]
at console.precompiled.PrecompiledImpl.addObserver(PrecompiledImpl.java:93) ~[console.jar:?]
at console.command.category.ConsensusOpCommand.lambda$static$8(ConsensusOpCommand.java:112) ~[console.jar:?]
at console.command.model.CommandInfo.callCommand(CommandInfo.java:310) ~[console.jar:?]
at console.Console.main(Console.java:134) ~[console.jar:?]
```