mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
ctlv3: add "snapshot restore --wal-dir"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
2dfabfbef6
commit
ee3c81d8d3
@ -874,6 +874,8 @@ The snapshot restore options closely resemble to those used in the `etcd` comman
|
||||
|
||||
- data-dir -- Path to the data directory. Uses \<name\>.etcd if none given.
|
||||
|
||||
- wal-dir -- Path to the WAL directory. Uses data directory if none given.
|
||||
|
||||
- initial-cluster -- The initial cluster configuration for the restored etcd cluster.
|
||||
|
||||
- initial-cluster-token -- Initial cluster token for the restored etcd cluster.
|
||||
|
@ -56,6 +56,7 @@ var (
|
||||
restoreCluster string
|
||||
restoreClusterToken string
|
||||
restoreDataDir string
|
||||
restoreWalDir string
|
||||
restorePeerURLs string
|
||||
restoreName string
|
||||
skipHashCheck bool
|
||||
@ -99,6 +100,7 @@ func NewSnapshotRestoreCommand() *cobra.Command {
|
||||
Run: snapshotRestoreCommandFunc,
|
||||
}
|
||||
cmd.Flags().StringVar(&restoreDataDir, "data-dir", "", "Path to the data directory")
|
||||
cmd.Flags().StringVar(&restoreWalDir, "wal-dir", "", "Path to the WAL directory (use --data-dir if none given)")
|
||||
cmd.Flags().StringVar(&restoreCluster, "initial-cluster", initialClusterFromName(defaultName), "Initial cluster configuration for restore bootstrap")
|
||||
cmd.Flags().StringVar(&restoreClusterToken, "initial-cluster-token", "etcd-cluster", "Initial cluster token for the etcd cluster during restore bootstrap")
|
||||
cmd.Flags().StringVar(&restorePeerURLs, "initial-advertise-peer-urls", defaultInitialAdvertisePeerURLs, "List of this member's peer URLs to advertise to the rest of the cluster")
|
||||
@ -187,7 +189,10 @@ func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) {
|
||||
basedir = restoreName + ".etcd"
|
||||
}
|
||||
|
||||
waldir := filepath.Join(basedir, "member", "wal")
|
||||
waldir := restoreWalDir
|
||||
if waldir == "" {
|
||||
waldir = filepath.Join(basedir, "member", "wal")
|
||||
}
|
||||
snapdir := filepath.Join(basedir, "member", "snap")
|
||||
|
||||
if _, err := os.Stat(basedir); err == nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user