首页 文章

Hyperledger Composer - 多主机安装

提问于
浏览
0

我一直在尝试使用Hyperledger Fabric,使用docker swarm部署2个VirtualBox Ubuntu映像 . 但是在Composer安装方面我遇到了一些问题 .

网络设置:

Host1:Orderer,Peer1.Org1,Peer2.Org1,CLI

Host2:Peer1.Org2,Peer2.Org2

在Fabric设置方面,一切似乎都没问题 . 我能够启动网络,加入来自第二个主机的对等体,并更新锚点对等体(每个组织一个) .

Composer安装从创建和导入业务网卡开始,然后将.bna文件安装到网络上 .

我尝试启动网络时出现问题:

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

当我从org1检查第一个对等体时,我看到以下错误:

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'

这是我的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
            }
        }
    }
}

有人知道我接下来会尝试什么吗?

2 回答

  • 0

    composer network start 命令正在尝试为每个对等方启动一个'chaincode'容器,并且从您显示的错误中,有两个对等方无法启动这些新容器 .

    该错误看起来像Docker错误 - 无法在名为"net_example"的网桥上启动容器 . 我猜你在一个定义了这个变量的 docker-compose-xxx.yaml 文件中定义了一个环境变量: CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE 它决定了新容器连接到哪个网桥 .

    您需要确定我们的其他Fabric容器正在使用哪个网桥,然后将.yaml中的此变量设置为该网桥 .

    这个previous post对多主机结构进行了一些讨论 .

  • 0

    我不认为你需要Docker Swarm来进行多主机Fabric设置 . 我尝试使用Altoros的这个工具来轻松设置多主机Fabric . 它确实与Fabric 1.1一起使用 . 对于1.2它没有用 - 我认为它需要一些改变 .

    https://www.altoros.com/blog/deploying-a-multi-node-hyperledger-fabric-network-in-5-steps/

    Debut Infotech还有另一款工具 . 你也可以尝试一下 . https://www.fabricdeployer.com/

    早期我尝试使用下面的链接设置Docker Swarm . 有效 . https://medium.com/@wahabjawed/hyperledger-fabric-on-multiple-hosts-a33b08ef24f

相关问题