带你玩转区块链---Fabric多机多节点部署-第三章-第二节【Fabric篇】

本文档详细介绍了如何在多台主机上部署Hyperledger Fabric的order节点、goPeer0节点和cppPeer0节点,包括环境配置、证书生成、通道创建、链码安装和验证。每个步骤都有明确的操作指导,确保节点间的通信和链码一致性。
摘要由CSDN通过智能技术生成

规划

所有的节点分离部署, 每台主机上有一个节点

 

名称 IP Hostname 组织机构
orderer 192.168.220.31 orderer.test.com Orderer
goPeer0 192.168.220.32 peer0.orgGo.com OrgGo
cppPeer0  192.168.220.33 peer0.orgCpp.com OrgCpp

ps:安装Fabric一机多节点和配置证书详情等请看上一节文档。

一、必要配置以及准备

  1. n台主机需要创建一个名字相同的工作目录


      # 192.168.220.31
      mkdir ~/testwork
      # 192.168.220.32
      mkdir ~/testwork
      # 192.168.220.33
      mkdir ~/testwork

关闭防火墙:

systemctl stop firewalld

systemctl disable firewalld
2.安装Fabric1.4单机版,并将bin文件中的可执行文件拷贝至/usr/local/bin中,(单机版教程请参考上一节)
cd ....//fabric 1.4fabric-sample中的bin文件
cp * /usr/local/bin

3.编写配置文件 -> 生成证书(只在orderer节点上运行)

vim crypto-config.yaml
# ---------------------------------------------------------------------------
# "OrdererOrgs" - Definition of organizations managing orderer nodes
# ---------------------------------------------------------------------------
OrdererOrgs:
  # ---------------------------------------------------------------------------
  # Orderer
  # ---------------------------------------------------------------------------
  - Name: Orderer
    Domain: test.com

    # ---------------------------------------------------------------------------
    # "Specs" - See PeerOrgs below for complete description
    # ---------------------------------------------------------------------------
    Specs:
      - Hostname: orderer

# ---------------------------------------------------------------------------
# "PeerOrgs" - Definition of organizations managing peer nodes
# ---------------------------------------------------------------------------
PeerOrgs:
  # ---------------------------------------------------------------------------
  # Org1
  # ---------------------------------------------------------------------------
  - Name: OrgGo
    Domain: orgGo.test.com
    EnableNodeOUs: false

    # ---------------------------------------------------------------------------
    # "CA"
    # ---------------------------------------------------------------------------
    # Uncomment this section to enable the explicit definition of the CA for this
    # organization.  This entry is a Spec.  See "Specs" section below for details.
    # ---------------------------------------------------------------------------
    # CA:
    #    Hostname: ca # implicitly ca.org1.example.com
    #    Country: US
    #    Province: California
    #    Locality: San Francisco
    #    OrganizationalUnit: Hyperledger Fabric
    #    StreetAddress: address for org # default nil
    #    PostalCode: postalCode for org # default nil

    # ---------------------------------------------------------------------------
    # "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.
    #   - SANS:       (Optional) Specifies one or more Subject Alternative Names
    #                 to be set in the resulting x509. Accepts template
    #                 variables {
  {.Hostname}}, {
  {.Domain}}, {
  {.CommonName}}. IP
    #                 addresses provided here will be properly recognized. Other
    #                 values will be taken as DNS names.
    #                 NOTE: Two implicit entries are created for you:
    #                     - {
  { .CommonName }}
    #                     - {
  { .Hostname }}
    # ---------------------------------------------------------------------------
    # Specs:
    #   - Hostname: foo # implicitly "foo.org1.example.com"
    #     CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
    #     SANS:
    #       - "bar.{
  {.Domain}}"
    #       - "altfoo.{
  {.Domain}}"
    #       - "{
  {.Hostname}}.org
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值