Hyper Fabric [fabric-sdk-go] Error: CONNECTION_FAILED. Description: dialing connection timed out
Hyper Fabric [fabric-sdk-go] Error: CONNECTION_FAILED. Description: dialing connection timed out
当我尝试创建请求(提案)并使用 Execute、
发送它时
ctxCh := sdk.ChannelContext("mychannel", fabsdk.WithUser("user1"))
chClient, err := channel.New(ctxCh)
if err != nil {
log.Fatalln("error from New channel", err)
}
req := channel.Request{
ChaincodeID: "fabcar",
Fcn: "createCar",
Args: [][]byte{[]byte("CAR10"), []byte("Honda"), []byte("Accord"), []byte("Black"), []byte("Tom")},
}
resp, err := chClient.Execute(req)
if err != nil {
log.Fatalln("error from Execute =", err)
}
我收到这个错误:
calling orderer 'orderer.example.com:7050' failed: Orderer Client
Status Code: (2) CONNECTION_FAILED. Description: dialing connection
timed out [orderer.example.com:7050]
我的config.yaml
channels:
# name of the channel
mychannel:
orderers:
- orderer.example.com
orderers:
orderer.example.com:
url: grpc://localhost:7050
# these are standard properties defined by the gRPC library
# they will be passed in as-is to gRPC client constructor
grpcOptions:
ssl-target-name-override: orderer.example.com
tlsCACerts:
# Certificate location absolute path
path: ./crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
我认为执行函数试图连接排序服务 'orderer.example.com:7050',但找不到它,
如果我是对的,那么如何将 orderer.example.com:7050 更改为 grpc://localhost:7050
来自 rocketchat,
解决这个问题添加到 config.yaml
entityMatchers:
orderer:
- pattern: (\w+).example.(\w+)
urlSubstitutionExp: grpc://localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com
将grpc://localhost:7050
映射到orderer.example.com
当我尝试创建请求(提案)并使用 Execute、
发送它时 ctxCh := sdk.ChannelContext("mychannel", fabsdk.WithUser("user1"))
chClient, err := channel.New(ctxCh)
if err != nil {
log.Fatalln("error from New channel", err)
}
req := channel.Request{
ChaincodeID: "fabcar",
Fcn: "createCar",
Args: [][]byte{[]byte("CAR10"), []byte("Honda"), []byte("Accord"), []byte("Black"), []byte("Tom")},
}
resp, err := chClient.Execute(req)
if err != nil {
log.Fatalln("error from Execute =", err)
}
我收到这个错误:
calling orderer 'orderer.example.com:7050' failed: Orderer Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [orderer.example.com:7050]
我的config.yaml
channels:
# name of the channel
mychannel:
orderers:
- orderer.example.com
orderers:
orderer.example.com:
url: grpc://localhost:7050
# these are standard properties defined by the gRPC library
# they will be passed in as-is to gRPC client constructor
grpcOptions:
ssl-target-name-override: orderer.example.com
tlsCACerts:
# Certificate location absolute path
path: ./crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
我认为执行函数试图连接排序服务 'orderer.example.com:7050',但找不到它, 如果我是对的,那么如何将 orderer.example.com:7050 更改为 grpc://localhost:7050
来自 rocketchat, 解决这个问题添加到 config.yaml
entityMatchers:
orderer:
- pattern: (\w+).example.(\w+)
urlSubstitutionExp: grpc://localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com
将grpc://localhost:7050
映射到orderer.example.com