规划
所有的节点分离部署, 每台主机上有一个节点
名称 | 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