Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context

Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context

我一直在尝试部署具有 3 个 CA、1 个订购者和 2 个对等节点的超级账本结构模型。我可以使用结构的 OSADMIN 命令创建通道,但是当我尝试使用对等节点加入通道时,出现错误:error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context...... .

这是来自终端(本地主机)的日志:

2021-06-01 06:38:54.509 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216 
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /etc/hyperledger/clipod/configtx/configtx.yaml
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 006 Creating application channel genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
cli-dd4cc5fbf-pdcgb
Status: 201
{
    "name": "commonchannel",
    "url": "/participation/v1/channels/commonchannel",
    "consensusRelation": "consenter",
    "status": "active",
    "height": 1
}
cli-dd4cc5fbf-pdcgb
Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
Error: error getting endorser client for channel: endorser client failed to connect to peer-general:9051: failed to create new connection: context deadline exceeded
command terminated with exit code 1

这里要注意的一件事是我正在为所有 PODS.

使用 Kubernetes 和服务 CLUSTER_IP

这里是来自 PEER POD 之一的日志(其他也一样)

2021-06-01 06:38:42.180 UTC [nodeCmd] registerDiscoveryService -> INFO 01b Discovery service activated
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01c Starting peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.180 UTC [nodeCmd] func6 -> INFO 01d Starting profiling server with listenAddress = 0.0.0.0:6060
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.181 UTC [kvledger] LoadPreResetHeight -> INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2021-06-01 06:38:42.181 UTC [blkstorage] preResetHtFiles -> INFO 020 No active channels passed
2021-06-01 06:38:56.006 UTC [core.comm] ServerHandshake -> ERRO 021 Server TLS handshake failed in 24.669µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:13258
2021-06-01 06:38:57.007 UTC [core.comm] ServerHandshake -> ERRO 022 Server TLS handshake failed in 17.772µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:29568
2021-06-01 06:38:58.903 UTC [core.comm] ServerHandshake -> ERRO 023 Server TLS handshake failed in 13.581µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:32615

为了解决这个问题,我尝试通过将 CORE_PEER_TLS_ENABLED 设置为 FALSE

来禁用 TLS

然后提案被提交,但排序者 POD 抛出相同的错误 TLS handshake failed.........

这是我用来从 cli pod 加入频道的命令:

kubectl -n hyperledger -it exec $CLI_POD -- sh -c "export FABRIC_CFG_PATH=/etc/hyperledger/clipod/config && export CORE_PEER_LOCALMSPID=GeneralMSP && export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/peers/peer0.general.example.com/tls/ca.crt && export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/users/Admin@general.example.com/msp && export CORE_PEER_ADDRESS=peer-general:9051 && peer channel join -b /etc/hyperledger/clipod/channel-artifacts/$CHANNEL_NAME.block -o orderer:7050 --tls --cafile /etc/hyperledger/clipod/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"

我被困在这个问题上,任何帮助将不胜感激。 谢谢

我已经修好了。我遇到的问题是因为没有为 CLI pod 设置 CORE_PEER_TLS_ENABLED = true

我从整个模型中学到的一件事是,每当您看到 TLS 问题时,首先要检查的是检查 CORE_PEER_TLS_ENABLED 变量。确保您已为所有 pods 或您尝试与之交互的容器设置它。根据您的部署,案例可以是假的(没有 TLS)或真(使用 TLS)。 其他要记住的事情是使用正确的结构变量,包括 FABRIC_CFG_PATHCORE_PEER_LOCALMSPIDCORE_PEER_TLS_ROOTCERT_FILECORE_PEER_MSPCONFIGPATH 和其他一些取决于您的命令。