我试图在多主机环境中使用docker群设置第一个网络示例,首先使用以下配置:
新主机
2号旅社
我只是换了码头工人。yaml使其与swarm兼容(代码如下)。我无法将Host2/Org2对等点添加到频道。
按顺序执行以下步骤:
我一直得到下面的错误
2017-08-15 02:42:49.512 UTC[msp]GetDefaultSigningIdentity-
docker-compose-cli.yaml
订购者
version: '3'
networks:
overnet:
services:
orderer_example_com:
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
ports:
- 7050:7050
# - 7049:7049
networks:
- overnet
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
Org1同龄人
peer0_org1_example_com:
image: hyperledger/fabric-peer
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7053:7053
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# 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=overnet
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
networks:
- overnet
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
Org2同龄人
peer0_org2_example_com:
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# 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=overnet
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 9051:7051
- 9053:7053
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
networks:
- overnet
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == worker]
CLI
cli:
image: hyperledger/fabric-tools
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org4.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer_example_com
- peer0_org1_example_com
- peer1_org1_example_com
- peer0_org2_example_com
- peer1_org2_example_com
networks:
- overnet
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
crypto-config.yaml(没有对该文件进行任何更改,但在此附上以供参考)
OrdererOrgs:
# ------------------------------------------------------------------
# Orderer
# ------------------------------------------------------------------
- Name: Orderer
Domain: example.com
# ----------------------------------------------------------------
# "Specs" - See PeerOrgs below for complete description
# ----------------------------------------------------------------
Specs:
- Hostname: orderer
# --------------------------------------------------------------------
# "PeerOrgs" - Definition of organizations managing peer nodes
# --------------------------------------------------------------------
PeerOrgs:
# ------------------------------------------------------------------
# Org1
# ------------------------------------------------------------------
- Name: Org1
Domain: org1.example.com
# ----------------------------------------------------------------
# "Specs"
# ----------------------------------------------------------------
# Uncomment this section to enable the explicit definition of hosts in your
# configuration. Most users will want to use Template, below
#
# Specs is an array of Spec entries. Each Spec entry consists of two fields:
# - Hostname: (Required) The desired hostname, sans the domain.
# - CommonName: (Optional) Specifies the template or explicit override for
# the CN. By default, this is the template:
#
# "{{.Hostname}}.{{.Domain}}"
#
# which obtains its values from the Spec.Hostname and
# Org.Domain, respectively.
# ---------------------------------------------------------------------------
# Specs:
# - Hostname: foo # implicitly "foo.org2.example.com"
# CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
# - Hostname: bar
# - Hostname: baz
# ---------------------------------------------------------------------------
# "Template"
# ---------------------------------------------------------------------------
# Allows for the definition of 1 or more hosts that are created sequentially
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
# You may override the number of nodes (Count), the starting index (Start)
# or the template used to construct the name (Hostname).
#
# Note: Template and Specs are not mutually exclusive. You may define both
# sections and the aggregate nodes will be created for you. Take care with
# name collisions
# ---------------------------------------------------------------------------
Template:
Count: 2
# Start: 5
# Hostname: {{.Prefix}}{{.Index}} # default
# ---------------------------------------------------------------------------
# "Users"
# ---------------------------------------------------------------------------
# Count: The number of user accounts _in addition_ to Admin
# ---------------------------------------------------------------------------
Users:
Count: 1
# ------------------------------------------------------------------
# Org2: See "Org1" for full specification
# ------------------------------------------------------------------
- Name: Org2
Domain: org2.example.com
Template:
Count: 2
Users:
Count: 1
你必须使用Docker swarm来实现多主机Hyperledger结构区块链网络。请阅读以下URL中的步骤。
https://github.com/chudsonsolomon/Block-chain-Swarm-Multi-Host
我已经设置了fabric network的多主机设置。我的订购方和一个对等方在一台主机上,另一个对等方在第二台主机上。为此,我们需要在configtx中进行更改。订购方部分的yml文件:
Profiles:
CommonOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortiumJA:
Organizations:
- *test
- *mch
- *test2
- *test3
CommonOrgChannel:
Consortium: SampleConsortiumJA
Application:
<<: *ApplicationDefaults
Organizations:
- *test
- *mch
- *test2
- *test3
MJAOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortiumJA:
Organizations:
- *test
- *mch
- *test2
MJAOrgChannel:
Consortium: SampleConsortiumJA
Application:
<<: *ApplicationDefaults
Organizations:
- *test
- *mch
- *test2
MABOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortiumAB:
Organizations:
- *test2
- *mch
- *test3
MABOrgChannel:
Consortium: SampleConsortiumAB
Application:
<<: *ApplicationDefaults
Organizations:
- *test
- *mch
- *test3
MBJOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortiumBJ:
Organizations:
- *test3
- *mch
- *test
MBJOrgChannel:
Consortium: SampleConsortiumBJ
Application:
<<: *ApplicationDefaults
Organizations:
- *test3
- *mch
- *test
Organizations:
- &OrdererOrg
Name: OrdererOrg
# ID to load the MSP definition as
ID: OrdererMSP
MSPDir: crypto-config/ordererOrganizations/mch.test/msp
- &test
Name: test
# ID to load the MSP definition as
ID: testMSP
MSPDir: crypto-config/peerOrganizations/test.test/msp
AnchorPeers:
- Host: peer0.test.test
Port: 7054
- &airtel
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: airtel
# ID to load the MSP definition as
ID: test2MSP
MSPDir: crypto-config/peerOrganizations/test2.test/msp
Anc
- Host: peer0.test2.test
Port: 7055
- &bsnl
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: test3
# ID to load the MSP definition as
ID: test3MSP
MSPDir: crypto-config/peerOrganizations/test3.test/msp
AnchorPeers:
- Host: peer0.test3.test
Port: 7059
- &mch
Name: mch
# ID to load the MSP definition as
ID: mchMSP
MSPDir: crypto-config/peerOrganizations/mch.test/msp
AnchorPeers:
- Host: peer0.mch.test
Port: 7051
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- 10.64.253.213:7050
# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s
# Batch Size: Controls the number of messages batched into a block
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Kafka:
Brokers:
- 127.0.0.1:9092
Organizations:
Application: &ApplicationDefaults
Organizations:
===============================================================
after this pull up the orderer and peer1 on one server and peer2 on different server. Create channel using IP of orderer instead of name then copy the channel file to other peer also and join both peers one at a time. Install chaincode on two peers. You are good to go.
我能够使用docker swarm模式在多台机器上托管hyperledger fabric network。Swarm模式提供了一个跨多台主机/机器的网络,用于结构网络组件的通信。
这篇文章解释了部署过程。它创建了一个群网络,所有其他机器都加入了这个网络。https://medium.com/@wahabjawed/超级账本-多主机上的织物-a33b08ef24f
Hyperledger面料:我正在使用面料样品。 在运行命令时 我在创建通道时遇到以下错误:
我有一个由3个orgs和两个频道组成的网络。
我正在开发一个基于余额转移示例的hyperledger fabric应用程序,该应用程序目前无法注册用户。我有一些组织,例如银行,案件经理。。。一开始是由于缺乏联系(我添加的一些组织)引发了错误消息,但在我添加了一些行以创建联系后,出现了一些奇怪的消息。。。。我只允许注册一个用户。如果我尝试注册更多,它将显示: 我已经找了这么久,仍然找不到答案。请帮忙!!! 代码: }; 我注意到的一件事是,如果
我可以使用此链接https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabriz-multi-org在一台主机上连接到多个org 为了使用多台主机连接多个组织,我遵循以下链接:https://medium.com/1950labs/publish-a-business-network-in-multi-host-hyp
本文向大家介绍Docker主机网络与网桥网络,包括了Docker主机网络与网桥网络的使用技巧和注意事项,需要的朋友参考一下 可用于Docker网络的单主机网络有两种类型:“主机”和“桥”网络。单主机网络意味着它们的影响对于每个单独的主机都是局部的。 在主机网络的情况下,特定的Docker容器可以直接使用主机的网络来发送和接收数据包。对于网桥网络,它需要端口映射才能进行通信。 为了更好地理解它们,让
本文向大家介绍pytorch打印网络结构的实例,包括了pytorch打印网络结构的实例的使用技巧和注意事项,需要的朋友参考一下 最简单的方法当然可以直接print(net),但是这样网络比较复杂的时候效果不太好,看着比较乱;以前使用caffe的时候有一个网站可以在线生成网络框图,tensorflow可以用tensor board,keras中可以用model.summary()、或者plot_mo