Setting up a multi node Hyperledger Fabric network with Docker Swarm | Skcript

(Saeedi) #11

If containers for peers, orderer and ca are running on worker node and you are having trouble executing invoke or query command. In manager node, script uses following command to do a query

docker exec hlf_services_cli.1.l5iv1ts55wdgh6idxibhxdboq peer chaincode query …

As you can see it uses or it first access cli container present on manager node and there is no cli container running on worker node. So for same command to work on worker node, use docker ps on worker node and copy the name of peer0 container and replace it with that in above command. i.e. above command would become

docker exec hlf_peer_peer0_org2.1.o2xcs7xb7hjo4fe2sc3ke62li peer chaincode query …

It worked in my case. Hope it works for you too.

(Abiram) #12

Hi Saeedi,

Thanks for the reply . it helped .
The scenario you told will be then only working for the query commands.

But when I am trying to do a invoke from the worker node it is throwing error as :

Error: Error getting broadcast client: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file: open /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem: no such file or directory

So the command I used for invoke on org3 is :

docker exec hlf_peer_peer0_org3.1.lkyv7vijri5lvbueiyvuv0ia6 peer chaincode invoke -o orderer2.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer2.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n simplecc2 -c '{“Args”:[“open”,“104”,“2000”]}'

but no success even though all the certs related to the orderer are present in the above mentioned path that is /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer2.example.com/msp/tlscacerts/tlsca.example.com-cert.pem.

Is there anything in the configuration file that i am missing ?

(Saeedi) #13

Try replacing orderer2 with orderer0 in command. Just for testing purpose. If you are using multiple machines or vms, make sure that you have executed move_crypto.sh on every other machine.

(Sri Harsha) #14

OrdererOrgs:

  • Name: Orderer
    Domain: example.com
    Specs:
    • Hostname: orderer
      Template:
      Count: 4
      Specs:
    • Hostname: orderer0
    • Hostname: orderer1
    • Hostname: orderer2
    • Hostname: orderer3
    • Hostname: orderer4
    • Hostname: orderer5
    • Hostname: orderer6

Wouldn’t mentioning specs and templates cause a naming conflict?
From fabric docs:
Template and Specs are not mutually exclusive. You may define both
sections and the aggregate nodes will be created for you. Take care with name collisions.

(Sunil Suseelan) #15

Can you explain the purpose of below command in move_crypto.sh

git clone https://github.com/hyperledger/fabric /var/mynetwork/fabric-src/hyperledger/fabric
cd /var/mynetwork/fabric-src/hyperledger/fabric

(Varun Raj) #16

This is to move the crypto materials to a common path in all the nodes so that it can be mounted inside the containers.

(Sunil Suseelan) #17

But why do we need to clone the git repo for fabric, are we using it somewhere internally

(Sunil Suseelan) #18

Hello Varun,

Am able to set the network over docker swarm and all the nodes are running but during while connecting peer’s for Org2 after creating channel it waits for sometime and fails with below error

2018-12-24 12:51:41.500 UTC [grpc] switchBalancer -> DEBU 03b ClientConn switching balancer to "pick_first"
2018-12-24 12:51:41.500 UTC [grpc] HandleSubConnStateChange -> DEBU 03c pickfirstBalancer: HandleSubConnStateChange: 0xc4205a5ca0, CONNECTING
2018-12-24 12:51:41.507 UTC [grpc] HandleSubConnStateChange -> DEBU 03d pickfirstBalancer: HandleSubConnStateChange: 0xc4205a5ca0, READY
2018-12-24 12:51:41.507 UTC [channelCmd] InitCmdFactory -> INFO 03e Endorser and orderer connections initialized
2018-12-24 12:51:41.508 UTC [msp/identity] Sign -> DEBU 03f Sign: plaintext: 0AA0070A5C08011A0C08DDAC83E10510...46581AFDD31A1A080A000A000A000A00
2018-12-24 12:51:41.508 UTC [msp/identity] Sign -> DEBU 040 Sign: digest: A242B423622814E2FC4C2B62D1DDCAB0DFF58E570EF16CB5C8E7E19BB94935EB
Error: proposal failed (err: rpc error: code = Unavailable desc = transport is closing)

Can you please suggest if am missing anything

(Munesh Rawat) #19

Hi all,
I have implemented multi node setup on two VMs. first VM is as a manager node and second one is as a worker node. and i have also created channel and join the channel to peers of Org1 (manager node VM1). And also able to invoke and query for ORG1 (VM1). but when i am going to join peers of ORG2 (worker node VM2) then not able to do that. and also not able to telnet ORG2 containers on manager node.

So please help me???

(Munesh Rawat) #20

Hi all,
i want to implement ZKP identity mixer using fabric 1.3 with java sdk.
So is there any implementation for that???

(Abiram) #21

Is there anyone who does have any idea what this error means. Any help will be appreciated.

This error I got, when I am trying to create the channel after registering user related to the organisations through the node js scripts.

recoveryParam: 1 }
error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE: Connect Failed\n at createStatusError (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:64:15)\n at ClientDuplexStream._emitStatusIfDone (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:270:19)\n at ClientDuplexStream._readsDone (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:236:8)\n at readCallback (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:296:12)"
[2018-12-27 09:33:28.359] [ERROR] Create-Channel - Error: SERVICE_UNAVAILABLE
** at ClientDuplexStream. (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/fabric-client/lib/Orderer.js:136:21)**
** at emitOne (events.js:116:13)**
** at ClientDuplexStream.emit (events.js:211:7)**
** at ClientDuplexStream._emitStatusIfDone (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:271:12)**
** at ClientDuplexStream._readsDone (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:236:8)**
** at readCallback (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/node_modules/grpc/src/client.js:296:12)**
[2018-12-27 09:33:28.359] [ERROR] fabric-setup - Error in setting up organization Error: Failed to initialize the channel: Error: SERVICE_UNAVAILABLE
** at Object.createChannel (/home/ubuntu/MultiNodeSetUp/AWSRepo/hlf-docker-swarm/network/app/create-channel.js:65:9)**
** at **
** at process._tickCallback (internal/process/next_tick.js:188:7)**

(Varun Raj) #22

We use it for chaincode container. The chaincode contain won’t have some files by default so we’re using the one in github.

(Alberto Carmona) #23

Thank you very much for the tutorial, it is really helpful. I can’t manage to deploy kafka correctly and it fails, everything else is up and running, I get a shutdown state with “task: non-zero exit (1)”. Can you help me please? Thanks!

(Munesh Rawat) #24

Hi all,
I have implemented multi node setup on two VMs. first VM is as a manager node and second one is as a worker node. and i have also created channel and join the channel to peers of Org1 (manager node VM1). And also able to invoke and query for ORG1 (VM1). but when i am going to join peers of ORG2 (worker node VM2) then not able to do that. and also not able to telnet ORG2 containers on manager node.

So please help me???

(Varun Raj) #25

Check the logs with docker service ps <service_id>

(Alberto Carmona) #26

Thanks for the response, I was able to solve it but I haven’t been able to use the SDK properly, I get the following error:

2019-02-04T12:34:45.710Z - error: [Network]: _initializeInternalChannel: Unable to initialize channel. Attempted to contact 6 Peers. Last error was Error: 2 UNKNOWN: Stream removed
Error processing transaction. Error: Unable to initialize channel. 
Attempted to contact 6 Peers. Last error was Error: 2 UNKNOWN: Stream removed
Error: Unable to initialize channel. Attempted to contact 6 Peers. Last error was Error: 2 UNKNOWN: Stream removed
at Network._initializeInternalChannel (/home/alberto/ibotics-network-1/application/node_modules/fabric-network/lib/network.js:127:12)
Disconnect from Fabric gateway.
Issue program complete.

Have you been able to run the SDK in your example?

If not, what’s the best approach to develop an application that interacts with the CLI?

Many thanks

1 Like
#27

Nice tutorial, I have a question regards CLI. if I have CLI container in one physical machine, can other physical machines use it to execute transactions? or the other machines should also have CLI container?

thank you

#28

I dont have this path working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
is this going to cause a problem ?

1 Like
(Stephen Man) #29

Hi, thanks for the tutorial, it does help!
However, I have encountered an error while running on the last step. Regarding the “Invoking Initledger in chaincode” in the scripts/install_chaincode.sh (i.e. docker exec “$CLI_NAME” peer chaincode invoke -o “$ORDERER_NAME”:7050 --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n $CC_NAME -c ‘{“Args”:[“initLedger”]}’)
There is error as below:

================================

INVOKING INITLEDGER IN CHAINCODE

================================

docker exec “$CLI_NAME” peer chaincode invoke -o “$ORDERER_NAME”:7050 --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n $CC_NAME -c ‘{“Args”:[“initLedger”]}’

2019-03-27 02:12:23.364 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP

2019-03-27 02:12:23.364 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity

2019-03-27 02:12:23.369 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc

2019-03-27 02:12:23.369 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc

2019-03-27 02:12:23.369 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled

2019-03-27 02:12:23.369 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AA9070A6908031A0C0887B8EBE40510…6C651A0C0A0A696E69744C6564676572

2019-03-27 02:12:23.369 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: F4CFC4B7E557041AC78DF3ECF43994C28B7890FB78A249B7739DAFAAE325C791

Error: Error endorsing invoke: rpc error: code = Unknown desc = chaincode error (status: 500, message: {“code”:301, “reason”: “command format is wrong”}) - <=== THIS IS THE ERROR

Could you help? Thanks!

(Lê Việt đức) #30

hi [Varun Raj],
I had issues when deployed ./scripts/create_channel.sh

“Error: Error getting endorser client channel: endorser client failed to connect to peer0.org2.example.com:7051: failed to create new connection: context deadline exceeded”
I don’t known why ?
Please help me !Tks !