问题
I am learning hyperledger fabric from the authorized documentation and following the steps given here.
I followed following steps as per documentation to install and run sample applications.
- Installed all prerequisites as per the documentation.
- Cloned github respository from https://github.com/hyperledger/fabric-samples.
- Ran bootstrap.sh script as per commands mentioned in the
readme.md
file (without giving any specific version as command-line parameters thinking that it will install correct latest versions). This command downloaded all binaries in thebin
folder. - Executed
sudo ./network.sh up
command under test-network folder. It showed that 2 peer nodes and 1 orderer node started.
However, when I tried to create channel using ./network.sh createChannel
, it gave me error as
Error: failed to create deliver client: orderer client failed to connect to localhost:7050: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:7050: connect: connection refused" !!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!! ========= ERROR !!! FAILED to execute End-2-End Scenario =========== Error !!! Create channel failed
So, when I checked the status of nodes using docker ps -a
, it gave me following output.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
978968f8e11e hyperledger/fabric-peer:latest "peer node start" About a minute ago Up About a minute 0.0.0.0:9051->9051/tcp peer0.org2.example.com
89914237b249 hyperledger/fabric-orderer:latest "orderer" About a minute ago Exited (2) About a minute ago orderer.example.com
7e79abb2aefa hyperledger/fabric-peer:latest "peer node start" About a minute ago Up About a minute 0.0.0.0:7051->7051/tcp peer0.org1.example.com
0fa38487cdf4 hello-world "/hello" 4 hours ago Exited (0) 4 hours ago brave_galileo
I also get following warning whenever I try to execute network.sh
command -
LOCAL_VERSION=1.4.4 Base Image0.4.18
DOCKER_IMAGE_VERSION=1.4.4
=================== WARNING ===================
Local fabric binaries and docker images are out of sync. This may cause problems.
===============================================
I do not know where to check which binaries are applicable to which docker images.
I tried several ways to keep orderer node alive by doing everything from scratch, giving permissions to all the folder under fabric-samples, down-up sequence of network.sh, restarting the network.sh and few more that I can think of, but still I am not able to keep orderer node alive.
Also I noticed that the statement is mentioned in the documentation that Install the Hyperledger Fabric platform-specific binaries and config files for the version specified into the /bin and /config directories of fabric-samples
However, I did not find any bin and config folder under the given github repository.
回答1:
After lots of trial and error attempts, I could finally make it work.
First of all, I reinstalled the fabric-sample project using following command and made sure that I have correct binaries and docker images (rather than picking up everything latest) -
# Fetch bootstrap.sh from fabric repository using
curl -sS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh -o ./scripts/bootstrap.sh
# Change file mode to executable
chmod +x ./scripts/bootstrap.sh
# Download binaries and docker images - **check out the version below**
./scripts/bootstrap.sh 1.4.4 -s
With this, I could get rid of warnings that I was getting related to out of sync local fabric binaries and docker images.
After that, I tried following troubleshooting steps which led me to the problem area -
I performed all the above
./network.sh
commands but failed to keep orderer node alive.I decided to execute each network.sh command manually on command-prompt as it comes in the script sequentially. With this, I saw that there is no issue with
checkPrereqs
andcreateOrgs
functions.CreateOrgs
function becomes successful both ways - using cryptogen tool and using CA.I commented out
createConsortium
function and executed./network.sh up
command which kept orderer node alive.Found out that
createConsortium
tries to generate genesis block under system-genesis-block folder and because of some reason, rather than generating file with the name genesis-block, there was the read-only folder named genesis-block due to whichconfigtxgen
command was failing.
Thus, I removed read-only permissions from this block and deleted the genesis-block folder and re-run ./network.sh down
and ./network.sh up
command after un-commenting createConsortium
function, which resulted in the generation of a genesis block file rather than folder and thus, finally, I could manage to keep orderer node alive.
After this, I could successfully create channel using following command.
./network.sh createChannel
回答2:
I think you have specified incorrect path for the genesis block. can you post your orderer logs?
回答3:
Thanks to the best answer, I managed to get ./network.sh createChannel
script working by changing permissions of the genesis block file:
chmod 664 system-genesis-block/genesis.block
回答4:
I managed to get ./network.sh createChannel script working by changing permissions of the genesis block file. chmod 777 didn't work for me.
chmod 777 genesis.block
来源:https://stackoverflow.com/questions/59734794/orderer-node-exits-within-few-seconds-after-execution-of-network-sh-up-command