Hyperledger Composer多主机设置-执行ping时出错

时间:2018-10-03 11:48:14

标签: docker hyperledger-fabric docker-swarm hyperledger-composer

我一直在与Hyperledger Fabric和Composer一起尝试将其部署在两个虚拟机上。我的工作基于Composer multi-org tutorial,只是扩展了两台计算机。

网络设置:

Host1:订购者,Peer1.Org1,Peer2.Org1,CLI

主机2:Peer1.Org2,Peer2.Org2

织物-可行的方法:

  • 同位体已启动并正在运行;
  • 他们能够加入该频道;
  • 主播对等已更新;
  • 作为测试,我已经将大理石链代码安装到所有对等方,并且能够成功查询;

作曲家-可行的方法:

  • 两个组织都有2个连接配置文件;

  • 我可以在两台主机上都安装.bna且没有任何错误;

  • 我可以启动网络;

  • 我可以创建卡并将其导入到两台主机上;

当我尝试ping任何主机时出现问题:

当我在主机1 上ping网络时:

Error: Error trying invoke business network. Error: Peer localhost:8051 has rejected transaction '1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346' with code ENDORSEMENT_POLICY_FAILURE

当我在主机2 上ping网络时:

Error: Error trying to ping. Error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '74d166962b282e9f04b17f6d7a8856a1565a257b310aceed5845831b15a710a4', has not been registered

这些是主机1-peer0 的日志:

2018-10-03 11:18:46.704 UTC [lscc] executeInstall -> INFO 03c Installed Chaincode [proa-network] Version [0.0.1] to peer
2018-10-03 11:19:31.081 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 03d Created state database mychannel_proa-network
2018-10-03 11:19:34.521 UTC [cceventmgmt] HandleStateUpdates -> INFO 03e Channel [mychannel]: Handling LSCC state update for chaincode [proa-network]
2018-10-03 11:19:34.546 UTC [couchdb] CreateIndex -> INFO 03f Created CouchDB index [selectClaimsByService] in state database [mychannel_proa-network] using design document [_design/selectClaimsByServiceDoc]
2018-10-03 11:19:34.549 UTC [couchdb] CreateIndex -> INFO 040 Created CouchDB index [selectInvoicesByPolicy] in state database [mychannel_proa-network] using design document [_design/selectInvoicesByPolicyDoc]
2018-10-03 11:19:34.551 UTC [couchdb] CreateIndex -> INFO 041 Created CouchDB index [selectPoliciesByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByEvaluatorDoc]
2018-10-03 11:19:34.554 UTC [couchdb] CreateIndex -> INFO 042 Created CouchDB index [selectPoliciesByInsurer] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByInsurerDoc]
2018-10-03 11:19:34.557 UTC [couchdb] CreateIndex -> INFO 043 Created CouchDB index [selectPoliciesBySponsor] in state database [mychannel_proa-network] using design document [_design/selectPoliciesBySponsorDoc]
2018-10-03 11:19:34.560 UTC [couchdb] CreateIndex -> INFO 044 Created CouchDB index [selectProductsByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectProductsByEvaluatorDoc]
2018-10-03 11:19:34.564 UTC [couchdb] CreateIndex -> INFO 045 Created CouchDB index [selectProductsByInsurer] in state database [mychannel_proa-network] using design document [_design/selectProductsByInsurerDoc]
2018-10-03 11:19:34.565 UTC [couchdb] CreateIndex -> INFO 046 Created CouchDB index [selectProductsBySponsor] in state database [mychannel_proa-network] using design document [_design/selectProductsBySponsorDoc]
2018-10-03 11:19:34.576 UTC [kvledger] CommitWithPvtData -> INFO 047 Channel [mychannel]: Committed block [3] with 1 transaction(s)
2018-10-03 11:19:36.964 UTC [endorser] SimulateProposal -> ERRO 048 [mychannel][d2dade2d] failed to invoke chaincode name:"proa-network" , error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '09a1e3cfc2f2d4d297653b30151c9bf0fd8356b324199780fda49c10536551d2', must be activated (ACTIVATION_REQUIRED)
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:141
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:136
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-10-03 11:19:42.026 UTC [vscc] Validate -> WARN 049 Endorsement policy failure for transaction txid=1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346, err: signature set did not satisfy policy
2018-10-03 11:19:42.026 UTC [committer/txvalidator] validateTx -> ERRO 04a VSCCValidateTx for transaction txId = 1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
2018-10-03 11:19:42.026 UTC [valimpl] preprocessProtoBlock -> WARN 04b Channel [mychannel]: Block [4] Transaction index [0] TxId [1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
2018-10-03 11:19:42.067 UTC [kvledger] CommitWithPvtData -> INFO 04c Channel [mychannel]: Committed block [4] with 1 transaction(s)

更新:endorsement-policy.json

{
    "identities": [
        {
            "role": {
                "name": "member",
                "mspId": "ManagerMSP"
            }
        },
        {
            "role": {
                "name": "member",
                "mspId": "SponsorMSP"
            }
        }
    ],
    "policy": {
        "2-of": [
            {
                "signed-by": 0
            },
            {
                "signed-by": 1
            }
        ]
    }
}

composer network install --card PeerAdmin@exManager --archiveFile ex-network@0.0.1.bna
cp endorsement-policy.json  /tmp/composer/endorsement-policy.json

    echo "Retrieving business network administrator certificates for Manager"
    composer identity request -c PeerAdmin@exManager -u admin -s adminpw -d andreim

    #-------------------
    #-- START NETWORK
    #-------------------

    echo "Starting the business network"
    composer network start -c PeerAdmin@exManager -n ex-network -V 0.0.1 -o endorsementPolicyFile=/tmp/composer/endorsement-policy.json -A andreim -C andreim/admin-pub.pem

我要说明的另一点是,在网络启动后,主机1 上出现了2个容器(可能是链码),但在主机2 上没有出现。 (一次例外是,peer0的容器几乎随机出现在主机2 上,而没有任何代码更改。)

更新2:来自主机2的peer0日志

.....
2018-10-03 11:15:21.109 UTC [lscc] executeInstall -> INFO 03c Installed Chaincode [proa-network] Version [0.0.1] to peer
2018-10-03 11:18:24.190 UTC [endorser] ProcessProposal -> ERRO 03d [][1bec8b15] simulateProposal() resulted in chaincode name:"lscc"  response status 500 for txid: 1bec8b15b953df0f5e00213916cb092219f949800a0f249ea5f8ef90fcc7eb06
2018-10-03 11:19:34.545 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 03e Created state database mychannel_proa-network
2018-10-03 11:19:34.556 UTC [cceventmgmt] HandleStateUpdates -> INFO 03f Channel [mychannel]: Handling LSCC state update for chaincode [proa-network]
2018-10-03 11:19:34.587 UTC [couchdb] CreateIndex -> INFO 040 Created CouchDB index [selectClaimsByService] in state database [mychannel_proa-network] using design document [_design/selectClaimsByServiceDoc]
2018-10-03 11:19:34.589 UTC [couchdb] CreateIndex -> INFO 041 Created CouchDB index [selectInvoicesByPolicy] in state database [mychannel_proa-network] using design document [_design/selectInvoicesByPolicyDoc]
2018-10-03 11:19:34.593 UTC [couchdb] CreateIndex -> INFO 042 Created CouchDB index [selectPoliciesByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByEvaluatorDoc]
2018-10-03 11:19:34.595 UTC [couchdb] CreateIndex -> INFO 043 Created CouchDB index [selectPoliciesByInsurer] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByInsurerDoc]
2018-10-03 11:19:34.598 UTC [couchdb] CreateIndex -> INFO 044 Created CouchDB index [selectPoliciesBySponsor] in state database [mychannel_proa-network] using design document [_design/selectPoliciesBySponsorDoc]
2018-10-03 11:19:34.600 UTC [couchdb] CreateIndex -> INFO 045 Created CouchDB index [selectProductsByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectProductsByEvaluatorDoc]
2018-10-03 11:19:34.602 UTC [couchdb] CreateIndex -> INFO 046 Created CouchDB index [selectProductsByInsurer] in state database [mychannel_proa-network] using design document [_design/selectProductsByInsurerDoc]
2018-10-03 11:19:34.606 UTC [couchdb] CreateIndex -> INFO 047 Created CouchDB index [selectProductsBySponsor] in state database [mychannel_proa-network] using design document [_design/selectProductsBySponsorDoc]
2018-10-03 11:19:34.618 UTC [kvledger] CommitWithPvtData -> INFO 048 Channel [mychannel]: Committed block [3] with 1 transaction(s)
2018-10-03 11:19:42.027 UTC [vscc] Validate -> WARN 049 Endorsement policy failure for transaction txid=1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346, err: signature set did not satisfy policy
2018-10-03 11:19:42.027 UTC [committer/txvalidator] validateTx -> ERRO 04a VSCCValidateTx for transaction txId = 1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
2018-10-03 11:19:42.028 UTC [valimpl] preprocessProtoBlock -> WARN 04b Channel [mychannel]: Block [4] Transaction index [0] TxId [1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
2018-10-03 11:19:42.053 UTC [kvledger] CommitWithPvtData -> INFO 04c Channel [mychannel]: Committed block [4] with 1 transaction(s)
2018-10-03 11:42:02.836 UTC [endorser] SimulateProposal -> ERRO 04d [mychannel][f750d0c4] failed to invoke chaincode name:"proa-network" , error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '74d166962b282e9f04b17f6d7a8856a1565a257b310aceed5845831b15a710a4', has not been registered
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:141
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:136
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

1 个答案:

答案 0 :(得分:0)

您可以显示您的认可政策文件吗?以及使用它的命令,可能与您的策略有关。至少这就是错误所要解决的。