您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > fabric1.4.4-Raft多机环境搭建方法
Fabric多机环境部署目录Fabric多机环境部署........................................................................................................................11.多机环境部署..............................................................................................................................21.1.关闭selinux......................................................................................................................31.2.关闭防火墙.......................................................................................................................31.3.配置域名解析...................................................................................................................41.4.证书配置...........................................................................................................................41.5.通道配置...........................................................................................................................41.5.1.生成创世区块........................................................................................................51.5.2.生成通道配置区块................................................................................................51.5.3.生成锚节点信息....................................................................................................51.6.Docker配置.......................................................................................................................51.7.启动..................................................................................................................................51.8.清空docker环境..............................................................................................................51.9.附件..................................................................................................................................61.多机环境部署本文档基于fabric1.4.4,在centos上搭建多机环境,fabric镜像和docker环境的安装请参考官方文档。使用raft共识,3个order,2个组织,每个组织2个peer,raft共识需开启tls。有3台服务器,docker布局和端口分配方案如下表:172.16.10.112172.16.10.164172.16.10.187Order1:7050Order2:7050Order3:7050Peer0.org1:7051-couchdb1:5984Peer1.org1:7051-couchdb1:5984Peer1.org2:8051-couchdb2:6984Peer0.org2:7051-couchdb1:5984CLICLICLI每个服务器的目录结构如下:.└──test├──chaincode│├──abac││└──go│├──chaincode_example02││├──go││├──java││└──node│├──fabcar││├──go││├──java││├──javascript││├──javascript-low-level││└──typescript│├──marbles02││├──go││└──node│├──marbles02_private││├──collections_config.json││└──go│└──sacc│└──sacc.go└──multi_node├──base│└──peer-base.yaml├──channel-artifacts│├──channel.tx│├──genesis.block│├──mychannel.block│├──Org1MSPanchors.tx│└──Org2MSPanchors.tx├──configtx.yaml├──crypto-config│├──ordererOrganizations│└──peerOrganizations├──crypto-config.yaml├──docker-compose-host.yaml├──scripts│├──installcc.sh│└──utils.sh└──start.sh1.1.关闭selinux查看selinux状态命令:/usr/sbin/sestatus-v临时关闭selinux命令,不需重启:setenforce01.2.关闭防火墙systemctlstatusfirewalld.service查看防火墙状态,执行后可以看到绿色字样标注的“active(running)”,说明防火墙是开启状态systemctlstopfirewalld.service关闭运行的防火墙1.3.配置域名解析在每台的服务器上都需要配置order、peer、ca的域名,需要修改本机的域名和docker容器的域名。本机域名修改/etc/hosts。Docker容器的域名在docker-composer的extra_hosts下面进行配置。112的/etc/hosts文件如下:127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4orderer1.example.compeer0.org1.example.com::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6172.16.10.164orderer2.example.compeer1.org1.example.compeer1.org2.example.com172.16.10.187orderer3.example.compeer0.org2.example.com164的/etc/hosts文件如下:127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4orderer2.example.compeer1.org1.example.compeer1.org2.example.com::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6172.16.10.112orderer1.example.compeer0.org1.example.com172.16.10.187orderer3.example.compeer0.org2.example.com187的/etc/hosts文件如下:127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4orderer3.example.compeer0.org2.example.com::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6172.16.10.112orderer1.example.compeer0.org1.example.com172.16.10.164orderer2.example.compeer1.org1.example.compeer1.org2.example.com1.4.证书配置crypto-config.yaml配置参考附件《fabric多机环境》只需要在一台服务器生成证书,并复制到其他服务器的证书目录中。注意:使用同样的crypto-config.yaml配置,每次生成的证书也是不一样的,所以证书只能生成一次,然后复制到其他服务器上。在112服务器生成证书:cryptogengenerate--config=./crypto-config.yaml证书复制到另外两台服务器:scp-r./crypto-config/*root@172.16.10.164:/root/hyperledger-fabric-1.4.4/test/multi_node/crypto-config/scp-r./crypto-config/*root@172.16.10.187:/root/hyperledger-fabric-1.4.4/test/multi_node/crypto-config/1.5.通道配置configtx.yaml配置参加附件《fabric多机环境》只需在一台服务器生成创世块、通道信息即可。下面命令皆在112服务器执行1.5.1.生成创世区块configtxgen-profileSampleMultiNodeEtcdRaft-channelID$SYS_CHANNEL-outputBlock./channel-artifacts/genesis.block1.5.2.生成通道配置区块configtxgen-profileTwoOrgsChannel-outputCreateChannelTx./channel-artifacts/mychannel.tx-channelIDmychannel1.5.3.生成锚节点信息configtxgen-profileTwoOrgsChannel-outputAnchorPeersUpdate./channel-artifacts/Org1MSPanchors.tx-channelIDmychannel-asOrgOrg1MSPconfigtxgen-profileTwoOrgsChannel-outputAnchorPeersUpda
本文标题:fabric1.4.4-Raft多机环境搭建方法
链接地址:https://www.777doc.com/doc-7304777 .html