Unable to connect to the discovered orderer orderer0.example.com:7050

120 views Asked by At

I am unable to invoke transaction. I am getting below error Unable to connect to the discovered orderer orderer0.example.com:7050

66f6b9d9d7c0 hyperledger/fabric-orderer:2.1 "orderer" About an hour ago Up About an hour 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp orderer.example.com

cacd16bca285 hyperledger/fabric-orderer:2.1 "orderer" About an hour ago Up About an hour 7050/tcp, 0.0.0.0:8050->8050/tcp, :::8050->8050/tcp, 0.0.0.0:8444->8443/tcp, :::8444->8443/tcp orderer2.example.com 

8ba79e9b4d95 hyperledger/fabric-orderer:2.1 "orderer" About an hour ago Up About an hour 7050/tcp, 0.0.0.0:9050->9050/tcp, :::9050->9050/tcp, 0.0.0.0:8445->8443/tcp, :::8445->8443/tcp orderer3.example.com

This is how my docker containers look like. What am I missing?

I can see 7050 port mapped to all three orderers. I tried to change crypto-config.yaml but network crashed. I tried to add ports below each hosts.

Specs:
      - Hostname: orderer
        SANS:
            - "localhost"
            - "127.0.0.1"
      - Hostname: orderer2
        SANS:
          - "localhost"
          - "127.0.0.1"
      - Hostname: orderer3
        SANS:
            - "localhost"
            - "127.0.0.1"

EDIT:

I saw a response to similar issue. The response is like:

What I suspect has happened is that, even though you have changed the port mappings between your local machine and the Docker network, the orderer is still listening on port 7050 within your Docker network.

The discovery.asLocalhost connection option is there to support the scenario where the blockchain network is running within a Docker network on the client's local machine, so it causes any discovered hostnames to be treated as localhost, but it leaves the discovered port numbers unchanged. So, when using the discovery.asLocalhost option, the port numbers that nodes are listening on within the Docker network must be mapped to the same port numbers on the local machine.

If you want to change the port numbers then you need to change them on the actual nodes themselves, not just in your Docker network mappings.

Since I am new to Blockchain.I could not understand his response. Should I add orderer.example.com into /etc/hosts?

1

There are 1 answers

0
CodeWithJoy On

I feel that you can try following steps:

  • First of all in docker container names their is no orderer0.example.com, hence use the correct name.
  • Secondly, in configtx.yaml try to use the following convention in OrdererOrg
OrdererEndpoints:
     - orderer.example.com:7050
     - orderer2.example.com:8050
     - orderer3.example.com:9050

If the above solutions doesn't work, we would be needing more info to solve the issue