github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/docs/source/commands/peernode.md (about)

     1  <!---
     2   File generated by help_docs.sh. DO NOT EDIT.
     3   Please make changes to preamble and postscript wrappers as appropriate.
     4   --->
     5  
     6  # peer node
     7  
     8  The `peer node` command allows an administrator to start a peer node,
     9  pause and resume a channel, rebuild databases, reset all channels in a peer to the genesis block,
    10  rollback a channel to a given block number, and upgrade the database format.
    11  
    12  ## Syntax
    13  
    14  The `peer node` command has the following subcommands:
    15  
    16    * pause
    17    * rebuild-dbs
    18    * reset
    19    * resume
    20    * rollback
    21    * start
    22    * unjoin
    23    * upgrade-dbs
    24  
    25  ## peer node pause
    26  ```
    27  Pauses a channel on the peer. When the command is executed, the peer must be offline. When the peer starts after pause, it will not receive blocks for the paused channel.
    28  
    29  Usage:
    30    peer node pause [flags]
    31  
    32  Flags:
    33    -c, --channelID string   Channel to pause.
    34    -h, --help               help for pause
    35  ```
    36  
    37  
    38  ## peer node rebuild-dbs
    39  ```
    40  Drops the databases for all the channels and rebuilds them upon peer restart. When the command is executed, the peer must be offline. The command is not supported if the peer contains any channel that was bootstrapped from a snapshot.
    41  
    42  Usage:
    43    peer node rebuild-dbs [flags]
    44  
    45  Flags:
    46    -h, --help   help for rebuild-dbs
    47  ```
    48  
    49  
    50  ## peer node reset
    51  ```
    52  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. The command is not supported if the peer contains any channel that was bootstrapped from a snapshot.
    53  
    54  Usage:
    55    peer node reset [flags]
    56  
    57  Flags:
    58    -h, --help   help for reset
    59  ```
    60  
    61  
    62  ## peer node resume
    63  ```
    64  Resumes a channel on the peer. When the command is executed, the peer must be offline. When the peer starts after resume, it will receive blocks for the resumed channel.
    65  
    66  Usage:
    67    peer node resume [flags]
    68  
    69  Flags:
    70    -c, --channelID string   Channel to resume.
    71    -h, --help               help for resume
    72  ```
    73  
    74  
    75  ## peer node rollback
    76  ```
    77  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. The command is not supported if the peer contains any channel that was bootstrapped from a snapshot.
    78  
    79  Usage:
    80    peer node rollback [flags]
    81  
    82  Flags:
    83    -b, --blockNumber uint   Block number to which the channel needs to be rolled back to.
    84    -c, --channelID string   Channel to rollback.
    85    -h, --help               help for rollback
    86  ```
    87  
    88  
    89  ## peer node start
    90  ```
    91  Starts a node that interacts with the network.
    92  
    93  Usage:
    94    peer node start [flags]
    95  
    96  Flags:
    97    -h, --help                help for start
    98        --peer-chaincodedev   start peer in chaincode development mode
    99  ```
   100  
   101  
   102  ## peer node unjoin
   103  ```
   104  Unjoin the peer from a channel.  When the command is executed, the peer must be offline.
   105  
   106  Usage:
   107    peer node unjoin [flags]
   108  
   109  Flags:
   110    -c, --channelID string   Channel to unjoin.
   111    -h, --help               help for unjoin
   112  ```
   113  
   114  
   115  ## peer node upgrade-dbs
   116  ```
   117  Upgrades databases by directly updating the database format or dropping the databases. Dropped databases will be rebuilt with new format upon peer restart. When the command is executed, the peer must be offline.
   118  
   119  Usage:
   120    peer node upgrade-dbs [flags]
   121  
   122  Flags:
   123    -h, --help   help for upgrade-dbs
   124  ```
   125  
   126  ## Example Usage
   127  
   128  ### peer node pause example
   129  
   130  The following command:
   131  
   132  ```
   133  peer node pause -c ch1
   134  ```
   135  
   136  pauses a channel on the peer. When the peer starts after pause, the paused channel will not be started
   137  and the peer will not receive blocks for the paused channel.
   138  
   139  
   140  ### peer node rebuild-dbs example
   141  
   142  The following command:
   143  
   144  ```
   145  peer node rebuild-dbs
   146  ```
   147  
   148  drops the databases for all the channels. When the peer is started after running this command, the peer will
   149  retrieve the blocks stored on the peer and rebuild the dropped databases for all the channels.
   150  
   151  ### peer node reset example
   152  
   153  The following command:
   154  
   155  ```
   156  peer node reset
   157  ```
   158  
   159  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.
   160  
   161  ### peer node resume example
   162  
   163  The following command:
   164  
   165  ```
   166  peer node resume -c ch1
   167  ```
   168  
   169  resumes a channel on the peer. When the peer starts after resume, the resumed channel will be started
   170  and the peer will receive blocks for the resumed channel.
   171  
   172  ### peer node rollback example
   173  
   174  The following command:
   175  
   176  ```
   177  peer node rollback -c ch1 -b 150
   178  ```
   179  
   180  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.
   181  
   182  ### peer node start example
   183  
   184  The following command:
   185  
   186  ```
   187  peer node start --peer-chaincodedev
   188  ```
   189  
   190  starts a peer node in chaincode development mode. Normally chaincode containers are started
   191  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.
   192  
   193  ### peer node unjoin example 
   194  
   195  The following command: 
   196  
   197  ```
   198  peer node unjoin -c mychannel
   199  ```
   200  
   201  unjoins the peer from channel `mychannel`, removing all content from the ledger and transient storage.  When unjoining a channel, the peer must be shut down.
   202  
   203  
   204  ### peer node upgrade-dbs example
   205  
   206  The following command:
   207  
   208  ```
   209  peer node upgrade-dbs
   210  ```
   211  
   212  checks the data format in the databases for all the channels and drops databases if data format is in the previous version.
   213  The command will return an error if the data format is already up to date. When the peer is started after running this command,
   214  the peer will retrieve the blocks stored on the peer and rebuild the dropped databases in the new format.
   215  
   216  <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>.