多个组织需要加入到通道中才能互相通信。
命令介绍:
带-的都是参数没有子命令
Organizations: //组织,有orderer节点组织和peer节点组织。固定不可改
- &OrdererOrg //&后的名字随便取,下面这个名字进行引用,排序节点组织的名字
Name: OrdererOrg #排序节点组织名
ID: OrdererMSP #排序节点组织的ID
MSPDir: crypto-config/ordererOrganizations/example.com/msp #组织的msp账号信息
- &Org1 #peer节点组织第一个组织,名字自己起
Name: Org1MSP #组织名字
ID: Org1MSP #第一个组织的ID
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
AnchorPeers: #随便找一个节点作为锚节点
- Host: peer0.org1.example.com
Port: 7051
- &Org2 #也是peer组织
Name: Org2MSP
ID: Org2MSP
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp #组织账号信息需要替换
AnchorPeers: #锚节点。访问到这个peer节点,需要指定到这个域名
#锚节点是用来和其他组织通信的。
- Host: peer0.org2.example.com
Port: 7051 #这个端口是固定的,不能i修改。镜像内部docker窃听的端口
Capabilities: #能力 Capabilities在fabric1.0之前是没有的。需要设置为true才能兼容
Global: &ChannelCapabilities
V1_1: true
Orderer: &OrdererCapabilities
V1_1: true
Application: &ApplicationCapabilities
V1_2: true
Application: &ApplicationDefaults
Organizations: #这里不用动
Orderer: &OrdererDefaults #对应的排序节点,指定打包的规则
OrdererType: solo #排序算法,也就是共识机制有SOLO和kafka两种,solo比较简单但是出##于小数据,kafka比较复杂对于高并发来处理。测试的时候用solo比较方便
Addresses: #orderer节点的地址
- orderer.example.com:7050 #排序节点的域名,需要根据crypto-config来修改
#7050表示内部绑定的端口。不能修改
BatchTimeout: 2s #超时时间,多长时间产生一个区块
BatchSize: #P的大小
MaxMessageCount: 10 #对应的最大交易个数,达到后会产生一个区块
AbsoluteMaxBytes: 99 MB #数据量的大小,如果超过会也会产生一个区块,一般是32,64Mb。
PreferredMaxBytes: 512 KB #建议交易数值,这个没必要。可以不用改
Kafka: #排序算法也就是共识机制
Brokers: #代理人,经纪人
- 127.0.0.1:9092 #kafka的服务器
Organizations: #空着就行
Profiles: #不能改,起到一个总结的作用
TwoOrgsOrdererGenesis: #区块名字,可以随便改
Capabilities: #能力
<<: *ChannelCapabilities #引用了ChannelCapabilities
Orderer:
<<: *OrdererDefaults
Organizations: #orderer节点的组织
- *OrdererOrg
Capabilities: #能力
<<: *OrdererCapabilities
Consortiums: #联盟
SampleConsortium: #联盟名字可以改
Organizations: #组织
- *Org1
- *Org2
TwoOrgsChannel: #通道名字,可以修改。
Consortium: SampleConsortium #对应前面联盟的名字需要一起修改。
Application:
<<: *ApplicationDefaults
Organizations: #组织
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities