github.com/kaituanwang/hyperledger@v2.0.1+incompatible/docs/source/commands/peernode.md (about)

     1  # peer node
     2  
     3  The `peer node` command allows an administrator to start a peer node,
     4  reset all channels in a peer to the genesis block, or rollback a
     5  channel to a given block number.
     6  
     7  ## Syntax
     8  
     9  The `peer node` command has the following subcommands:
    10  
    11    * start
    12    * reset
    13    * rollback
    14  
    15  ## peer node start
    16  ```
    17  Starts a node that interacts with the network.
    18  
    19  Usage:
    20    peer node start [flags]
    21  
    22  Flags:
    23    -h, --help                help for start
    24        --peer-chaincodedev   start peer in chaincode development mode
    25  ```
    26  
    27  
    28  ## peer node reset
    29  ```
    30  Resets all channels to the genesis block. When the command is executed, the peer must be offline. When the peer starts after the reset, it will receive blocks starting with block number one from an orderer or another peer to rebuild the block store and state database.
    31  
    32  Usage:
    33    peer node reset [flags]
    34  
    35  Flags:
    36    -h, --help   help for reset
    37  ```
    38  
    39  
    40  ## peer node rollback
    41  ```
    42  Rolls back a channel to a specified block number. When the command is executed, the peer must be offline. When the peer starts after the rollback, it will receive blocks, which got removed during the rollback, from an orderer or another peer to rebuild the block store and state database.
    43  
    44  Usage:
    45    peer node rollback [flags]
    46  
    47  Flags:
    48    -b, --blockNumber uint   Block number to which the channel needs to be rolled back to.
    49    -c, --channelID string   Channel to rollback.
    50    -h, --help               help for rollback
    51  ```
    52  
    53  ## Example Usage
    54  
    55  ### peer node start example
    56  
    57  The following command:
    58  
    59  ```
    60  peer node start --peer-chaincodedev
    61  ```
    62  
    63  starts a peer node in chaincode development mode. Normally chaincode containers are started
    64  and maintained by peer. However in chaincode development mode, chaincode is built and started by the user. This mode is useful during chaincode development phase for iterative development.
    65  See more information on development mode in the [chaincode tutorial](../chaincode4ade.html).
    66  
    67  ### peer node reset example
    68  
    69  ```
    70  peer node reset
    71  ```
    72  
    73  resets all channels in the peer to the genesis block, i.e., the first block in the channel. The command also records the pre-reset height of each channel in the file system. Note that the peer process should be stopped while executing this command. If the peer process is running, this command detects that and returns an error instead of performing the reset. When the peer is started after performing the reset, the peer will fetch the blocks for each channel which were removed by the reset command (either from other peers or orderers) and commit the blocks up to the pre-reset height. Until all channels reach the pre-reset height, the peer will not endorse any transactions.
    74  
    75  ### peer node rollback example
    76  
    77  The following command:
    78  
    79  ```
    80  peer node rollback -c ch1 -b 150
    81  ```
    82  
    83  rolls back the channel ch1 to block number 150. The command also records the pre-rolled back height of channel ch1 in the file system. Note that the peer should be stopped while executing this command. If the peer process is running, this command detects that and returns an error instead of performing the rollback. When the peer is started after performing the rollback, the peer will fetch the blocks for channel ch1 which were removed by the rollback command (either from other peers or orderers) and commit the blocks up to the pre-rolled back height. Until the channel ch1 reaches the pre-rolled back height, the peer will not endorse any transaction for any channel.
    84  
    85  <a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.