hyperledger fabric fabcar错误

时间:2017-08-06 08:29:25

标签: blockchain hyperledger hyperledger-fabric

我尝试从hyperledger-fabric教程https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html运行fabcar示例。

当我运行./startFabric.sh时出现错误:

    //Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b mychannel.block
2017-08-06 08:05:59.338 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-06 08:05:59.338 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-06 08:05:59.339 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
2017-08-06 08:06:00.341 UTC [grpc] Printf -> DEBU 004 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
2017-08-06 08:06:02.045 UTC [grpc] Printf -> DEBU 005 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
*Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer*
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint
  -v, --version                    Display current version of fabric peer server

当我键入&#39; docker ps&#39;它显示:

CONTAINER ID        IMAGE                                     COMMAND                  CREATED             STATUS              PORTS                                        NAMES
f1b62c64395c        hyperledger/fabric-orderer:x86_64-1.0.0   "orderer"                34 minutes ago      Up 34 minutes       0.0.0.0:7050->7050/tcp                       orderer.example.com
4ad55e4adab7        hyperledger/fabric-ca:x86_64-1.0.0        "sh -c 'fabric-ca-..."   34 minutes ago      Up 34 minutes       0.0.0.0:7054->7054/tcp                       ca.example.com
0d785602a2c8        hyperledger/fabric-couchdb:x86_64-1.0.0   "tini -- /docker-e..."   34 minutes ago      Up 34 minutes       4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb

我使用peer0中的端口检查:$ docker ps -a | grep peer0

d2babceff4b9        hyperledger/fabric-peer:x86_64-1.0.0      "peer node start"        About an hour ago   Exited (2) About an hour ago                                                  peer0.org1.example.com
d327030ceb88        dev-peer0.org1.example.com-fabcar-1.0     "chaincode -peer.a..."   10 days ago         Exited (2) 10 days ago                                                        dev-peer0.org1.example.com-fabcar-1.0
c5a8910b63cd        dev-peer0.org1.example.com-mycc-1.0       "chaincode -peer.a..."   2 weeks ago         Exited (2) 2 weeks ago                                                        dev-peer0.org1.example.com-mycc-1.0
26bf51834f7c        dev-peer0.org2.example.com-mycc-1.0       "chaincode -peer.a..."   2 weeks ago         Exited (2) 2 weeks ago                                                        dev-peer0.org2.example.com-mycc-1.0
83f46b5b696b        hyperledger/fabric-peer                   "peer node start"        2 weeks ago         Exited (0) 2 weeks ago                                                        peer0.org2.example.com

然后,我检查每个容器中的日志:

$docker logs d2babceff4b9 | tail -20

2017-08-06 08:05:48.428 UTC [nodeCmd] serve -> INFO 001 Starting peer:
 Version: 1.0.0
 Go version: go1.7.5
 OS/Arch: linux/amd64
 Chaincode:
  Base Image Version: 0.3.1
  Base Docker Namespace: hyperledger
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger

2017-08-06 08:05:48.428 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2017-08-06 08:05:48.428 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2017-08-06 08:05:48.428 UTC [kvledger.util] CreateDirIfMissing -> DEBU 004 CreateDirIfMissing [/var/hyperledger/production/ledgersData/ledgerProvider/]
2017-08-06 08:05:48.428 UTC [kvledger.util] logDirStatus -> DEBU 005 Before creating dir - [/var/hyperledger/production/ledgersData/ledgerProvider/] does not exist
2017-08-06 08:05:48.428 UTC [kvledger.util] logDirStatus -> DEBU 006 After creating dir - [/var/hyperledger/production/ledgersData/ledgerProvider/] exists
2017-08-06 08:05:48.535 UTC [kvledger.util] CreateDirIfMissing -> DEBU 007 CreateDirIfMissing [/var/hyperledger/production/ledgersData/chains/index/]
2017-08-06 08:05:48.535 UTC [kvledger.util] logDirStatus -> DEBU 008 Before creating dir - [/var/hyperledger/production/ledgersData/chains/index/] does not exist
2017-08-06 08:05:48.559 UTC [kvledger.util] logDirStatus -> DEBU 009 After creating dir - [/var/hyperledger/production/ledgersData/chains/index/] exists
2017-08-06 08:05:48.617 UTC [kvledger] NewProvider -> DEBU 00a Constructing CouchDB VersionedDBProvider
2017-08-06 08:05:48.618 UTC [statecouchdb] NewVersionedDBProvider -> DEBU 00b constructing CouchDB VersionedDBProvider
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00c Entering CreateConnectionDefinition()
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00d Created database configuration  URL=[http://couchdb:5984]
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00e Exiting CreateConnectionDefinition()
2017-08-06 08:05:48.619 UTC [couchdb] VerifyCouchConfig -> DEBU 00f Entering VerifyCouchConfig()
2017-08-06 08:05:48.619 UTC [couchdb] handleRequest -> DEBU 010 Entering handleRequest()  method=GET  url=http://couchdb:5984/
2017-08-06 08:05:48.632 UTC [couchdb] handleRequest -> DEBU 011 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:06:23.633 UTC [couchdb] handleRequest -> WARN 012 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:06:23.758 UTC [couchdb] handleRequest -> DEBU 013 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:06:58.759 UTC [couchdb] handleRequest -> WARN 014 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:06:59.010 UTC [couchdb] handleRequest -> DEBU 015 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:07:34.010 UTC [couchdb] handleRequest -> WARN 016 Retrying couchdb request in 500ms. Attempt:3  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:07:34.511 UTC [couchdb] handleRequest -> DEBU 017 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:08:09.512 UTC [couchdb] handleRequest -> WARN 018 Retrying couchdb request in 1s. Attempt:4  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:08:10.513 UTC [couchdb] handleRequest -> DEBU 019 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:08:45.513 UTC [couchdb] handleRequest -> WARN 01a Retrying couchdb request in 2s. Attempt:5  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:08:47.514 UTC [couchdb] handleRequest -> DEBU 01b HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:09:22.515 UTC [couchdb] handleRequest -> WARN 01c Retrying couchdb request in 4s. Attempt:6  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:09:26.516 UTC [couchdb] handleRequest -> DEBU 01d HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:10:01.517 UTC [couchdb] handleRequest -> WARN 01e Retrying couchdb request in 8s. Attempt:7  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:10:09.518 UTC [couchdb] handleRequest -> DEBU 01f HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:10:44.518 UTC [couchdb] handleRequest -> WARN 020 Retrying couchdb request in 16s. Attempt:8  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:11:00.519 UTC [couchdb] handleRequest -> DEBU 021 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:11:35.520 UTC [couchdb] handleRequest -> WARN 022 Retrying couchdb request in 32s. Attempt:9  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:12:07.521 UTC [couchdb] handleRequest -> DEBU 023 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:12:42.522 UTC [couchdb] handleRequest -> WARN 024 Retrying couchdb request in 1m4s. Attempt:10  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:13:46.522 UTC [couchdb] VerifyCouchConfig -> DEBU 025 Exiting VerifyCouchConfig()
panic: Error in instantiating ledger provider: Unable to connect to CouchDB, check the hostname and port: Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
panic(0xc917e0, 0xc42025a2c0)
    /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/core/ledger/ledgermgmt.initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:61 +0x2fe
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize.func1()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:49 +0x14
sync.(*Once).Do(0x143e768, 0xe291b0)
    /opt/go/src/sync/once.go:44 +0xdb
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:50 +0x39
github.com/hyperledger/fabric/peer/node.serve(0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:88 +0x113
github.com/hyperledger/fabric/peer/node.glob..func1(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:75 +0x3f
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x13e5260, 0x143e6a8)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x13e58c0, 0xf, 0xc420012035, 0x7)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x13e58c0, 0x1a, 0xc420012035)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
    /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 +0x54e

docker logs d327030ceb88 |尾部-20

2017-07-27 02:46:32.714 UTC [bccsp] initBCCSP -> DEBU 001 Initialize BCCSP [SW]
i is  0
Added {Toyota Prius blue Tomoko}
i is  1
Added {Ford Mustang red Brad}
i is  2
Added {Hyundai Tucson green Jin Soo}
i is  3
Added {Volkswagen Passat yellow Max}
i is  4
Added {Tesla S black Adriana}
i is  5
Added {Peugeot 205 purple Michel}
i is  6
Added {Chery S22L white Aarav}
i is  7
Added {Fiat Punto violet Pari}
i is  8
Added {Tata Nano indigo Valeria}
i is  9
Added {Holden Barina brown Shotaro}

docker logs c5a8910b63cd |尾部-20

ex02 Invoke
Query Response:{"Name":"a","Amount":"100"}
ex02 Invoke
Aval = 90, Bval = 210

docker logs 83f46b5b696b |尾部-20

2017-07-20 16:29:50.083 UTC [cauthdsl] func2 -> ERRO 1cc9 Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.749 UTC [cauthdsl] func2 -> ERRO 1cca Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.750 UTC [cauthdsl] func2 -> ERRO 1ccb Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:52.377 UTC [nodeCmd] func3 -> DEBU 1ccc sig: terminated
2017-07-20 16:29:52.377 UTC [fsblkstorage] Shutdown -> DEBU 1ccd closing fs blockStore:myfirst
2017-07-20 16:29:52.377 UTC [main] main -> INFO 1cce Exiting.....

当我添加

depends_on:
  - orderer.example.com
  - couchdb # <--- Add this line 

似乎解决了一个错误。但还有其他错误。

当我执行$ log d54cd21b93f8 |尾部-20(d54cd21b93f8是第一个Container),它返回:

2017-08-06 09:49:38.107 UTC [couchdb] handleRequest -> WARN 012 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 09:49:38.232 UTC [couchdb] handleRequest -> DEBU 013 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 09:50:13.233 UTC [couchdb] handleRequest -> WARN 014 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 09:50:13.484 UTC [couchdb] handleRequest -> DEBU 015 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 

docker logs 83f46b5b696b |尾部-20

2017-07-20 16:29:50.083 UTC [cauthdsl] func2 -> ERRO 1cc9 Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.749 UTC [cauthdsl] func2 -> ERRO 1cca Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.750 UTC [cauthdsl] func2 -> ERRO 1ccb Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a

谁能告诉我为什么?

2 个答案:

答案 0 :(得分:2)

根据您在问题中发布的信息,出现错误的原因:

*Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer*
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded

主要是由于对等容器已关闭,因此peer cli无法达到支持对等方因此失败。现在它失败的原因,因为它无法到达couchdb:

panic: Error in instantiating ledger provider: Unable to connect to CouchDB, check the hostname and port: Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
panic(0xc917e0, 0xc42025a2c0)
    /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/core/ledger/ledgermgmt.initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:61 +0x2fe
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize.func1()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:49 +0x14
sync.(*Once).Do(0x143e768, 0xe291b0)
    /opt/go/src/sync/once.go:44 +0xdb
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:50 +0x39
github.com/hyperledger/fabric/peer/node.serve(0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:88 +0x113
github.com/hyperledger/fabric/peer/node.glob..func1(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:75 +0x3f
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x13e5260, 0x143e6a8)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x13e58c0, 0xf, 0xc420012035, 0x7)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x13e58c0, 0x1a, 0xc420012035)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
    /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 +0x54

通过查看basic-network文件夹中的docker-compose文件,似乎对等容器的启动不依赖于couchdb容器:

  peer0.org1.example.com:
    container_name: peer0.org1.example.com
    image: hyperledger/fabric-peer:x86_64-1.0.0
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.org1.example.com
      - CORE_LOGGING_PEER=debug
      - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      # # the following setting starts chaincode containers on the same
      # # bridge network as the peers
      # # https://docs.docker.com/compose/networking/
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: peer node start
    # command: peer node start --peer-chaincodedev=true
    ports:
      - 7051:7051
      - 7053:7053
    volumes:
        - /var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/msp/peer
        - ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
        - ./config:/etc/hyperledger/configtx
    depends_on:
      - orderer.example.com
    networks:
      - basic

修复应该相当简单,只需添加依赖项以确保在运行对等容器时couchdb可用:

depends_on:
  - orderer.example.com
  - couchdb # <--- Add this line 

答案 1 :(得分:0)

唯一对我有用的解决方案是增加睡眠时间以启动面料。请按照以下步骤操作

  1. 在启动结构之前删除所有Hyperledger docker映像(startFabric.sh将再次下载最新的映像)。

    要删除所有容器,包括其使用的卷,

    docker rmi -f $(docker images -a -q)
    

    要删除所有图像,

    01: java-lava:~ cafedude$ jshell
    02: |  Welcome to JShell -- Version 11
    03: |  For an introduction type: /help intro
    04: 
    05: jshell> Integer a;
    06: a ==> null
    07: |  created variable a : Integer
    08: 
    09: jshell> a instanceof Integer;
    10: $2 ==> false
    11: |  created scratch variable $2 : boolean
    12: 
    13: jshell> a = 1;
    14: a ==> 1
    15: |  assigned to a : Integer
    16: 
    17: jshell> a instanceof Integer;
    18: $4 ==> true
    19: |  created scratch variable $4 : boolean
    20: 
    21: jshell> a = null;
    22: a ==> null
    23: |  assigned to a : Integer
    24: 
    25: jshell> a instanceof Integer;
    26: $6 ==> false
    27: |  created scratch variable $6 : boolean
    28: 
    29: jshell> a = 1;
    30: a ==> 1
    31: |  assigned to a : Integer
    32: 
    33: jshell> Integer a;
    34: a ==> null
    35: |  modified variable a : Integer
    36: |    update overwrote variable a : Integer
    37: 
    38: jshell> a instanceof Integer;
    39: $9 ==> true
    40: |  created scratch variable $9 : boolean
    
  2. 打开basic-network / start.sh

  3. 设为FABRIC_START_TIMEOUT = 90(默认值为10)
  4. ./ startFabric.sh