问题
I've been experimenting with Hyperledger Fabric, deployed over 2 VirtualBox Ubuntu images with docker swarm. But I have some issues when it comes to the Composer installation.
Network Setup:
Host1: Orderer, Peer1.Org1, Peer2.Org1, CLI
Host2: Peer1.Org2, Peer2.Org2
When it comes to the Fabric setup everything appears to be ok. I'm able to start the network, join the peers from the second host, and update the anchor peers (one for each organisation).
The Composer installation starts with creating and importing the business network card and then installing the .bna file onto the network.
The issues appear when I try to start the network:
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: failed to execute transaction 14f90ad938da64fbbdb2923b07f4985251391937fc3fdc8bab19c2d13135ecd3: error starting container: error starting container: API error (500): Could not attach to network net_example: rpc error: code = NotFound desc = network net_example not found
Response from attempted peer comms was an error: Error: failed to execute transaction 14f90ad938da64fbbdb2923b07f4985251391937fc3fdc8bab19c2d13135ecd3: error starting container: error starting container: API error (500): Could not attach to network net_example: rpc error: code = NotFound desc = network net_example not found
Response from attempted peer comms was an error: Error: Failed to connect before the deadline
Response from attempted peer comms was an error: Error: Failed to connect before the deadline
When I inspect the first peer from org1, I'm seeing the following error:
2018-09-24 13:46:44.665 UTC [lscc] executeInstall -> INFO 03c Installed Chaincode [example-network] Version [0.0.1] to peer
2018-09-24 13:46:46.993 UTC [dockercontroller] Start -> ERRO 03d start-could not start container: API error (500): Could not attach to network net_example: rpc error: code = NotFound desc = network net_example not found
2018-09-24 13:46:47.008 UTC [chaincode] Launch -> ERRO 03e start failed: API error (500): Could not attach to network net_example: rpc error: code = NotFound desc = network net_example not found
error starting container
error starting container
2018-09-24 13:46:47.008 UTC [endorser] SimulateProposal -> ERRO 03f [mychannel][14f90ad9] failed to invoke chaincode name:"lscc" , error: API error (500): Could not attach to network net_example: rpc error: code = NotFound desc = network net_example not found
error starting container
error starting container
failed to execute transaction 14f90ad938da64fbbdb2923b07f4985251391937fc3fdc8bab19c2d13135ecd3
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:181
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:131
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2361
2018-09-24 13:46:51.770 UTC [lscc] Invoke -> ERRO 040 error getting chaincode example-network on channel [mychannel]: could not find chaincode with name 'example-network'
This is my connectionProfile.json:
{
"name": "example-network",
"x-type": "hlfv1",
"version": "1.0.0",
"channels": {
"mychannel": {
"orderers": [
"orderer.example.com"
],
"peers": {
"peer0.manager.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer1.manager.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer0.sponsor.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer1.sponsor.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
}
}
}
},
"organizations": {
"Manager": {
"mspid": "ManagerMSP",
"peers": [
"peer0.manager.example.com",
"peer1.manager.example.com"
],
"certificateAuthorities": [
"ca.manager.example.com"
]
},
"Sponsor": {
"mspid": "SponsorMSP",
"peers": [
"peer0.sponsor.example.com",
"peer1.sponsor.example.com"
],
"certificateAuthorities": [
"ca.sponsor.example.com"
]
}
},
"orderers": {
"orderer.example.com": {
"url": "grpcs://localhost:7050",
"grpcOptions": {
"ssl-target-name-override": "orderer.example.com"
},
"tlsCACerts": {
"pem": "INSERT_ORDERER_CA_CERT"
}
}
},
"peers": {
"peer0.manager.example.com": {
"url": "grpcs://localhost:7051",
"eventUrl": "grpcs://localhost:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.manager.example.com"
},
"tlsCACerts": {
"pem": "INSERT_MANAGER_CA_CERT"
}
},
"peer1.manager.example.com": {
"url": "grpcs://localhost:8051",
"eventUrl": "grpcs://localhost:8053",
"grpcOptions": {
"ssl-target-name-override": "peer1.manager.example.com"
},
"tlsCACerts": {
"pem": "INSERT_MANAGER_CA_CERT"
}
},
"peer0.sponsor.example.com": {
"url": "grpcs://10.0.0.113:9051",
"eventUrl": "grpcs://10.0.0.113:9053",
"grpcOptions": {
"ssl-target-name-override": "peer0.sponsor.example.com"
},
"tlsCACerts": {
"pem": "INSERT_SPONSOR_CA_CERT"
}
},
"peer1.sponsor.example.com": {
"url": "grpcs://10.0.0.112:10051",
"eventUrl": "grpcs://10.0.0.112:10053",
"grpcOptions": {
"ssl-target-name-override": "peer1.sponsor.example.com"
},
"tlsCACerts": {
"pem": "INSERT_SPONSOR_CA_CERT"
}
}
},
"certificateAuthorities": {
"ca.manager.example.com": {
"url": "https://localhost:7054",
"caName": "ca-manager",
"httpOptions": {
"verify": false
}
},
"ca.sponsor.example.com": {
"url": "https://10.0.0.111:8054",
"caName": "ca-sponsor",
"httpOptions": {
"verify": false
}
}
}
}
Does anybody know what I could try next?
回答1:
The composer network start
command is attempting to start a 'chaincode' container for each of the peers, and from error you show, there are 2 of your peers that cannot start these new container.
The error looks like a Docker error - the containers cannot be started on a network bridge called "net_example". I would guess that you have an environment variable defined in one of your docker-compose-xxx.yaml
files that defines this variable: CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE
which determines which network bridge the new containers are attached to.
You will need to determine which network bridge our other Fabric containers are using, then set this variable in the .yaml to that bridge.
This previous post has some discussion on multi-host fabric.
回答2:
I dont think you need Docker Swarm for multi host Fabric setup. I tried this tool from Altoros for easy setup of multi host Fabric. it did work with Fabric 1.1. For 1.2 it did not work - i think it requires some changes.
https://www.altoros.com/blog/deploying-a-multi-node-hyperledger-fabric-network-in-5-steps/
There is another tool from Debut Infotech. you can try this too. https://www.fabricdeployer.com/
Early on i tried setting up with Docker Swarm using the link below. it worked. https://medium.com/@wahabjawed/hyperledger-fabric-on-multiple-hosts-a33b08ef24f
来源:https://stackoverflow.com/questions/52481476/hyperledger-composer-multi-host-installation