In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to implement mirror deployment network in Fabric2.0". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to implement mirror deployment network in Fabric2.0".
2.1 download the Fabric source code
Create a directory where the source code is stored. This document stores the source code in the / usr/local/src/hyperleger directory. If the directory is not available on the reader's machine, you need to manually create it by executing the following command:
Sudo mkdir-p / usr/local/src/hyperleger
Go to this directory, use git to download the source code of fabric from github, and switch to the branch of release-2.0.
Cd / usr/local/src/hyperlegersudo git clone https://github.com/hyperledger/fabric.gitsudo git checkout release-2.0
In the source code we just downloaded, there is a very important script, bootstrap.sh, which can help us with the later download.
The next download can be done in two ways:
(1) run the bootstrap.sh script to download with one click, but this way is inefficient due to network reasons. You can use nohup and & to run the script without hanging up.
(2) complete the subsequent download work manually, which is more flexible and convenient for readers to understand the necessary component information for building the Fabric platform.
This section will use the second way to complete the later component download work.
2.2 download the docker image of Fabric
This article will launch the fabric platform in the form of docker, so here you need to download the docker images of the components of the fabric network.
We still use the bootstrap.sh script here to download the docker image of Fabric (if you are familiar with the docker operation, you can also use the docker command to download it). Use the script parameter setting to make the script download only the docker image of Fabric. Execute the following command:
Cd / usr/local/src/hyperleger/fabric/scriptssudo. / bootstrap.sh 2.0.0-b-s
View the installation results and execute the command:
Docker images
The download process takes some time even if Aliyun's image acceleration is set. If the image is downloaded successfully, the image list information in the following figure is displayed.
2.3 download Fabric sample code
The sample code of Fabric contains: test chain code, first-network and test-network test networks and their corresponding configuration files and startup scripts, which is of great reference significance. This section will start the first-network network.
The sample code for Fabric is downloaded using the git command.
Cd / usr/local/src/hyperleger/fabric/scriptssudo git clone https://github.com/hyperledger/fabric-samples.git# switch version sudo git checkout v2.0.0
After the download is successful, a fabric-samples directory will be generated under the scripts directory, as shown in the following figure:
2.4 download binaries required for Fabric deployment
The binaries required for this section are actually available by compiling the fabric source code, while bootstrap.sh downloads the zip package directly from github, whether compiled or downloaded from github, with a high failure rate. Here I will provide Baidu network disk address for readers to download, more reliable.
Address: https://pan.baidu.com/s/1pX8Y9p3eBIK6GWi5ISNEZw, extraction code: ba2k
Extract the downloaded file to the / usr/local/src/hyperleger/fabric/scripts/fabric-samples directory and execute the command:
Tar-zxvf hyperledger-fabric-linux-amd64-2.0.0.tar.gz-C / usr/local/src/hyperleger/fabric/scripts/fabric-samples/
After the decompression is successful, the fabric-samples directory will generate two directories, bin and config, as shown below:
The bin directory contains seven executable programs that will be called when the fabric network starts.
The config directory contains three configuration files for configuring the fabric network.
2.5 download Fabric-ca binaries
The binaries required for this section are actually available by compiling the fabric source code, while bootstrap.sh downloads the zip package directly from github, whether compiled or downloaded from github, with a high failure rate. Here I will provide Baidu network disk address for readers to download, more reliable.
Address: https://pan.baidu.com/s/1pX8Y9p3eBIK6GWi5ISNEZw, extraction code: ba2k
Extract the downloaded file to the / usr/local/src/hyperleger/fabric/scripts/fabric-samples directory and execute the command:
Tar-zxvf hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz-C / usr/local/src/hyperleger/fabric/scripts/fabric-samples/
After the decompression is successful, 2 executable programs will be added to the bin directory, as shown below:
Add the above bin directory to the environment variable PATH, otherwise an error will occur when deploying the channel deployment code.
# set the environment variable sudo vim / etc/profile# and append the following to the end of the file export FABRIC_SAMPLE=/usr/local/src/hyperleger/fabric/scripts/fabric-samplesexport PATH=$GOROOT/bin:$FABRIC_SAMPLE/bin:$PATH# to make the environment variable take effect source / etc/profile2.6 to start the first-network network
Start the first-network network and execute the following command:
Cd / usr/local/src/hyperleger/fabric/scripts/fabric-samples/first-networksudo. / byfn.sh up
Tips:byfn is the abbreviation of build your first network.
As can be seen from the log executed by the script, the first-network network consists of 10 container services, including 5 sort node services, 4 peer node services and 1 cli service.
After the container service starts, it hibernates for 15 seconds to build the sorting node service cluster. After the construction is completed, chain code packaging, installation, instantiation and invocation testing begin.
The result of the successful execution of the command is shown in the following figure:
Check the operation of the container and execute the command:
Docker ps
Stop the network and execute the command:
Sudo. / byfn.sh down above are all the contents of the article "how to implement Mirror deployment Network in Fabric2.0". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.