Akash Sethi
Akash Sethi

Reputation: 2294

Hyperledger Fabric Peer Connection error with Orderer

I am trying to connect the peer with the orderer in the local machine. Here is what I have done so far.

I started the Orderer after starting the Fabric CA Server

export ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
export ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
export ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
export ORDERER_GENERAL_LISTENADDRESS=192.168.2.103
export ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
export ORDERER_GENERAL_LOGLEVEL=debug
export ORDERER_GENERAL_GENESISMETHOD=file
export ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
export FABRIC_CFG_PATH=/etc/hyperledger/fabric
export ORDERER_GENERAL_TLS_ENABLED=true
orderer

Then I am trying to start the fabric peer using this command.

 export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
 export CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
 export CORE_PEER_GOSSIP_ORGLEADER=false
 export CORE_PEER_PROFILE_ENABLED=true
 export CORE_PEER_LOCALMSPID=Org1MSP
 export CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
 export CORE_PEER_TLS_ENABLED=true
 export CORE_PEER_ID=peer0.org1.example.com
 export CORE_LOGGING_LEVEL=DEBUG
 export CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
 export FABRIC_CFG_PATH=/etc/hyperledger/fabric
 export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
 export CORE_PEER_GOSSIP_USELEADERELECTION=true

I already copied the necessary files to the required directory as experter above after that I ran the command peer node start This command is giving me error

2017-12-26 18:22:47.613 IST [deliveryClient] connect -> DEBU 32e Connected to 2017-12-26 18:22:47.613 IST [deliveryClient] connect -> ERRO 32f Failed obtaining connection: Could not connect to any of the endpoints: [orderer.example.com:7050] 2017-12-26 18:22:47.614 IST [deliveryClient] try -> WARN 330 Got error: Could not connect to any of the endpoints: [orderer.example.com:7050] ,at 8 attempt. Retrying in 2m8s

On the orderer side I am getting this

2017-12-26 18:24:55.617 IST [grpc] Printf -> DEBU 191 grpc: Server.Serve failed to complete security handshake from "192.168.2.103:56580": EOF

Can anyone tell What i am doing wrong here?

Thanks

Upvotes: 3

Views: 6320

Answers (2)

Artem Barger
Artem Barger

Reputation: 41232

I think that the problem in your case is that you are trying to use configuration transaction produced for fabric-sample which encodes ordering service endpoint to be orderer.example.com:7050 while running you local machine this address is not reachable. So as an easy solution to this you can extend your /etc/hosts file and make orderer.example.com domain name to point on your localhost. Second option would be to change ordering service endpoint within config transaction, e.g. configtx.yaml:

################################################################################
#
#   SECTION: Orderer
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo" and "kafka"
    OrdererType: solo

    Addresses:
        - localhost:7050

    # Batch Timeout: The amount of time to wait before creating a batch
    BatchTimeout: 2s

    # Batch Size: Controls the number of messages batched into a block
    BatchSize:

        # Max Message Count: The maximum number of messages to permit in a batch
        MaxMessageCount: 10

        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
        # the serialized messages in a batch.
        AbsoluteMaxBytes: 98 MB

        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
        # the serialized messages in a batch. A message larger than the preferred
        # max bytes will result in a batch larger than preferred max bytes.
        PreferredMaxBytes: 512 KB

    Kafka:
        # Brokers: A list of Kafka brokers to which the orderer connects
        # NOTE: Use IP:port notation
        Brokers:
            - 127.0.0.1:9092

    # Organizations is the list of orgs which are defined as participants on
    # the orderer side of the network
    Organizations:

Basically you need to change following line:

    Addresses:
        - PUT_HERE_CORRECT_IP_ADDRESS:7050

Next you need to run configtxgen tool to get updated configuration transaction block.

Upvotes: 2

jworthington
jworthington

Reputation: 723

Whenever I have had that it was incorrect certs. Last time it took me half a day to find I had copied peer1.org1 certs into peer1.org2 folder on an orderer. (For me, org2 is a different CA server). Once I had 1 wrong MSPDir path in the configtx.yaml used to create the channel block.

Upvotes: 0

Related Questions