fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Would someone please document the ins-and-outs of peer addressing?

Open bcbrock opened this issue 8 years ago • 7 comments

Description

The fabric/peer/core.yaml file has 4 settings that control the network connectivity of the peer.

    # The Address this Peer will listen on
    listenAddress: 0.0.0.0:30303
    # The Address this Peer will bind to for providing services
    address: 0.0.0.0:30303
    # Whether the Peer should programmatically determine the address to bind to.
    # This case is useful for docker containers.
    addressAutoDetect: false

    # Peer port to accept connections on
    port:    30303

What is the difference between the address "the peer will listen on" and the address used "for providing services". Can these be different? If so, why might one want to make them different? What does addressAutoDetect do exactly, why is it useful for Docker, and is it useful for Docker when True or False? My preference would be for these questions to be answered in comments in the YAML file.

Note that the peer.port variable is redundant (never used by the code) and should be removed.

Thanks, Bishop

bcbrock avatar May 08 '16 04:05 bcbrock

@bcbrock - first, I think we need to take a serious look at how we are handling all listeners, but that's a separate issue.

_listenAddress_ - this is like your typical listen host / port you see in mot servers. The peer will directly bind to an explicit IP and Port or all host IPs (0.0.0.0) and the specific port

_address_ - this is actually the address the that peer will advertise to other peers / clients in order for them to connect. The reason to use this would be in the case where you might have a proxy, NAT or when running Docker since the address that the peer is listening on may not actually be the same as the one it is exposed to the rest of the network on

_addressAutoDetect_ - this will bind the listener to the first non-loopback interface discovered. Setting this to true is useful when using Docker is bridge mode since the Docker daemon will dynamically assign an address when the container starts. You would still need to know the actual address for at least one peer, but if running multiple peers on the same host you can use this property for the rest of the peers

mastersingh24 avatar May 09 '16 10:05 mastersingh24

@bcbrock I have talked with @nickgaski and @joshhus with respect to an in-depth description of all parms in the core.yaml file along with the corresponding environment variables that can be passed in from the command line. I am not sure where this stands on their priorities, but I will see the description above is solid and I am sure they will be asking a lot of questions as they move forward with this work.

bmos299 avatar May 09 '16 18:05 bmos299

@mastersingh24 @bmos299 Thanks for the clarification, I hope this ends up in the codebase. However regarding addressAutoDetect, when we build Docker-compose networks all peers use this setting as true. There is no oddball.

bcbrock avatar May 09 '16 20:05 bcbrock

@bcbrock - with Compose this would work due to linking of containers by name

mastersingh24 avatar May 09 '16 20:05 mastersingh24

@nickgaski plans to start on this in the shorter term.

joshhus avatar May 09 '16 23:05 joshhus

Anyone has a deployment example for using this? Thanks for sharing any information!

yeasy avatar May 20 '16 06:05 yeasy

Hi, this caused me some issues and I've submitted a pull request to try and simplify. Please let me know if I should be doing anything different as I'm new to Hyperledger and GitHub.

brad-gorman avatar Jul 05 '16 08:07 brad-gorman