添加一个新的组织到channel

添加一个新的组织到channel

官方文档

This tutorial extends the Fabric test network by adding a new organization – Org3 – to an application channel.

本教程通过向应用程序通道添加新组织Org3扩展了Fabric测试网络。

While we will focus on adding a new organization to the channel, you can use a similar process to make other channel configuration updates (updating modification policies or altering batch size, for example). To learn more about the process and possibilities of channel config updates in general, check out Updating a channel configuration). It’s also worth noting that channel configuration updates like the one demonstrated here will usually be the responsibility of an organization admin (rather than a chaincode or application developer).

我们将专注于向channel添加新组织,你可以使用相似的流程来进行其他情况的通道配置更新。略

Setup the Environment(启动环境)

启动测试环境并创建默认的channel,请参考:Fabric测试网络使用

Bring Org3 into the Channel with the Script(使用脚本将Org3加入到通道)

You should be in the test-network directory. To use the script, simply issue the following commands:

1
2
cd addOrg3
./addOrg3.sh up

The output here is well worth reading. You’ll see the Org3 crypto material being generated, the Org3 organization definition being created, and then the channel configuration being updated, signed, and then submitted to the channel.

这里的输出值的我们一读。你会看到生成Org3组织的加密材料,创建组织Org3的定义然后通道配置会被更新、签名并且提交到通道。

If everything goes well, you’ll get this message:

1
========= Finished adding Org3 to your test network! =========

Now that we have confirmed we can add Org3 to our channel, we can go through the steps to update the channel configuration that the script completed behind the scenes.

现在我们已经确认我们可以把组织Org3添加到我们的通道,我们可以按照以下步骤更新通道配置来完成脚本在幕后完成工作。

Bring Org3 into the Channel Manually(手动将Org3加入通道)

If you just used the addOrg3.sh script, you’ll need to bring your network down. The following command will bring down all running components and remove the crypto material for all organizations:

如果你刚才使用了 addOrg3.sh脚本,你需要先把网络关闭。下面的命令会关闭所有正在运行的组件并且移除所有组织的加密材料:

1
2
cd addOrg3
./addOrg3.sh down

After the network is brought down, bring it back up again(网络关闭之后,重新启动它):

1
2
cd ..
./network.sh up createChannel

This will bring your network back to the same state it was in before you executed the addOrg3.sh script.

这将使您的网络恢复到执行addOrg3.sh脚本之前的状态。

Now we’re ready to add Org3 to the channel manually. As a first step, we’ll need to generate Org3’s crypto material.

现在我们已经准备好手动的将Org3添加到通道中了,第一步,我们需要生成Org3的加密材料。

Generate the Org3 Crypto Material(生成Org3的加密材料)

In another terminal, change into the addOrg3 subdirectory from test-network.

在另一个终端切换到 test-network目录的子目录 addOrg3中:

1
cd addOrg3

First, we are going to create the certificates and keys for the Org3 peer, along with an application and admin user. Because we are updating an example channel, we are going to use the cryptogen tool instead of using a Certificate Authority. The following command uses cryptogen to read the org3-crypto.yaml file and generate the Org3 crypto material in a new org3.example.com folder:

首先,我们将为Org3组织的peer节点包括应用程序和管理员用户创建证书和密钥。因为我们正在更新示例通道,所以我们将使用cryptogen工具而不是使用证书颁发机构。 下面的命令使用cryptogen读取 org3-crypto.yaml文件然后在新的 org3.example.com 文件夹下面生成Org3的加密材料。

1
../../bin/cryptogen generate --config=org3-crypto.yaml --output="../organizations"