Deploying Multiple Organizations in Hyperledger Fabric Version 2.0, and Monitoring containers via cAdvisor

Deploying Multiple Organizations in Hyperledger Fabric Version 2.0, and Monitoring containers via cAdvisor

We have seen till now the Hyperledger Architecture, we will go into depth of working in the consequent blogs.This blog helps you get started with Hyperledger Fabric Version 2.0 along with container monitoring via Googles Cadvisor , I will also discuss the differences in Flow as compared to Version 1.0 . Lets get started !!

I have referred the Standard Hyperledger Fabric Documentation , and followed the relevant and optimized steps.

The prerequisites for executing this will be installing :docker ,curl ,wget,npm,Go and Python,I will give give you commands for Ubuntu Systems to install Prerequisites.

Commands to install Docker and Docker-Compose

~$ sudo apt update

~$ sudo apt install docker-compose

Commands to install curl,python and wget

~$ sudo apt install curl python wget

Command to install go and npm

To install the GO Language:

~$ wget

Set the environment variable in the .bashrc file in Home directory

export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin

One done : You just have to source the file : source .bashrc

$ vi .bashrc ###do the necessary changes and edits
$ source .bashrc

Install the npm and nvm by the following commands

1)curl -sL | sudo -E bash - 2)sudo apt-get install nodejs 3)wget -qO- | bash 4)npm install npm@5**.**6.0 **-**g

Install Hyperledger Fabric Version 2.0

We will go for a stable release in Hyperledger with components mentioned with versions of (Certificate Authority)

curl -sSL | bash -s — <fabric_version> <fabric-ca_version> <thirdparty_version>

curl **-sSL**2ysbOFE | bash **-s -- 2.0.1 1.4.6 0.4.**18

Installing Hyperledger Fabric

Downloading the docker images

Once the Download is over you can do “docker ps”

To see the containers running

You can navigate to to the network directory and make the network

Once inside the test network directory

Make the network down by(if running) : “./ down”

You will see all the peers,orderers and nodes coming down if running.

As compared to Fabric 1.0 latest releases they have reduced the complications by making only 1 file for certificate generations and Deployment which is “”, instead of multiple files like “cryptogen and byfn” in the previous one.

Make it up again: “./ up”

YAML files bringing up container

Containers and Network Coming up

docker ps results

Lets now create one channel and run the chaincode

**./network.**sh createChannel -c mychannel

Mychannel deployed

Lets run the Fabcar smart contract: “./ deployCC”

Lets run the Fabcar Chain code

Chaincode deployed in Peers

Finally running the “QueryAllCars”

Lets monitor the deployed node via Goolgle’s container monitoring tool Cadvisor.Install it using:

anubhav@anubhav-VirtualBox:~/fabric-samples/test-network$ VERSION=v0.35.0 # use the latest release version from

anubhav@anubhav-VirtualBox:~/fabric-samples/test-network$ sudo docker run — volume=/:/rootfs:ro — volume=/var/run:/var/run:ro — volume=/sys:/sys:ro — volume=/var/lib/docker/:/var/lib/docker:ro — volume=/dev/disk/:/dev/disk:ro — publish=8080:8080 — detach=true — name=cadvisor$VERSION

You will see after some time Cadvisor coming up on port 8080 (ss -tln)

ss -tln port

You can open localhost:8080 , to see all the listed containers and Monitor its metrics and usages:

In the next post we will see how to increase the network traffic and test the limits of Hyperledger Fabric, also to monitor the network traffic

For any further Queries or anything related to Blockchain or Devops you can DM me on Linkedin.

Anubhav Chaturvedi - Devops Program Mentor - CodeAsylums | LinkedIn
*Working as an Independent Contractor for roles like Blockchain Development(Hyperledger ) and Devops Engineer including…*

Get Best Software Deals Directly In Your Inbox