hyperledger fabric:"peer" 在频道创建和加入过程中无法识别 - 第一个网络
hyperledger fabric: "peer" not recognized during channel creation & joining - first network
我大致按照 http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#troubleshoot 创建了我的第一个网络。
为简单起见,我在 first-network 中创建了一个单独的文件夹 mn,并且仅从 crypto-config.yaml, cryptogen, configtx.yaml, configtxgen、docker-compose-cli.yaml 和 base 文件夹在 mn文件夹,观察什么时候创建的,也可以消除bin路径混乱。
我以相同的顺序执行了以下命令:
./cryptogen generate --config=./crypto-config.yaml
./configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
./configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID testhimani
./configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID testhimani -asOrg Org1MSP
./configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID testhimani -asOrg Org2MSP
docker exec -it cli bash
执行完最后一条命令后,我不得不打开一个新终端window,as I couldn't get the command input "$"。
在新终端上,在执行频道创建和加入命令时,我收到 "peer" 命令未找到的错误。
himani@himani-HP-Notebook:~/fabric-samples/first-network/mn$ peer channel create -o orderer.example.com:7050 -c testhimani -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
No command 'peer' found, did you mean:
Command 'pee' from package 'moreutils' (universe)
Command 'pear' from package 'php-pear' (main)
Command 'peet' from package 'pipexec' (universe)
Command 'beer' from package 'gerstensaft' (universe)
peer: command not found
更新
在 # 而不是在新终端上之后在同一终端中执行命令后的错误如下:
himani@himani-HP-Notebook:~/fabric-samples/first-network/pg$ docker exec -it cli bash
root@0404332355e0:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c testhimani -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
Usage:
peer channel create [flags]
Flags:
-c, --channelID string In case of a newChain command, the channel ID to create.
-f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
-t, --timeout int Channel creation timeout (default 5)
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
更新 2:
我觉得我的 docker ps 中缺少订购者。我该如何照顾它?
himani@himani-HP-Notebook:~/fabric-samples/first-network/pg$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0404332355e0 hyperledger/fabric-tools:latest "/bin/bash" 2 days ago Up 2 days cli
68075835c9f9 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
8a76208f8411 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
87a73761dfc7 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
9ab8cbc25f99 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
一旦你执行
docker exec -it cli bash
您将获得正在使用的 cli 的新 tty。您将在同一终端中收到 # 而不是 $ 的提示。
如果你打开一个新的终端window,它仍然是你的系统cli。
根据您的屏幕截图,您走在正确的道路上。这就是你必须执行下一个命令的地方。
我大致按照 http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#troubleshoot 创建了我的第一个网络。
为简单起见,我在 first-network 中创建了一个单独的文件夹 mn,并且仅从 crypto-config.yaml, cryptogen, configtx.yaml, configtxgen、docker-compose-cli.yaml 和 base 文件夹在 mn文件夹,观察什么时候创建的,也可以消除bin路径混乱。
我以相同的顺序执行了以下命令:
./cryptogen generate --config=./crypto-config.yaml
./configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
./configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID testhimani
./configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID testhimani -asOrg Org1MSP
./configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID testhimani -asOrg Org2MSP
docker exec -it cli bash
执行完最后一条命令后,我不得不打开一个新终端window,as I couldn't get the command input "$"。
在新终端上,在执行频道创建和加入命令时,我收到 "peer" 命令未找到的错误。
himani@himani-HP-Notebook:~/fabric-samples/first-network/mn$ peer channel create -o orderer.example.com:7050 -c testhimani -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
No command 'peer' found, did you mean:
Command 'pee' from package 'moreutils' (universe)
Command 'pear' from package 'php-pear' (main)
Command 'peet' from package 'pipexec' (universe)
Command 'beer' from package 'gerstensaft' (universe)
peer: command not found
更新 在 # 而不是在新终端上之后在同一终端中执行命令后的错误如下:
himani@himani-HP-Notebook:~/fabric-samples/first-network/pg$ docker exec -it cli bash
root@0404332355e0:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c testhimani -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
Usage:
peer channel create [flags]
Flags:
-c, --channelID string In case of a newChain command, the channel ID to create.
-f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
-t, --timeout int Channel creation timeout (default 5)
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
更新 2: 我觉得我的 docker ps 中缺少订购者。我该如何照顾它?
himani@himani-HP-Notebook:~/fabric-samples/first-network/pg$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0404332355e0 hyperledger/fabric-tools:latest "/bin/bash" 2 days ago Up 2 days cli
68075835c9f9 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
8a76208f8411 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
87a73761dfc7 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
9ab8cbc25f99 hyperledger/fabric-peer:latest "peer node start" 2 days ago Up 2 days 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
一旦你执行
docker exec -it cli bash
您将获得正在使用的 cli 的新 tty。您将在同一终端中收到 # 而不是 $ 的提示。
如果你打开一个新的终端window,它仍然是你的系统cli。
根据您的屏幕截图,您走在正确的道路上。这就是你必须执行下一个命令的地方。