nagaraj
nagaraj

Reputation: 947

Hyperledger fabric where the blockchain state are saved

I using the hyperledger fabric network with 2 organisation. Now my question, where does the fabric store the blockchain state. Because i am facing the issue, when i turn down the organisation using the docker, All state of blockchain are vanished/delete. How i can keep the track of or save blockchain state, so i don't want to start the blockchain all the time from state zero. Please suggest me. even for the fabric blockchain explorer also.

Upvotes: 0

Views: 489

Answers (2)

Riki95
Riki95

Reputation: 726

Easily, you can map the content of the docker outside the docker and save it.

In example, for orderer, all its content is inside /var/hyperledger/production/orderer. You can map this folder outside in a local folder. In this way you will see the content of the docker folder even without logging the docker bash.

Now you can copy this content in another folder, let's say backup. When you re-create the docker, you can map the backup folder so that it will start with the previous content you had inside.

Upvotes: 0

Gari Singh
Gari Singh

Reputation: 12013

You will need to use persistent volumes to ensure that the data is not stored on the container filesystem else it will be destroyed when the container(s) are destroyed.

For peers, the two key attributes in core.yaml are:

peer.fileSystemPath - this defaults to /var/hyperledger/production and is where the ledger, installed chaincodes, etc are kept. The corresponding environment variable is CORE_PEER_FILESYSTEMPATH.

peer.mspConfigPath - where the local MSP info is stored. The corresponding environment variable is CORE_PEER_MSPCONFIGPATH.

For orderers, the two key attributes in orderer.yaml are:

FileLedger.Location - this defaults to /var/hyperledger/production/orderer and is where the channel ledgers are stored. The corresponding environment variable is ORDERER_FILELEDGER_LOCATION.

General.LocalMSPDir - where the local MSP info is stored. The corresponding environment variable is ORDERER_GENERAL_LOCALMSPDIR.

Upvotes: 4

Related Questions