diff options
| -rw-r--r-- | weed/shell/command_fs_meta_load.go | 2 | ||||
| -rw-r--r-- | weed/shell/command_fs_meta_save.go | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/weed/shell/command_fs_meta_load.go b/weed/shell/command_fs_meta_load.go index ef3c39f96..35fa632b0 100644 --- a/weed/shell/command_fs_meta_load.go +++ b/weed/shell/command_fs_meta_load.go @@ -26,7 +26,7 @@ func (c *commandFsMetaLoad) Name() string { func (c *commandFsMetaLoad) Help() string { return `load saved filer meta data to restore the directory and file structure - fs.meta.load <filer_host>_<port>.meta + fs.meta.load <filer_host>-<port>-<time>.meta ` } diff --git a/weed/shell/command_fs_meta_save.go b/weed/shell/command_fs_meta_save.go index b874db31b..47426a858 100644 --- a/weed/shell/command_fs_meta_save.go +++ b/weed/shell/command_fs_meta_save.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "os" + "time" "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" @@ -24,12 +25,17 @@ func (c *commandFsMetaSave) Name() string { } func (c *commandFsMetaSave) Help() string { - return `recursively save directory and file meta data to a local file + return `save all directory and file meta data to a local file for metadata backup. - fs.meta.save # save current meta data from current directory + fs.meta.save / # save from the root + fs.meta.save /path/to/save # save from the directory /path/to/save + fs.meta.save . # save from current directory + fs.meta.save # save from current directory - The meta data will be saved into a local <filer_host>_<port>.meta file. - These meta data can be later loaded by fs.meta.load command. + The meta data will be saved into a local <filer_host>-<port>-<time>.meta file. + These meta data can be later loaded by fs.meta.load command, + + This assumes there are no deletions, so this is different from taking a snapshot. ` } @@ -45,7 +51,9 @@ func (c *commandFsMetaSave) Do(args []string, commandEnv *commandEnv, writer io. return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error { - fileName := fmt.Sprintf("%s-%d.meta", filerServer, filerPort) + t := time.Now() + fileName := fmt.Sprintf("%s-%d-%4d%02d%02d-%02d%02d%02d.meta", + filerServer, filerPort, t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()) dst, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { |
