How to change the block size in Hyper Ledger Fabric 2.X? - hyperledger-fabric

I want to adjust the size of newly created blocks. I found that there is AbsoluteMaxBytes in configtx.yaml. However, I do not understand how to change it. I have docker images including peer and orderer. Both peer and orderer I suppose have default values including default value for AbsoluteMaxBytes. Should I rebuild docker images after I change configtx.yaml or should I somehow modify AbsoluteMaxBytes inside running container?
What is the procedure?

This requires a channel config update to be done.
Please refer here:
https://hyperledger-fabric.readthedocs.io/en/release-2.2/config_update.html?highlight=channel%20config%20update

Related

hyperledger fabric mychannel block in peer get deleted once the container is down

I have hyper-ledger fabric setup with 2 organisation which works well.I am keeping the separate storage for the blocks state in file system. Now i turn down the all organisation container, all the states inside the container is deleted, but i am keeping states which are stored the my file path. Next, when i use the existing file storage, and turn up the docker, all the peers and ordered load well from the state which i was stop. The problem here is, I am unable to reinitiate the channel transaction and i am unable to join the same channel from the peer. where does the mychannel.block get stored. when i try to join the channel i get error
2019-11-27 03:49:01.631 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialised
Error: genesis block file not found open mychannel.block: no such file or directory
You should know what volumes are you using to persist that file.
You should persist:
/var/hyperledger/production in your orderers and peers.
/opt/couchdb/data in your CouchDB containers.
Wherever you store your MSP, TLS files and other configuration files (genesis block, etc.). Only you know about your configuration.
/var/lib/postgresql/data in your CA's PostgreSQL container.
Whatever other file/folder you want to persist.
Anyway, I don't know if I have understood you, but if you persist all these, you don't need to join a channel again, the peers remain joined after restarting the network.

How can a peer node retrieve old data after it crashes in Hyperledger Fabric?

I am pretty new to Hyperledger Fabric. I read a bit about gossip protocol but did not get a clear idea. Please help me with these questions.
How could a node recover old data from a channel after a crash?
What if the channel had only a single peer node and this node crashed?
A peer can get old data from a channel from other peers when it recovers. Another way, if you are pointing to a volume were it is storing the ledger information and all its credentials when it recovers can read it from there, thats why it is recomended to use a persistance storage.
Thats bad practice as you are not going to offer High availability, so without peers you are going to stop giving service and your ledger is not going to be available. But, as you can read from the documentation, you can recover from the orderer.
All ledger, blocks etc stores in below particular location in the peer container
/var/hyperledger/production
All you have todo is create a backup volume and map it
Sample snippet below
Create Volume:
volumes:
backup_peer1:
Add Volume to container:
- backup_peer1:/var/hyperledger/production

Feasibility of Dynamically setting Environment Variables in Hyperledger Fabric

Can we dynamically change the Hyperledger environment variables that we are setting before setting up the HyperLedger components during the run time. For instance, if we need to change the FABRIC_LOGGING_SPEC from debug to info during the Orderer or PEER runtime with or without docker image, is it possible?
Yes, The peer logging can dynamically changed using the cli docker access.
There are certain helpful commands that will guide you the usage like
To get the log level for logger peer:
peer logging getlevel peer
To get the active logging spec for the peer:
peer logging getlogspec
To set the log level for loggers matching logger name prefix gossip to log level INFO:
peer logging setlevel gossip info
To revert the logging spec to the start-up value:
peer logging revertlevels
Get a more detailed explanation and usage on docs.
I was trying to achieve the same in past once. But found out after you create a docker container using the service mentioned in yaml file, one can't modify the env parameters. Using 'export' you can change it but only as long as you are bashed in that container. Once you bash out of that container, the old default value will set in. One solution to it can be, spin a new container with desired env parameters. And port all the data from old container to new container. Also required updates to config blocks of the channel.

What is an Artifact in Hyperledger?

I see the word everywhere in building a Hyperledger network, but I don't exactly know what it is and the Hyperledger docs don't return a definition when I query them.
Maybe it's a dumb question because the docs don't define it and assume you should know, but I don't and can't find a precise answer to it.
Artifacts in Hyperledger are channel configuration files which are required for the Hyperledger Fabric network. They are generated at the time of network creation.
These include:
Genesis.block: First block of a chain, that initializes a block chain
Channel.tx: Channel configuration transaction
Org1MSPanchors.tx: Anchor Peer update (Defining a peer from Org1 as an anchor peer)
configtxgen command is used to create the above channel config artifacts.

Does Orderer have Block(Ledger) data?

I built hyperledger fabric network using Kafka-based Ordering Service.
I thought that Orderer doesn't have Block data.
But, when I checked /var/hyperledger/production/orderer/chains/mychannel in Orderer server, I found blockfile_000000 file.
I checked this file using "less" command.
Then, I found key-value data which I registered by invoking chaincode.
What is this file?
This means that Orderer also maintain Block data(i.e. Ledger)?
The orderer has the blockchain of all channels it is part of.
However, it doesn't have the world state and it doesn't inspect the content of the transactions.
It just writes the blocks into the disk, to serve peers that pull the blocks from it.

Resources