Dan*_*ele 9 docker hyperledger hyperledger-fabric
我正在尝试在 Hyperledger Fabric 示例的测试网络中创建一个通道:
localhost:~/fabric-samples/test-network$ ./network.sh createChannel
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
Error: failed to create deliver client for orderer: orderer client failed to connect to localhost:7050: failed to create new connection: context deadline exceeded
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
Error !!! Create channel failed
Run Code Online (Sandbox Code Playgroud)
所有容器都在 Docker 上运行:
localhost:~/fabric-samples/test-network$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96b7f8e1b2a8 hyperledger/fabric-peer:latest "peer node start" 5 minutes ago Up 5 minutes 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com
79a2c0ac6785 hyperledger/fabric-peer:latest "peer node start" 5 minutes ago Up 5 minutes 0.0.0.0:7051->7051/tcp peer0.org1.example.com
f87e809ddaa4 hyperledger/fabric-orderer:latest "orderer" 5 minutes ago Up 5 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
Run Code Online (Sandbox Code Playgroud)
如果我重新启动网络并尝试创建通道,这些是完整的日志:
localhost:~/fabric-samples/test-network$ ./network.sh down
Stopping network
Stopping peer0.org2.example.com ... done
Stopping peer0.org1.example.com ... done
Stopping orderer.example.com ... done
Removing peer0.org2.example.com ... done
Removing peer0.org1.example.com ... done
Removing orderer.example.com ... done
Removing network net_test
Removing volume net_orderer.example.com
Removing volume net_peer0.org1.example.com
Removing volume net_peer0.org2.example.com
Removing network net_test
WARNING: Network net_test not found.
Removing volume net_peer0.org3.example.com
WARNING: Volume net_peer0.org3.example.com not found.
---- No containers available for deletion ----
---- No images available for deletion ----
localhost:~/fabric-samples/test-network$ ./network.sh up
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
LOCAL_VERSION=2.1.1
DOCKER_IMAGE_VERSION=2.1.1
/home/daniele/fabric-samples/test-network/../bin/cryptogen
##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
##########################################################
############ Create Org1 Identities ######################
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
+ set +x
##########################################################
############ Create Org2 Identities ######################
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
+ set +x
##########################################################
############ Create Orderer Org Identities ###############
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
+ set +x
Generate CCP files for Org1 and Org2
/home/daniele/fabric-samples/test-network/../bin/configtxgen
######### Generating Orderer Genesis block ##############
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block
2020-06-24 17:43:43.129 CEST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-06-24 17:43:43.249 CEST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 Orderer.Addresses unset, setting to [127.0.0.1:7050]
2020-06-24 17:43:43.250 CEST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: etcdraft
2020-06-24 17:43:43.251 CEST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2020-06-24 17:43:43.251 CEST [common.tools.configtxgen.localconfig] Load -> INFO 005 Loaded configuration: /home/daniele/fabric-samples/test-network/configtx/configtx.yaml
2020-06-24 17:43:43.257 CEST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2020-06-24 17:43:43.258 CEST [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
+ res=0
+ set +x
Creating network "net_test" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating orderer.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer0.org1.example.com ... done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e569adae90d hyperledger/fabric-orderer:latest "orderer" 10 seconds ago Up 4 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
8cd28fc6db4d hyperledger/fabric-peer:latest "peer node start" 10 seconds ago Up 4 seconds 0.0.0.0:7051->7051/tcp peer0.org1.example.com
c770ba592a1f hyperledger/fabric-peer:latest "peer node start" 10 seconds ago Up Less than a second 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com
localhost:~/fabric-samples/test-network$ ./network.sh createChannel
Creating channel 'mychannel'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb
### Generating channel create transaction 'mychannel.tx' ###
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel.tx -channelID mychannel
2020-06-24 17:44:03.617 CEST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-06-24 17:44:03.764 CEST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/daniele/fabric-samples/test-network/configtx/configtx.yaml
2020-06-24 17:44:03.765 CEST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2020-06-24 17:44:03.774 CEST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
+ res=0
+ set +x
### Generating anchor peer update transactions ###
####### Generating anchor peer update transaction for Org1MSP ##########
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-06-24 17:44:03.899 CEST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-06-24 17:44:04.022 CEST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/daniele/fabric-samples/test-network/configtx/configtx.yaml
2020-06-24 17:44:04.022 CEST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-06-24 17:44:04.028 CEST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x
####### Generating anchor peer update transaction for Org2MSP ##########
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-06-24 17:44:04.172 CEST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-06-24 17:44:04.322 CEST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/daniele/fabric-samples/test-network/configtx/configtx.yaml
2020-06-24 17:44:04.322 CEST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-06-24 17:44:04.329 CEST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x
Creating channel mychannel
Using organization 1
+ peer channel create -o localhost:7050 -c mychannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/mychannel.tx --outputBlock ./channel-artifacts/mychannel.block --tls --cafile /home/daniele/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
+ peer channel create -o localhost:7050 -c mychannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/mychannel.tx --outputBlock ./channel-artifacts/mychannel.block --tls --cafile /home/daniele/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
+ peer channel create -o localhost:7050 -c mychannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/mychannel.tx --outputBlock ./channel-artifacts/mychannel.block --tls --cafile /home/daniele/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
+ peer channel create -o localhost:7050 -c mychannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/mychannel.tx --outputBlock ./channel-artifacts/mychannel.block --tls --cafile /home/daniele/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
Error: failed to create deliver client for orderer: orderer client failed to connect to localhost:7050: failed to create new connection: context deadline exceeded
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
Error !!! Create channel failed
Run Code Online (Sandbox Code Playgroud)
这些是订购者的日志:
2020-06-24 15:43:52.494 UTC [localconfig] completeInitialization -> WARN 001 General.GenesisFile should be replaced by General.BootstrapFile
2020-06-24 15:43:52.497 UTC [localconfig] completeInitialization -> INFO 002 Kafka.Version unset, setting to 0.10.2.0
2020-06-24 15:43:52.497 UTC [orderer.common.server] prettyPrintStruct -> INFO 003 Orderer config values:
General.ListenAddress = "0.0.0.0"
General.ListenPort = 7050
General.TLS.Enabled = true
General.TLS.PrivateKey = "/var/hyperledger/orderer/tls/server.key"
General.TLS.Certificate = "/var/hyperledger/orderer/tls/server.crt"
General.TLS.RootCAs = [/var/hyperledger/orderer/tls/ca.crt]
General.TLS.ClientAuthRequired = false
General.TLS.ClientRootCAs = []
General.Cluster.ListenAddress = ""
General.Cluster.ListenPort = 0
General.Cluster.ServerCertificate = ""
General.Cluster.ServerPrivateKey = ""
General.Cluster.ClientCertificate = "/var/hyperledger/orderer/tls/server.crt"
General.Cluster.ClientPrivateKey = "/var/hyperledger/orderer/tls/server.key"
General.Cluster.RootCAs = [/var/hyperledger/orderer/tls/ca.crt]
General.Cluster.DialTimeout = 5s
General.Cluster.RPCTimeout = 7s
General.Cluster.ReplicationBufferSize = 20971520
General.Cluster.ReplicationPullTimeout = 5s
General.Cluster.ReplicationRetryTimeout = 5s
General.Cluster.ReplicationBackgroundRefreshInterval = 5m0s
General.Cluster.ReplicationMaxRetries = 12
General.Cluster.SendBufferSize = 10
General.Cluster.CertExpirationWarningThreshold = 168h0m0s
General.Cluster.TLSHandshakeTimeShift = 0s
General.Keepalive.ServerMinInterval = 1m0s
General.Keepalive.ServerInterval = 2h0m0s
General.Keepalive.ServerTimeout = 20s
General.ConnectionTimeout = 0s
General.GenesisMethod = "file"
General.GenesisFile = "/var/hyperledger/orderer/orderer.genesis.block"
General.BootstrapMethod = "file"
General.BootstrapFile = "/var/hyperledger/orderer/orderer.genesis.block"
General.Profile.Enabled = false
General.Profile.Address = "0.0.0.0:6060"
General.LocalMSPDir = "/var/hyperledger/orderer/msp"
General.LocalMSPID = "OrdererMSP"
General.BCCSP.ProviderName = "SW"
General.BCCSP.SwOpts.SecLevel = 256
General.BCCSP.SwOpts.HashFamily = "SHA2"
General.BCCSP.SwOpts.Ephemeral = true
General.BCCSP.SwOpts.FileKeystore.KeyStorePath = ""
General.BCCSP.SwOpts.DummyKeystore =
General.BCCSP.SwOpts.InmemKeystore =
General.Authentication.TimeWindow = 15m0s
General.Authentication.NoExpirationChecks = false
FileLedger.Location = "/var/hyperledger/production/orderer"
FileLedger.Prefix = "hyperledger-fabric-ordererledger"
Kafka.Retry.ShortInterval = 5s
Kafka.Retry.ShortTotal = 10m0s
Kafka.Retry.LongInterval = 5m0s
Kafka.Retry.LongTotal = 12h0m0s
Kafka.Retry.NetworkTimeouts.DialTimeout = 10s
Kafka.Retry.NetworkTimeouts.ReadTimeout = 10s
Kafka.Retry.NetworkTimeouts.WriteTimeout = 10s
Kafka.Retry.Metadata.RetryMax = 3
Kafka.Retry.Metadata.RetryBackoff = 250ms
Kafka.Retry.Producer.RetryMax = 3
Kafka.Retry.Producer.RetryBackoff = 100ms
Kafka.Retry.Consumer.RetryBackoff = 2s
Kafka.Verbose = true
Kafka.Version = 0.10.2.0
Kafka.TLS.Enabled = false
Kafka.TLS.PrivateKey = ""
Kafka.TLS.Certificate = ""
Kafka.TLS.RootCAs = []
Kafka.TLS.ClientAuthRequired = false
Kafka.TLS.ClientRootCAs = []
Kafka.SASLPlain.Enabled = false
Kafka.SASLPlain.User = ""
Kafka.SASLPlain.Password = ""
Kafka.Topic.ReplicationFactor = 1
Debug.BroadcastTraceDir = ""
Debug.DeliverTraceDir = ""
Consensus = map[SnapDir:/var/hyperledger/production/orderer/etcdraft/snapshot WALDir:/var/hyperledger/production/orderer/etcdraft/wal]
Operations.ListenAddress = "127.0.0.1:8443"
Operations.TLS.Enabled = false
Operations.TLS.PrivateKey = ""
Operations.TLS.Certificate = ""
Operations.TLS.RootCAs = []
Operations.TLS.ClientAuthRequired = false
Operations.TLS.ClientRootCAs = []
Metrics.Provider = "disabled"
Metrics.Statsd.Network = "udp"
Metrics.Statsd.Address = "127.0.0.1:8125"
Metrics.Statsd.WriteInterval = 30s
Metrics.Statsd.Prefix = ""
2020-06-24 15:43:52.534 UTC [orderer.common.server] initializeServerConfig -> INFO 004 Starting orderer with TLS enabled
2020-06-24 15:43:52.547 UTC [fsblkstorage] NewProvider -> INFO 005 Creating new file ledger directory at /var/hyperledger/production/orderer/chains
2020-06-24 15:43:52.571 UTC [orderer.common.server] extractSysChanLastConfig -> INFO 006 Bootstrapping because no existing channels
2020-06-24 15:43:52.590 UTC [orderer.common.server] Main -> INFO 007 Setting up cluster for orderer type etcdraft
2020-06-24 15:43:52.591 UTC [orderer.common.server] reuseListener -> INFO 008 Cluster listener is not configured, defaulting to use the general listener on port 7050
2020-06-24 15:43:52.591 UTC [fsblkstorage] newBlockfileMgr -> INFO 009 Getting block information from block storage
2020-06-24 15:43:52.646 UTC [orderer.consensus.etcdraft] HandleChain -> INFO 00a EvictionSuspicion not set, defaulting to 10m0s
2020-06-24 15:43:52.650 UTC [orderer.consensus.etcdraft] createOrReadWAL -> INFO 00b No WAL data found, creating new WAL at path '/var/hyperledger/production/orderer/etcdraft/wal/system-channel' channel=system-channel node=1
2020-06-24 15:43:52.656 UTC [orderer.commmon.multichannel] Initialize -> INFO 00c Starting system channel 'system-channel' with genesis block hash 7e6f95c1d82bf6a535276ca517cdde2eeb2d8e99d8182e01c15c7ee43df8d08e and orderer type etcdraft
2020-06-24 15:43:52.658 UTC [orderer.consensus.etcdraft] Start -> INFO 00d Starting Raft node channel=system-channel node=1
2020-06-24 15:43:52.659 UTC [orderer.common.cluster] Configure -> INFO 00e Entering, channel: system-channel, nodes: []
2020-06-24 15:43:52.659 UTC [orderer.common.cluster] Configure -> INFO 00f Exiting
2020-06-24 15:43:52.659 UTC [orderer.consensus.etcdraft] start -> INFO 010 Starting raft node as part of a new channel channel=system-channel node=1
2020-06-24 15:43:52.660 UTC [orderer.consensus.etcdraft] becomeFollower -> INFO 011 1 became follower at term 0 channel=system-channel node=1
2020-06-24 15:43:52.660 UTC [orderer.consensus.etcdraft] newRaft -> INFO 012 newRaft 1 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0] channel=system-channel node=1
2020-06-24 15:43:52.660 UTC [orderer.consensus.etcdraft] becomeFollower -> INFO 013 1 became follower at term 1 channel=system-channel node=1
2020-06-24 15:43:52.661 UTC [orderer.common.server] Main -> INFO 014 Starting orderer:
Version: 2.1.1
Commit SHA: 6393adb
Go version: go1.14.1
OS/Arch: linux/amd64
2020-06-24 15:43:52.664 UTC [orderer.consensus.etcdraft] run -> INFO 015 This node is picked to start campaign channel=system-channel node=1
2020-06-24 15:43:52.673 UTC [orderer.common.server] Main -> INFO 016 Beginning to serve requests
2020-06-24 15:43:52.674 UTC [orderer.consensus.etcdraft] apply -> INFO 017 Applied config change to add node 1, current nodes in channel: [1] channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] Step -> INFO 018 1 is starting a new election at term 1 channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] becomePreCandidate -> INFO 019 1 became pre-candidate at term 1 channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] poll -> INFO 01a 1 received MsgPreVoteResp from 1 at term 1 channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] becomeCandidate -> INFO 01b 1 became candidate at term 2 channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] poll -> INFO 01c 1 received MsgVoteResp from 1 at term 2 channel=system-channel node=1
2020-06-24 15:43:53.674 UTC [orderer.consensus.etcdraft] becomeLeader -> INFO 01d 1 became leader at term 2 channel=system-channel node=1
2020-06-24 15:43:53.675 UTC [orderer.consensus.etcdraft] run -> INFO 01e raft.node: 1 elected leader 1 at term 2 channel=system-channel node=1
2020-06-24 15:43:53.675 UTC [orderer.consensus.etcdraft] run -> INFO 01f Leader 1 is present, quit campaign channel=system-channel node=1
2020-06-24 15:43:53.675 UTC [orderer.consensus.etcdraft] run -> INFO 020 Raft leader changed: 0 -> 1 channel=system-channel node=1
2020-06-24 15:43:53.676 UTC [orderer.consensus.etcdraft] run -> INFO 021 Start accepting requests as Raft leader at block [0] channel=system-channel node=1
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
更新:我能够绕过将 localhost 替换为 docker 子网中订购者容器的 ip(在我的情况下为 172.28.0.3)的问题,我发现这样做:
localhost:~/fabric-samples/test-network$ docker inspect orderer.example.com -f "{{json .NetworkSettings.Networks }}"
{"net_test":{"IPAMConfig":null,"Links":null,"Aliases":["f3fdd48a7076","orderer.example.com"],"NetworkID":"23b404bac1f2961b721d1348ee21d1886268e7094485f4f46b0509133ac4bca2","EndpointID":"b026cba3dc23cb17ba7f3f89f2a776af2447233b1ddb829136e0bc2df34063b9","Gateway":"172.28.0.1","IPAddress":"172.28.0.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:1c:00:03","DriverOpts":null}}
Run Code Online (Sandbox Code Playgroud)
但是,由于容器公开了端口 7050,我也应该能够连接到 localhost,但我不能。也许我必须更改 docker 配置中的某些内容?
从
小智 0
感觉像是连接或设置问题,但可能需要更多数据才能进行 RCA。您能否关闭网络并重新启动它,请在启动 createChannel 后分享完整的日志,它将以类似 \xe2\x80\x9cCreating Channel \xe2\x80\x98mychannel\xe2\x80\x99 的内容开始。如果网络未启动,则尝试使用 CLI 超时 \xe2\x80\x985\xe2\x80\x99 启动节点,CLI 延迟为 \xe2\x80\x983\xe2\x80\x99 秒,并使用数据库 \xe2\x80\ x98leveldb\xe2\x80\x9c
\n ./network.sh down\n ./network.sh up\n ./network.sh createChanel\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
1380 次 |
| 最近记录: |