Hyperledger Fabric:将排序者加入通道失败,"http: request body too large"



我用

创建了一个通道生成块
configtxgen 
-profile ${CHANNEL_PROFILE} 
-configPath ./artifacts/config 
-outputBlock artifacts/channels/${CHANNEL_NAME}/${CHANNEL_NAME}.block 
-channelID ${CHANNEL_NAME}

是成功的。然后,我尝试使用以下命令向通道添加订单:

osnadmin channel join 
--channelID=telemetry 
--config-block ./artifacts/channels/telemetry/telemetry.block 
-o localhost:7055 
--ca-file ${CA_FILE} 
--client-cert ${CLIENT_CERT} 
--client-key ${CLIENT_KEY}

,并得到以下响应:

Status: 400
{
"error": "cannot read form from request body: multipart: NextPart: http: request body too large"
}

我configtx.yaml:

Organizations:
- &faa
Name: faa
SkipAsForeign: false
ID: faaMSP
MSPDir: ../../artifacts/crypto/faa.uam.nasa.gov/msp
Policies:
Readers:
Type: Signature
Rule: "OR('faaMSP.admin', 'faaMSP.peer', 'faaMSP.client')"
Writers:
Type: Signature
Rule: "OR('faaMSP.admin', 'faaMSP.peer', 'faaMSP.client')"
Admins:
Type: Signature
Rule: "OR('faaMSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('faaMSP.peer')"
OrdererEndpoints:
- orderer0.faa.uam.nasa.gov:7050
AnchorPeers:
- Host: peer0.faa.uam.nasa.gov
Port: 7051
- &air-taxi-service
Name: air-taxi-service
SkipAsForeign: false
ID: air-taxi-serviceMSP
MSPDir: ../../artifacts/crypto/air-taxi-service.uam.nasa.gov/msp
Policies:
Readers:
Type: Signature
Rule: "OR('air-taxi-serviceMSP.admin', 'air-taxi-serviceMSP.peer', 'air-taxi-serviceMSP.client')"
Writers:
Type: Signature
Rule: "OR('air-taxi-serviceMSP.admin', 'air-taxi-serviceMSP.peer', 'air-taxi-serviceMSP.client')"
Admins:
Type: Signature
Rule: "OR('air-taxi-serviceMSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('air-taxi-serviceMSP.peer')"
OrdererEndpoints:
- orderer0.faa.uam.nasa.gov:7050
AnchorPeers:
- Host: peer0.air-taxi-service.uam.nasa.gov
Port: 8051
Capabilities:
Channel: &ChannelCapabilities
V2_0: true
Orderer: &OrdererCapabilities
V2_0: true
Application: &ApplicationCapabilities
V2_0: true
Application: &ApplicationDefaults
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "ANY Admins"
LifecycleEndorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Endorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Capabilities:
<<: *ApplicationCapabilities
Orderer: &OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: orderer0.faa.uam.nasa.gov
Port: 7050
ClientTLSCert: ../../artifacts/crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls/server.crt
ServerTLSCert: ../../artifacts/crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls/server.crt
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 20
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Channel: &ChannelDefaults
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
Capabilities:
<<: *ChannelCapabilities
Profiles:
UAMProfile:
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *faa
- *air-taxi-service
Capabilities:
<<: *ApplicationCapabilities
Orderer:
<<: *OrdererDefaults
Organizations:
- *faa
Capabilities:
<<: *OrdererCapabilities

我的定序者。yaml文件:

---
General:
ListenAddress: 0.0.0.0
ListenPort: 7050
TLS:
Enabled: true
PrivateKey: /var/hyperledger/orderer/tls/server.key
Certificate: /var/hyperledger/orderer/tls/server.crt
RootCAs:
ClientAuthRequired: false
ClientRootCAs:
Keepalive:
ServerMinInterval: 60s
ServerInterval: 7200s
ServerTimeout: 20s
Cluster:
SendBufferSize: 50
ClientCertificate:
# ClientPrivateKey governs the file location of the private key of the client TLS certificate.
ClientPrivateKey:
ListenPort:
ListenAddress:
ServerCertificate:
ServerPrivateKey:
BootstrapMethod: none
BootstrapFile:
LocalMSPDir: /var/hyperledger/orderer/msp
LocalMSPID: faaMSP
Profile:
Enabled: false
Address: 0.0.0.0:6060
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
FileKeyStore:
KeyStore:
PKCS11:
Library:
Label:
Pin:
Hash:
Security:
FileKeyStore:
KeyStore:
Authentication:
TimeWindow: 15m
FileLedger:
Location: /var/hyperledger/production/orderer
Prefix: hyperledger-fabric-ordererledger
Kafka:
Retry:
ShortInterval: 5s
ShortTotal: 10m
LongInterval: 5m
LongTotal: 12h
NetworkTimeouts:
DialTimeout: 10s
ReadTimeout: 10s
WriteTimeout: 10s
Metadata:
RetryBackoff: 250ms
RetryMax: 3
Producer:
RetryBackoff: 100ms
RetryMax: 3
Consumer:
RetryBackoff: 2s
Topic:
ReplicationFactor: 3
Verbose: false
TLS:
Enabled: false
PrivateKey:
#File: path/to/PrivateKey
Certificate:
#File: path/to/Certificate
RootCAs:
#File: path/to/RootCAs
SASLPlain:
Enabled: false
User:
Password:
Version:
Debug:
BroadcastTraceDir:
DeliverTraceDir:
Operations:
ListenAddress: 127.0.0.1:8443
TLS:
Enabled: false
Certificate:
PrivateKey:
ClientAuthRequired: false
ClientRootCAs: []
Metrics:
Provider: disabled
Statsd:
Network: udp
Address: 127.0.0.1:8125
WriteInterval: 30s
Prefix:
Consensus:
WALDir: /var/hyperledger/production/orderer/etcdraft/wal
SnapDir: /var/hyperledger/production/orderer/etcdraft/snapshot
Admin:
ListenAddress: 0.0.0.0:7055
TLS:
Enabled: true
PrivateKey: /var/hyperledger/orderer/tls/server.key
Certificate: /var/hyperledger/orderer/tls/server.crt
ClientAuthRequired: true
ClientRootCAs: /var/hyperledger/orderer/users/admin0@faa.uam.nasa.gov/msp/cacerts/localhost-7054-ca-faa.uam.nasa.gov.pem
ChannelParticipation:
Enabled: true

我orderer-docker-compose。yaml文件:

version: "2"
networks:
uam.nasa.gov:
services:
orderer0.faa.uam.nasa.gov:
container_name: orderer0.faa.uam.nasa.gov
image: hyperledger/fabric-orderer:2.3
dns_search: .
environment:
- ORDERER_GENERAL_LOGLEVEL=INFO
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
# - ORDERER_GENERAL_GENESISMETHOD=file
# - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/orderer/genesis.block
- ORDERER_GENERAL_LOCALMSPID=faaMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_BOOTSTRAPMETHOD=none
- ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7055
- ORDERER_ADMIN_TLS_ENABLED=true
- ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_ADMIN_TLS_CLIENTAUTHREQUIRED=true
- ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/admin/tls/ca.crt]
- FABRIC_CFG_PATH=/var/hyperledger/config
- ORDERER_CHANNELPARTICIPATION_ENABLED=true
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderers
command: orderer start
volumes:
- ../../crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/msp:/var/hyperledger/orderer/msp
- ../../crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls:/var/hyperledger/orderer/tls
- ../../crypto/faa.uam.nasa.gov/users:/var/hyperledger/orderer/users
- ../../crypto/faa.uam.nasa.gov/users/admin0@faa.uam.nasa.gov:/var/hyperledger/orderer/admin
- ./:/var/hyperledger/config
ports:
- 7050:7050
- 7055:7055
networks:
- uam.nasa.gov

我尝试将GRPC_MAX_RECV_MSG_SIZE设置为更大的值,以及升级到最新版本的超级账本结构,但似乎不起作用。

在订单中添加下面的代码片段。你的问题将被修复:

ChannelParticipation:
Enabled: true
MaxRequestBodySize: 1 MB