无法连接尝试连接到本地对等时出错:超出了上下文期限

时间:2018-10-12 21:13:30

标签: docker hyperledger-fabric hyperledger

我正在尝试实例化多个对等方之间的链码,每个对等方都在各自的组织中。为了进行调试,我创建了一个频道testchannel,该频道只有一个组织overseer和一个同级peer0。我可以

  • 创建频道
  • 加入频道(当我使用peer channel list时,频道会出现在结果中)
  • 安装链码(当我使用peer chaincode list --installed时,链码会出现在结果中)

但是,当我使用peer chaincode instantiate -C testchannel -v v0 -n example --peerAddresses peer0.overseer.bloomberg.com:7051 -o orderer.bloomberg.com:7050 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('OverseerOrg.peer')"实例化链码时,会旋转一个新的链码容器,但由于无法到达对等点,因此会在几秒钟后退出。

我确保在实例化链码时,已设置了环境变量CORE_PEER_ADDRESS=peer0.overseer.example.com:7051

chaincode容器的日志为:

2018-10-12 20:44:56.797 UTC [shim] userChaincodeStreamGetter -> ERRO 001 

context deadline exceeded
error trying to connect to local peer
github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:111
github.com/hyperledger/fabric/core/chaincode/shim.Start
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:150
main.main
        /chaincode/input/src/example/example.go:195
runtime.main
        /opt/go/src/runtime/proc.go:198
runtime.goexit
        /opt/go/src/runtime/asm_amd64.s:2361
Error starting Simple chaincode: error trying to connect to local peer: context deadline exceeded

,运行链码的对等容器的日志为:

2018-10-12 20:26:02.507 UTC [viperutil] getKeysRecursively -> DEBU 001 Found map[string]interface{} value for peer.BCCSP
2018-10-12 20:26:02.507 UTC [viperutil] getKeysRecursively -> DEBU 002 Found map[string]interface{} value for peer.BCCSP.PKCS11
2018-10-12 20:26:02.508 UTC [viperutil] unmarshalJSON -> DEBU 003 Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.508 UTC [viperutil] getKeysRecursively -> DEBU 004 Found real value for peer.BCCSP.PKCS11.Pin setting to <nil> <nil>
2018-10-12 20:26:02.509 UTC [viperutil] unmarshalJSON -> DEBU 005 Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.509 UTC [viperutil] getKeysRecursively -> DEBU 006 Found real value for peer.BCCSP.PKCS11.Hash setting to <nil> <nil>
2018-10-12 20:26:02.509 UTC [viperutil] unmarshalJSON -> DEBU 007 Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.510 UTC [viperutil] getKeysRecursively -> DEBU 008 Found real value for peer.BCCSP.PKCS11.Security setting to <nil> <nil>
2018-10-12 20:26:02.510 UTC [viperutil] getKeysRecursively -> DEBU 009 Found map[string]interface{} value for peer.BCCSP.PKCS11.FileKeyStore
2018-10-12 20:26:02.511 UTC [viperutil] unmarshalJSON -> DEBU 00a Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.511 UTC [viperutil] getKeysRecursively -> DEBU 00b Found real value for peer.BCCSP.PKCS11.FileKeyStore.KeyStore setting to <nil> <nil>
2018-10-12 20:26:02.511 UTC [viperutil] unmarshalJSON -> DEBU 00c Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.512 UTC [viperutil] getKeysRecursively -> DEBU 00d Found real value for peer.BCCSP.PKCS11.Library setting to <nil> <nil>
2018-10-12 20:26:02.512 UTC [viperutil] unmarshalJSON -> DEBU 00e Unmarshal JSON: value is not a string: <nil>
2018-10-12 20:26:02.513 UTC [viperutil] getKeysRecursively -> DEBU 00f Found real value for peer.BCCSP.PKCS11.Label setting to <nil> <nil>
2018-10-12 20:26:02.513 UTC [viperutil] unmarshalJSON -> DEBU 010 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2018-10-12 20:26:02.513 UTC [viperutil] getKeysRecursively -> DEBU 011 Found real value for peer.BCCSP.Default setting to string SW
2018-10-12 20:26:02.514 UTC [viperutil] getKeysRecursively -> DEBU 012 Found map[string]interface{} value for peer.BCCSP.SW
2018-10-12 20:26:02.514 UTC [viperutil] getKeysRecursively -> DEBU 013 Found map[string]interface{} value for peer.BCCSP.SW.FileKeyStore
2018-10-12 20:26:02.514 UTC [viperutil] unmarshalJSON -> DEBU 014 Unmarshal JSON: value cannot be unmarshalled: unexpected end of JSON input
2018-10-12 20:26:02.514 UTC [viperutil] getKeysRecursively -> DEBU 015 Found real value for peer.BCCSP.SW.FileKeyStore.KeyStore setting to string
2018-10-12 20:26:02.515 UTC [viperutil] unmarshalJSON -> DEBU 016 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2018-10-12 20:26:02.515 UTC [viperutil] getKeysRecursively -> DEBU 017 Found real value for peer.BCCSP.SW.Hash setting to string SHA2
2018-10-12 20:26:02.515 UTC [viperutil] unmarshalJSON -> DEBU 018 Unmarshal JSON: value is not a string: 256
2018-10-12 20:26:02.515 UTC [viperutil] getKeysRecursively -> DEBU 019 Found real value for peer.BCCSP.SW.Security setting to int 256
2018-10-12 20:26:02.515 UTC [viperutil] EnhancedExactUnmarshalKey -> DEBU 01a map[peer.BCCSP:map[PKCS11:map[Hash:<nil> Security:<nil> FileKeyStore:map[KeyStore:<nil>] Library:<nil> Label:<nil> Pin:<nil>] Default:SW SW:map[Security:256 FileKeyStore:map[KeyStore:] Hash:SHA2]]]
2018-10-12 20:26:02.515 UTC [bccsp_sw] openKeyStore -> DEBU 01b KeyStore opened at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/keystore]...done
2018-10-12 20:26:02.516 UTC [bccsp] initBCCSP -> DEBU 01c Initialize BCCSP [SW]
2018-10-12 20:26:02.516 UTC [msp] getPemMaterialFromDir -> DEBU 01d Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/signcerts
2018-10-12 20:26:02.516 UTC [msp] getPemMaterialFromDir -> DEBU 01e Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/signcerts/Admin@overseer.example.com-cert.pem
2018-10-12 20:26:02.516 UTC [msp] getPemMaterialFromDir -> DEBU 01f Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/cacerts
2018-10-12 20:26:02.516 UTC [msp] getPemMaterialFromDir -> DEBU 020 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/cacerts/ca.overseer.example.com-cert.pem
2018-10-12 20:26:02.516 UTC [msp] getPemMaterialFromDir -> DEBU 021 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/admincerts
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 022 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/admincerts/Admin@overseer.example.com-cert.pem
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 023 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/intermediatecerts
2018-10-12 20:26:02.517 UTC [msp] getMspConfig -> DEBU 024 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/intermediatecerts: no such file or directory]
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 025 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/tlscacerts
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 026 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/tlscacerts/tlsca.overseer.example.com-cert.pem
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 027 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/tlsintermediatecerts
2018-10-12 20:26:02.517 UTC [msp] getMspConfig -> DEBU 028 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-10-12 20:26:02.517 UTC [msp] getPemMaterialFromDir -> DEBU 029 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/crls
2018-10-12 20:26:02.518 UTC [msp] getMspConfig -> DEBU 02a crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/crls: no such file or directory]
2018-10-12 20:26:02.518 UTC [msp] getMspConfig -> DEBU 02b MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/config.yaml: no such file or directory]
2018-10-12 20:26:02.518 UTC [msp] newBccspMsp -> DEBU 02c Creating BCCSP-based MSP instance
2018-10-12 20:26:02.518 UTC [msp] New -> DEBU 02d Creating Cache-MSP instance
2018-10-12 20:26:02.518 UTC [msp] loadLocaMSP -> DEBU 02e Created new local MSP
2018-10-12 20:26:02.519 UTC [msp] Setup -> DEBU 02f Setting up MSP instance overseer.example.com
2018-10-12 20:26:02.519 UTC [msp/identity] newIdentity -> DEBU 030 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICWzCCAgKgAwIBAgIRAP9PLdKfT0uv6gN4f+gaIsQwCgYIKoZIzj0EAwIwfzEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xHzAdBgNVBAoTFm92ZXJzZWVyLmJsb29tYmVyZy5jb20xIjAgBgNV
BAMTGWNhLm92ZXJzZWVyLmJsb29tYmVyZy5jb20wHhcNMTgxMDEyMjAxNjA4WhcN
MjgxMDA5MjAxNjA4WjB/MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5p
YTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEChMWb3ZlcnNlZXIuYmxv
b21iZXJnLmNvbTEiMCAGA1UEAxMZY2Eub3ZlcnNlZXIuYmxvb21iZXJnLmNvbTBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABExCn1W4t0a+Inu7E2Lk/atxsPsIaeAn
uKs4ahjstkDLJNyG7TDpAezgCNk9SisKWt8GCCHm0QMGPZp31e0ID1GjXzBdMA4G
A1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8w
KQYDVR0OBCIEIBJ+7r+y9kwB4PkMOnq4YNR+6viP54lY7ZgfDUgZIDhPMAoGCCqG
SM49BAMCA0cAMEQCIGoCkMDtE9ZcmDHYfY6w1yBvX8RVyGdC0ulKbyhfuN+7AiAo
n6ni5FN3d+qivZ79cZvjekd9QXY+2HmDQkKtiJbh9Q==
-----END CERTIFICATE-----
2018-10-12 20:26:02.520 UTC [msp/identity] newIdentity -> DEBU 031 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICOjCCAeKgAwIBAgIQTc89Dn6XlcZCM2EcDdD45jAKBggqhkjOPQQDAjB/MQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEfMB0GA1UEChMWb3ZlcnNlZXIuYmxvb21iZXJnLmNvbTEiMCAGA1UE
AxMZY2Eub3ZlcnNlZXIuYmxvb21iZXJnLmNvbTAeFw0xODEwMTIyMDE2MDhaFw0y
ODEwMDkyMDE2MDhaMHIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQLEwZjbGllbnQxJTAjBgNV
BAMMHEFkbWluQG92ZXJzZWVyLmJsb29tYmVyZy5jb20wWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAARUpVnJ2AjcsW2E6Jv+DWqnBgffASnPvz83RIVOCsz6xmzwMduZ
Gzq2xhNzZ3dIdJT/5gdOE24nItLpW7ot3E7vo00wSzAOBgNVHQ8BAf8EBAMCB4Aw
DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCASfu6/svZMAeD5DDp6uGDUfur4j+eJ
WO2YHw1IGSA4TzAKBggqhkjOPQQDAgNGADBDAiBkKQ+3t+F0TlL3NagEpo+p3SEd
QAmqJsJY5YCcnJtHEwIfS04ALkM+RGn7AWsbQ1wt5R4Jhg3IYKaBSLCy1GNImA==
-----END CERTIFICATE-----
2018-10-12 20:26:02.540 UTC [msp/identity] newIdentity -> DEBU 032 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICOjCCAeKgAwIBAgIQTc89Dn6XlcZCM2EcDdD45jAKBggqhkjOPQQDAjB/MQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEfMB0GA1UEChMWb3ZlcnNlZXIuYmxvb21iZXJnLmNvbTEiMCAGA1UE
AxMZY2Eub3ZlcnNlZXIuYmxvb21iZXJnLmNvbTAeFw0xODEwMTIyMDE2MDhaFw0y
ODEwMDkyMDE2MDhaMHIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQLEwZjbGllbnQxJTAjBgNV
BAMMHEFkbWluQG92ZXJzZWVyLmJsb29tYmVyZy5jb20wWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAARUpVnJ2AjcsW2E6Jv+DWqnBgffASnPvz83RIVOCsz6xmzwMduZ
Gzq2xhNzZ3dIdJT/5gdOE24nItLpW7ot3E7vo00wSzAOBgNVHQ8BAf8EBAMCB4Aw
DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCASfu6/svZMAeD5DDp6uGDUfur4j+eJ
WO2YHw1IGSA4TzAKBggqhkjOPQQDAgNGADBDAiBkKQ+3t+F0TlL3NagEpo+p3SEd
QAmqJsJY5YCcnJtHEwIfS04ALkM+RGn7AWsbQ1wt5R4Jhg3IYKaBSLCy1GNImA==
-----END CERTIFICATE-----
2018-10-12 20:26:02.541 UTC [bccsp_sw] loadPrivateKey -> DEBU 033 Loading private key [31a56a32cc8bb684d0b7de7fc25aa98510a8145ffc8d20de601611b21c5bae00] at [/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp/keystore/31a56a32cc8bb684d0b7de7fc25aa98510a8145ffc8d20de601611b21c5bae00_sk]...
2018-10-12 20:26:02.541 UTC [msp/identity] newIdentity -> DEBU 034 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICOjCCAeKgAwIBAgIQTc89Dn6XlcZCM2EcDdD45jAKBggqhkjOPQQDAjB/MQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEfMB0GA1UEChMWb3ZlcnNlZXIuYmxvb21iZXJnLmNvbTEiMCAGA1UE
AxMZY2Eub3ZlcnNlZXIuYmxvb21iZXJnLmNvbTAeFw0xODEwMTIyMDE2MDhaFw0y
ODEwMDkyMDE2MDhaMHIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ8wDQYDVQQLEwZjbGllbnQxJTAjBgNV
BAMMHEFkbWluQG92ZXJzZWVyLmJsb29tYmVyZy5jb20wWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAARUpVnJ2AjcsW2E6Jv+DWqnBgffASnPvz83RIVOCsz6xmzwMduZ
Gzq2xhNzZ3dIdJT/5gdOE24nItLpW7ot3E7vo00wSzAOBgNVHQ8BAf8EBAMCB4Aw
DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCASfu6/svZMAeD5DDp6uGDUfur4j+eJ
WO2YHw1IGSA4TzAKBggqhkjOPQQDAgNGADBDAiBkKQ+3t+F0TlL3NagEpo+p3SEd
QAmqJsJY5YCcnJtHEwIfS04ALkM+RGn7AWsbQ1wt5R4Jhg3IYKaBSLCy1GNImA==
-----END CERTIFICATE-----
2018-10-12 20:26:02.542 UTC [msp] setupSigningIdentity -> DEBU 035 Signing identity expires at 2028-10-09 20:16:08 +0000 UTC
2018-10-12 20:26:02.542 UTC [msp] Validate -> DEBU 036 MSP overseer.example.com validating identity
2018-10-12 20:26:02.543 UTC [grpc] Printf -> DEBU 037 parsed scheme: ""
2018-10-12 20:26:02.543 UTC [grpc] Printf -> DEBU 038 scheme "" not registered, fallback to default scheme
2018-10-12 20:26:02.544 UTC [grpc] Printf -> DEBU 039 ccResolverWrapper: sending new addresses to cc: [{peer0.overseer.example.com:7051 0  <nil>}]
2018-10-12 20:26:02.544 UTC [grpc] Printf -> DEBU 03a ClientConn switching balancer to "pick_first"
2018-10-12 20:26:02.544 UTC [grpc] Printf -> DEBU 03b pickfirstBalancer: HandleSubConnStateChange: 0xc4203b54b0, CONNECTING
2018-10-12 20:26:02.546 UTC [grpc] Printf -> DEBU 03c pickfirstBalancer: HandleSubConnStateChange: 0xc4203b54b0, READY
2018-10-12 20:26:02.547 UTC [grpc] Printf -> DEBU 03d parsed scheme: ""
2018-10-12 20:26:02.547 UTC [grpc] Printf -> DEBU 03e scheme "" not registered, fallback to default scheme
2018-10-12 20:26:02.547 UTC [grpc] Printf -> DEBU 03f ccResolverWrapper: sending new addresses to cc: [{peer0.overseer.example.com:7051 0  <nil>}]
2018-10-12 20:26:02.547 UTC [grpc] Printf -> DEBU 040 ClientConn switching balancer to "pick_first"
2018-10-12 20:26:02.547 UTC [grpc] Printf -> DEBU 041 pickfirstBalancer: HandleSubConnStateChange: 0xc4204424b0, CONNECTING
2018-10-12 20:26:02.548 UTC [grpc] Printf -> DEBU 042 pickfirstBalancer: HandleSubConnStateChange: 0xc4204424b0, READY
2018-10-12 20:26:02.549 UTC [msp] GetDefaultSigningIdentity -> DEBU 043 Obtaining default signing identity
2018-10-12 20:26:02.549 UTC [grpc] Printf -> DEBU 044 parsed scheme: ""
2018-10-12 20:26:02.549 UTC [grpc] Printf -> DEBU 045 scheme "" not registered, fallback to default scheme
2018-10-12 20:26:02.551 UTC [grpc] Printf -> DEBU 046 ccResolverWrapper: sending new addresses to cc: [{orderer.example.com:7050 0  <nil>}]
2018-10-12 20:26:02.551 UTC [grpc] Printf -> DEBU 047 ClientConn switching balancer to "pick_first"
2018-10-12 20:26:02.551 UTC [grpc] Printf -> DEBU 048 pickfirstBalancer: HandleSubConnStateChange: 0xc420442100, CONNECTING
2018-10-12 20:26:02.553 UTC [grpc] Printf -> DEBU 049 pickfirstBalancer: HandleSubConnStateChange: 0xc420442100, READY
2018-10-12 20:26:02.553 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 04a Using default escc
2018-10-12 20:26:02.554 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 04b Using default vscc
2018-10-12 20:26:02.554 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 04c java chaincode disabled
2018-10-12 20:26:02.555 UTC [msp/identity] Sign -> DEBU 04d Sign: plaintext: 0A89080A890108031A0C08DA8684DE05...1A000A000A04657363630A0476736363
2018-10-12 20:26:02.555 UTC [msp/identity] Sign -> DEBU 04e Sign: digest: 3187A3833B292152334734E4A96DA8132016D2E58E4A94C10B18538379261AD0
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg failed to execute transaction a52a3bf44cdaa48d862c57e66c32f51785bd4606f50a4b7b9cac7e9385061b5d: timeout expired while starting chaincode example:v0 for transaction a52a3bf44cdaa48d862c57e66c32f51785bd4606f50a4b7b9cac7e9385061b5d

这是我的docker-compose.yaml设置:

  peer0.overseer.example.com:
    container_name: peer0.overseer.example.com
    extends:
      file: ./configs/base.yaml
      service: peer-base
    environment:
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_ID=peer0.overseer.example.com
      - CORE_PEER_LOCALMSPID=overseer.example.com
      - CORE_PEER_ADDRESS=peer0.overseer.example.com:7051
      - CORE_PEER_CHAINCODELISTENADDRESS=peer0.overseer.example.com:7052
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    volumes:
        - ./channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com:/etc/hyperledger/crypto/peer
    depends_on:
      - orderer.example.com
    networks:
      - my_network

这是我用于创建频道的configtx.yaml

Organizations:
    - &OverseerOrg
        Name: OverseerOrg
        ID: overseer.example.com
        MSPDir: /opt/gopath/src/github.com/hyperledger/fabric/peer/channel/crypto-config/peerOrganizations/overseer.example.com/users/Admin@overseer.example.com/msp
        AnchorPeers:
            - Host: peer0.overseer.example.com
              Port: 7051
        Policies: &PoliciesDefaults
            Readers:
                Type: Signature
                Rule: "OR('overseer.example.com.member')"
            Writers:
                Type: Signature
                Rule: "OR('overseer.example.com.member')"
            Admins:
                Type: Signature
                Rule: "OR('overseer.example.com.admin')"

Profiles:
    TESTTRANSACTION:
        Consortium: InitialConsortium
        Application:
            Organizations:
                - *OverseerOrg

当我在对等容器中运行docker exec -it peer0.overseer.example.com bash并运行netstat --all时,我的结果是:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.11:33891        *:*                     LISTEN
tcp        0      0 51f03616cac7:7052       *:*                     LISTEN
tcp6       0      0 [::]:7051               [::]:*                  LISTEN
tcp6       0      0 [::]:7053               [::]:*                  LISTEN
udp        0      0 127.0.0.11:52356        *:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path

如何解决此问题或进一步调试问题所在?谢谢。

1 个答案:

答案 0 :(得分:2)

问题是因为在我的base.yaml文件中,我将环境变量CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE设置为已过时但仍然存在的docker网络(在我的情况下为artifacts_default),这就是为什么它没有在链码实例化中引发“网络不存在”错误。当我启动docker容器时,它会加入一个默认网络,该网络从撰写文件所在的目录派生而来,该默认网络与CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE环境变量设置的网络名称不匹配。