mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
weed shell: fs.meta.save adjusts meta data file name
This commit is contained in:
parent
8ea1ee6dfa
commit
af49aea0c6
|
@ -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
|
||||
|
||||
`
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue