1

I am trying to do backup and restore of a hyperledger fabric network v2.2.0. To test this, I used test-network of fabric release - https://github.com/hyperledger/fabric-samples/archive/refs/tags/v2.2.0.tar.gz. First I brought up the network, created the channel, deployed CC and performed invoke, query. Then I took backup by following the article - https://www.devprovider.com/how-to-take-backup-from-hyperledger-fabric. Once done with the backup, I have deleted the network. Then I tried to restore from the backup data (crypto-materials of orderer, peers, channel-artifacts, peer data and the orderer data). I confirmed that the restoration was successful by comparing the channel height from the network I have deleted and the restored network. It was 8 at the time when I took backup. So to check if everything is working from Chaincode perspective, I have tried query which resulted in error,

Error: endorsement failure during query. response: status:500 message:"error in simulation: failed to execute transaction 392e33eaadd537650590479036a1018946dcbbebaf3d55cbddb288e243485e80: could not launch chaincode basic_1.0:4ec191e793b27e953ff2ede5a8bcc63152cecb1e4c3f301a26e22692c61967ad: error starting container: error starting container: API error (404): network _test not found"

Same error for invoke. Can anyone please guide me on how to overcome the failure of CC invoke and query? Thanks in Advance!

Soundarya
  • 153
  • 1
  • 2
  • 12
  • Does this answer your question? [The Name of Hyperledger Fabric Test Network is not detected by an Application given in the fabric samples](https://stackoverflow.com/questions/65932112/the-name-of-hyperledger-fabric-test-network-is-not-detected-by-an-application-gi) – myeongkil kim May 10 '21 at 01:34
  • Thanks for you reply, even I have changed the respective variable (COMPOSE_PROJECT_NAME) with the value "net", the restored network is getting created in the name of docker_test. So it is not solving my issue. – Soundarya May 10 '21 at 07:46

1 Answers1

1

you have not set the value of COMPOSE_PROJECT_NAME,set it arbitrary value before you start your fabric network

export COMPOSE_PROJECT_NAME=net

this variable setting starts chaincode containers on the same bridge network as the peers

Li Xian
  • 421
  • 4
  • 4
  • Thanks for your reply! I tried setting the env. variable COMPOSE_PROJECT_NAME to net. So when I run the test network for the first time, the network created in the name "net_test". But after I take the backup, I have removed the network "net_test" and re-start the network with backed by crypto materials (with the docker-compose file where I mentioned the networkmode as net), it is creating the network in the name "docker_test". – Soundarya May 10 '21 at 07:44
  • you need set COMPOSE_PROJECT_NAME when you restore your fabric network,I mean you better set COMPOSE_PROJECT_NAME every time when you start your fabric network – Li Xian May 10 '21 at 08:03
  • I have mentioned COMPOSE_PROJECT_NAME as net when starting the restore network. But still the network name is named as docker_test instead of net_test and the Chaincode invoke and query are failing – Soundarya May 10 '21 at 09:15
  • Sure, please find the attached peer log in the github - https://github.com/SoundaryaA3098/k8s_problem_statement/blob/master/peer.log – Soundarya May 10 '21 at 09:35
  • Please find the docker-compose.yaml under https://github.com/SoundaryaA3098/k8s_problem_statement/blob/master/docker-compose-test-net.yaml – Soundarya May 10 '21 at 09:44
  • I think you should set - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test ranther net_test in your docker-compose yaml,and set COMPOSE_PROJECT_NAME before you start your fabric network – Li Xian May 10 '21 at 09:51
  • Thanks a lot! That is working. I have set the COMPOSE_PROJECT_NAME to net and configured in docker-compose.yaml like CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test. Thanks again! – Soundarya May 10 '21 at 10:00