如何在 Hyperledger Fabric 中执行“peer node pause”命令?

问题描述

如果我运行此命令 peer node pause -c mychannel 会发生以下错误

Error: as another peer node command is executing,wait for that command to complete its execution or terminate it before retrying: lock is already acquired on file /var/hyperledger/production/ledgersData/fileLock
Usage:
  peer node pause [flags]

Flags:
  -c,--channelID string   Channel to pause.
  -h,--help               help for pause

/opt/gopath/src/github.com/hyperledger/fabric/peer # peer node pause -h
Pauses a channel on the peer. When the command is executed,the peer must be offline. When the peer starts after a pause,it will not receive blocks for the paused channel.

我了解到对端需要处于离线状态才能执行此命令。但是我怎样才能使对等方离线。没有 Peer node stop 这样的命令。我看到的唯一方法是使用docker命令来停止容器,但这没有任何意义,好像我停止了容器我将无法进入容器。

请任何人帮我执行 peer node pause 命令!

解决方法

检查用于启动容器的命令。

peer0.org1.example.com:
    container_name: peer0.org1.example.com
    image: hyperledger/fabric-peer:latest
    labels:
      service: hyperledger-fabric
    environment:
      #Generic peer variables
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_test
      - FABRIC_LOGGING_SPEC=INFO
      #- FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_PROFILE_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
      # Peer specific variabes
      - CORE_PEER_ID=peer0.org1.example.com
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
    volumes:
        - /var/run/docker.sock:/host/var/run/docker.sock
        - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
        - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
        - peer0.org1.example.com:/var/hyperledger/production
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    ports:
      - 7051:7051
    networks:
      - test

当您使用命令:peer node start 命令启动对等容器时。 根据结构文档,peer node start 命令 - 启动与网络交互的节点。 因此,当您启动容器时,节点正在启动,我还没有尝试过,但是您可以用 peer node pause -c mychannel 替换该命令,因为节点尚未启动,这意味着对等方处于离线状态。你可以试试这个。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...