fabric局域网多机链管理目录
锚节点更新
-
锚节点是一个peer节点
-
那么锚节点和普通peer节点的区别就是
在一个网络中,有多个组织,每个组织有多个peer节点,组织和组织之间需要通信,那么每个组织中选取一个peer节点作为代表,这个peer节点的代表就是锚节点 -
锚节点的职责就是代表当前这个组织,和其他的组织进行通信。
我们可以在配置文件中指定锚节点,任意的peer节点都有资格成为锚节点,一个组织最多有一个锚节点。 -
本例中,我们选择peer0作为锚节点进行更新。操作如下:
生成组织org
的锚节点文件(orderer
主机)
[root@localhost fabric]# configtxgen -profile channel-2 -outputAnchorPeersUpdate ./channel-artifacts/channel-2_org.tx -channelID channel-2 -asOrg orgMSP
2021-05-14 14:47:57.401 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2021-05-14 14:47:57.440 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /data/fabric/configtx.yaml
2021-05-14 14:47:57.440 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2021-05-14 14:47:57.442 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
-
解析:
configtxgen -profile channel-2 通道名 -outputAnchorPeersUpdate ./channel-artifacts/channel-2_org.tx 生成的锚节点文件位置及文件名 -channelID channel-2 通道名 -asOrg orgMSP 组织1的MSP
-
多个组织需多次执行命令,如:
configtxgen -profile channel-2 -outputAnchorPeersUpdate ./channel-artifacts/${org_name}.tx -channelID channel-2 -asOrg ${org_name}MSP
复制至锚节点主机peer0
scp ./channel-artifacts/channel-2_org.tx root@192.168.1.26:/data/fabric/channel-artifacts/
更新锚节点(peer0
执行)
[root@localhost fabric]# docker exec cli peer channel update -o orderer.test.com:7050 --ordererTLSHostnameOverride orderer.test.com -c channel-2 -f ./channel-artifacts/channel-2_org.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/test.com/msp/tlscacerts/tlsca.test.com-cert.pem
2021-05-14 06:58:26.992 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-14 06:58:26.998 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-14 06:58:26.998 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2021-05-14 06:58:27.012 UTC [channelCmd] update -> INFO 004 Successfully submitted channel update