没有合适的资源?快使用搜索试试~ 我知道了~
首页手动搭建fabric单机多节点网络.pdf
手动搭建fabric单机多节点网络.pdf
需积分: 30 16 下载量 128 浏览量
更新于2023-03-16
1
收藏 168KB PDF 举报
基于hyperledger fabric2.0手动搭建单机多节点网络,所有步骤均基于fabric-sample的test-network脚本
资源详情
资源推荐
构建fabric单机多节点⽹络
在进⾏后续操作之前将 fabric-samples/bin ⽬录添加到 PATH 变量中,这样就可以在任意位置
使⽤fabric提供的⼆进制⽂件命令
echo "export PATH=$PATH:$HOME/Documents/fabric-learn/fabric-samples/bin" >>
~/.bash_profile
⼯作⽬录为 fabric-samples/setup-up-my-network
1.⽣成加密材料
这⼀步通过 cryptogen ⼯具完成
这⾥使⽤ showtemplate ⼦命令,该命令将⽣成加密材料所需要的配置信息显示在terminal,可以结合
重定向命令将配置信息输出到指定的配置⽂件中
将 crypto-config.yaml ⽂件移动到 organizations/cryptogen ⽬录下,然后复制三份并分别改名
为 crypto-config-orderer.yaml、crypto-config-org1.yaml、crypto-config-org2.yaml
# 下⾯是该命令的帮助信息
$ cryptogen --help
usage: cryptogen [<flags>] <command> [<args> ...]
Utility for generating Hyperledger Fabric key material
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
Commands:
generate [<flags>] # ⽤于⽣成密码材料
showtemplate # 显示默认的配置模板
extend [<flags>] # 拓展已有的⽹络
$ cryptogen showtemplate >> crypto-config.yaml
# crypto-config-orderer.yaml
OrdererOrgs:
- Name: Orderer
Domain: example.com
EnableNodeOUs: true
Specs:
- Hostname: orderer
SANS:
- localhost
⽣成证书使⽤的是 cryptogen generate 命令
下⾯是实际操作
# crypto-config-org1.yaml
PeerOrgs:
- Name: Org1
Domain: org1.example.com
EnableNodeOUs: true
Template:
Count: 1
SANS:
- localhost
Users:
Count: 1
# crypto-config-org2.yaml
PeerOrgs:
- Name: Org2
Domain: org2.example.com
EnableNodeOUs: true
Template:
Count: 1
SANS:
- localhost
Users:
Count: 1
# cryptogen generate --help查看该⼦命令帮助信息
$ cryptogen generate --help
usage: cryptogen generate [<flags>]
Generate key material
Flags:
--output="crypto-config" # 指定加密材料的输出⽬录
--config=CONFIG # 要使⽤的配置⽂件的路径
cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --
output="organizations"
cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --
output="organizations"
cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --
output="organizations"
2.创建系统channel的创世块
这⼀步⽤到了 configtxgen 命令,可通过 --help 参数查看该命令帮助信息。
该命令需要⼀个配置⽂件 configtx.yaml 才能执⾏(⽂件名固定),可以从 test-network/configtx
⽬录下拷⻉
下⾯是修改之后的 configtx.yaml 配置⽂件
Usage of configtxgen:
-asOrg string
Performs the config generation as a particular organization (by name), only
including values in the write set that org (likely) has privilege to set
-channelCreateTxBaseProfile string
Specifies a profile to consider as the orderer system channel current state to
allow modification of non-application parameters during channel create tx generation.
Only valid in conjunction with 'outputCreateChannelTx'.
-channelID string
The channel ID to use in the configtx
-configPath string
The path containing the configuration to use (if set)
-inspectBlock string
Prints the configuration contained in the block at the specified path
-inspectChannelCreateTx string
Prints the configuration contained in the transaction at the specified path
-outputAnchorPeersUpdate string
[DEPRECATED] Creates a config update to update an anchor peer (works only with
the default channel creation, and only for the first update)
-outputBlock string
The path to write the genesis block to (if set)
-outputCreateChannelTx string
The path to write a channel creation configtx to (if set)
-printOrg string
Prints the definition of an organization as JSON. (useful for adding an org to a
channel manually)
-profile string
The profile from configtx.yaml to use for generation.
-version
Show version information
$ cp ../configtx/configtx.yaml configtx
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:
# SampleOrg defines an MSP using the sampleconfig. It should never be used
# in production but may be used as a template for other definitions
- &OrdererOrg
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: OrdererOrg
# ID to load the MSP definition as
ID: OrdererMSP
# MSPDir is the filesystem path which contains the MSP configuration
MSPDir: ../organizations/ordererOrganizations/example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.admin')"
OrdererEndpoints:
- orderer.example.com:7050
- &Org1
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org1MSP
# ID to load the MSP definition as
ID: Org1MSP
MSPDir: ../organizations/peerOrganizations/org1.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org1MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.peer')"
# leave this flag set to true.
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org1.example.com
Port: 7051
- &Org2
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org2MSP
# ID to load the MSP definition as
ID: Org2MSP
MSPDir: ../organizations/peerOrganizations/org2.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.peer')"
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org2.example.com
Port: 9051
################################################################################
#
# SECTION: Capabilities
#
# - This section defines the capabilities of fabric network. This is a new
剩余21页未读,继续阅读
半纸药笺
- 粉丝: 12
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 藏经阁-应用多活技术白皮书-40.pdf
- 藏经阁-阿里云计算巢加速器:让优秀的软件生于云、长于云-90.pdf
- 藏经阁-玩转AIGC与应用部署-92.pdf
- 藏经阁-程序员面试宝典-193.pdf
- 藏经阁-Hologres 一站式实时数仓客户案例集-223.pdf
- 藏经阁-一站式结构化数据存储Tablestore实战手册-206.pdf
- 藏经阁-阿里云产品九月刊-223.pdf
- 藏经阁-2023云原生实战案例集-179.pdf
- 藏经阁-Nacos架构&原理-326.pdf
- ZTE电联中频一张网配置指导书
- 企业级数据治理之数据安全追溯
- MISRA-C 2012-中文翻译版.pdf
- 藏经阁-《多媒体行业质量成本优化及容灾方案白皮书》-37.pdf
- 藏经阁-浅谈阿里云通用产品线Serverless的小小演化史-23.pdf
- 藏经阁-冬季实战营第一期:从零到一上手玩转云服务器-44.pdf
- 藏经阁-云上自动化运维宝典-248.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功