Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Peer Discovery in Hyperledger Fabric

I installed the Fabric codebase from the Hyperledger project https://github.com/hyperledger/fabric by following the instructions and was able to run the peer by using the ./peer peer command.

Peer supports finding out other peers running on the network. Right now Fabric supports running Peers on the same machine using Docker and running them - https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md

Instead of running on same machine - I setup a Peer on another machine (a Mac Mini) and ran the command ./peer network from one of the machines - it did not discover anything.

My question is how to configure to discover Fabric Peers on the local network?

There is configuration on discovery in the core.yaml file but not clear how to enable it.

like image 717
Ashu Joshi Avatar asked Mar 13 '23 11:03

Ashu Joshi


1 Answers

When you set up the second peer you should put the right address of the first peer in the CORE_PEER_DISCOVERY_ROOTNODE parameter in the command:

docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:4243 -e CORE_PEER_ID=vp1 -e CORE_PEER_ADDRESSAUTODETECT=true -e CORE_PEER_DISCOVERY_ROOTNODE=172.17.0.2:30303 hyperledger-peer peer peer

If you are running in different machines it is probable that you'll have to forward ports. And if you are running the peer inside Vagrant you'll need to forward Vagrant ports too (https://www.vagrantup.com/docs/networking/forwarded_ports.html).

like image 198
Marc Cayuela Avatar answered Apr 09 '23 00:04

Marc Cayuela