Search code examples
virtual-machinehyperledger-fabricrestart

Hyperledger transaction data loss upon VM restart


I have setup Hyperledger fabric network on a linux virtual machine. A business network is installed onto fabric network. I am able to perform transactions and update the blockchain accordingly.

When I restart my linux virtual machine, all the docker instances of fabric components such as peers, orderer, ca, cli are erased and hence I am not able to retain the transaction data as a result I am suffering a data loss.

Is there a way to retain the Hyperledger transaction data upon vm server restart.


Solution

  • If you use VMware to create your linux virtual machine, you can configure your vm setting to get persistent data storage, like mounting your container on a persistent disk, which is mounted from your physical machine. see VM Hard Disk Storage for reference.

    For transaction data, if you mean your ledger, you can setup volumes parameter to link your disk and container disk. The ledger data located at /var/hyperledger/production/ledgersData on peer container.

    So you can add:

    volumes:
    - /<hard disk path>:/var/hyperledger/production/ledgersData
    

    on docker-compose.yaml file for peers.