github.com/lzy4123/fabric@v2.1.1+incompatible/internal/peer/node/rebuild_dbs.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package node 8 9 import ( 10 "github.com/hyperledger/fabric/core/ledger/kvledger" 11 "github.com/spf13/cobra" 12 ) 13 14 func rebuildDBsCmd() *cobra.Command { 15 return nodeRebuildCmd 16 } 17 18 var nodeRebuildCmd = &cobra.Command{ 19 Use: "rebuild-dbs", 20 Short: "Rebuilds databases.", 21 Long: "Drops the databases for all the channels and rebuilds them upon peer restart. When the command is executed, the peer must be offline.", 22 RunE: func(cmd *cobra.Command, args []string) error { 23 config := ledgerConfig() 24 return kvledger.RebuildDBs(config.RootFSPath) 25 }, 26 }