首页 > 解决方案 > 尝试使分类帐在 rafts 中持久存在时出错

问题描述

我正在尝试使 rafts 的分类帐将所有数据持久存储在指向主机中 SMB 的 docker bind mount 中。

由于某种原因,我不知道何时启动 raft 的容器,我收到以下错误

2020-08-03 08:24:03.598 UTC [orderer.consensus.etcdraft] CreateStorage -> DEBU 432 No snapshot found at /var/hyperledger/production/orderer/etcdraft/snapshot/sys-channel channel=sys-channel node=1
2020-08-03 08:24:03.602 UTC [orderer.consensus.etcdraft] createOrReadWAL -> INFO 433 No WAL data found, creating new WAL at path '/var/hyperledger/production/orderer/etcdraft/wal/sys-channel' channel=sys-channel node=1
2020-08-03 08:24:04.033 UTC [orderer.consensus.etcdraft] renameWAL -> INFO 434 closing WAL to release flock and retry directory renaming channel=sys-channel node=1 from=/var/hyperledger/production/orderer/etcdraft/wal/sys-channel.tmp to=/var/hyperledger/production/orderer/etcdraft/wal/sys-channel
2020-08-03 08:24:04.402 UTC [orderer.consensus.etcdraft] createOrReadWAL -> WARN 435 failed to fsync the parent data directory file channel=sys-channel node=1 parent-dir-path=/var/hyperledger/production/orderer/etcdraft/wal dir-path=/var/hyperledger/production/orderer/etcdraft/wal/sys-channel error="sync /var/hyperledger/production/orderer/etcdraft/wal: invalid argument"
2020-08-03 08:24:04.403 UTC [orderer.commmon.multichannel] newChainSupport -> PANI 436 [channel: sys-channel] Error creating consenter: failed to restore persisted raft data: failed to create or read WAL: failed to initialize WAL: sync /var/hyperledger/production/orderer/etcdraft/wal: invalid argument
panic: [channel: sys-channel] Error creating consenter: failed to restore persisted raft data: failed to create or read WAL: failed to initialize WAL: sync /var/hyperledger/production/orderer/etcdraft/wal: invalid argument

goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc00013dad0, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x546
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc000010320, 0x4, 0x155b2e6, 0x2a, 0xc0001eddd8, 0x2, 0x2, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0x101
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(...)
        /opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panicf(...)
        /opt/gopath/src/github.com/hyperledger/fabric/common/flogging/zap.go:74
github.com/hyperledger/fabric/orderer/common/multichannel.newChainSupport(0xc0001ba000, 0xc00022c2c0, 0xc0001f0f60, 0x16baba0, 0x21449b0, 0xc0000a1090, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/multichannel/chainsupport.go:74 +0x92e
github.com/hyperledger/fabric/orderer/common/multichannel.(*Registrar).Initialize(0xc0001ba000, 0xc0001f0f60)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:168 +0x252
github.com/hyperledger/fabric/orderer/common/server.initializeMultichannelRegistrar(0xc0003fc140, 0xc000086720, 0xc0002de380, 0x0, 0xc0002c23f0, 0x20e7980, 0xc0004e8440, 0x2, 0x2, 0xc0004e8450, ...)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:681 +0x4c3
github.com/hyperledger/fabric/orderer/common/server.Start(0x1532c3e, 0x5, 0xc000280900)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:189 +0xaa5
github.com/hyperledger/fabric/orderer/common/server.Main()
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:91 +0x208
main.main()
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:15 +0x20

我的 raft yaml 的示例如下:

  raft1:
      logging:
        options:
          max-size: 5m
      image: hyperledger/fabric-orderer:1.4.6
      container_name: raft1
      ports:
        - "7050:7050"
      environment:
        # My env vars
      volumes:
        - "/mnt/raft1-private/crypto:/opt/crypto"
        - "/mnt/rafts-public/genesis:/corp/genesis"
        - "/mnt/raftvm1-public/ledger/raft1/:/var/hyperledger/"
      command:
        - bash
        - -c
        - |
          echo "Starting Raft1..."
          orderer

这只发生在分类帐文件夹指向 SMB 时,如果我将 docker mount 绑定到我的主机的文件夹,则 raft 可以正常工作。

标签: hyperledger-fabricblockchainhyperledger

解决方案


Hyperledger Fabric 的基于 Raft 的排序服务使用 etcdraft 实现。

本期所述,CIFS 文件系统类型(此处由 SMB / Samba 实现)不能正确支持 etcd WAL 实现安全运行所需的所有文件系统操作。特别是,CIFS 不支持fsync()对目录的操作。除非这个问题在上游 etcd 项目中得到解决,或者直到 CIFS 文件系统实现支持这个特性,否则你需要选择一个不同的文件系统。


推荐阅读