8

I have hyperledger fabric network setup on my local machine with a single validating node. I am developing a chaincode and would like to clear my blockchain. I have read that the hyperledger fabric stores the database under /var/hyperledger. However, I do not see this hyperledger directory under /var. Is there another location for this directory? My development platform is MAC and I am using docker-compose to start my hyperledger fabric network.

2 Answers 2

4

The Hyperledger Fabric stores the database in /var/hyperledger/production/db within the file system for the validating peer. You can navigate to the validating peer file system by using a command like docker exec -it substitute_container_name bash. I am not aware of another location of the database. If the instructions at https://hub.docker.com/r/ibmblockchain/fabric-peer/ for using Hyperledger Docker images are followed, then the database location should be /var/hyperledger/production/db.

3
  • Andrew, thank you very for the helpful answer. I was able to get to the /var/hyperledger/production/db directory on my validating peer. I tried to remove the db directory but that didn't seem to clear my blockchain. I then deleted the /var/hyperledger/production directory. This now causes the fabric peer node failing to start. The memberservices process starts up but I get the following error when it tries to start the fabric-peer:
    – shaggy
    Jan 18, 2017 at 3:13
  • vp0_1 | 02:40:56.262 [crypto] Errorf -> ERRO 02d [validator.my_vp0] Failed invoking CreateCertficatePair [rpc error: code = 2 desc = Identity lookup error: sql: no rows in result set]. vp0_1 | 02:40:56.263 [crypto] Errorf -> ERRO 02e [validator.my_vp0] Failed getting enrollment certificate [id=my_vp0]: [rpc error: code = 2 desc = Identity lookup error: sql: no rows in result set] vp0_1 | 02:40:56.263 [crypto] Errorf -> ERRO 02f [validator.my_vp0] Failed retrieving enrollment data [rpc error: code = 2 desc = Identity lookup error: sql: no rows in result set].
    – shaggy
    Jan 18, 2017 at 3:20
  • @shaggy do you solve this problem? I face the same problem about modifying database but nothing changed...... :(
    – Yvonne
    Jul 13, 2017 at 6:20
1

To clear the blockchain, the easiest way is to stop and run docker container again, given that you only have 1 validator peer you should not be worried about data consistency. Also, try to use the latest version of fabric releases since they improved a lot these kind of problems. And regarding the issue,

no rows in result set

make sure that youe have specified the right organization name and department when requesting user validation agains CA. The parameters you send, must exist on CA database, otherwise, you will receive that error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.