diff options
| author | Rain Li <blacktear23@gmail.com> | 2021-08-30 15:52:54 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-30 15:52:54 +0800 |
| commit | e5f9ff983d7153ec9c3966d896c69c3901a873fc (patch) | |
| tree | b64f53d9fa36fc2c2c796e9c8385f7be1407fc6f /weed/shell/command_remote_unmount.go | |
| parent | c1dc5ab4ac90589fd5c4eaf75f7f2d4e870ae91d (diff) | |
| parent | 44d0ac95f6a068203edc4568660a720c6f5cdf8b (diff) | |
| download | seaweedfs-e5f9ff983d7153ec9c3966d896c69c3901a873fc.tar.xz seaweedfs-e5f9ff983d7153ec9c3966d896c69c3901a873fc.zip | |
Merge branch 'master' into filerstore-tikv
Diffstat (limited to 'weed/shell/command_remote_unmount.go')
| -rw-r--r-- | weed/shell/command_remote_unmount.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/weed/shell/command_remote_unmount.go b/weed/shell/command_remote_unmount.go index b65d125aa..9b61f5cfb 100644 --- a/weed/shell/command_remote_unmount.go +++ b/weed/shell/command_remote_unmount.go @@ -30,7 +30,9 @@ func (c *commandRemoteUnmount) Help() string { remote.mount -dir=/xxx -remote=s3_1/bucket # unmount the mounted directory and remove its cache - remote.unmount -dir=/xxx + # Make sure you have stopped "weed filer.remote.sync" first! + # Otherwise, the deletion will also be propagated to the remote storage!!! + remote.unmount -dir=/xxx -iHaveStoppedRemoteSync ` } @@ -40,6 +42,7 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writer remoteMountCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) dir := remoteMountCommand.String("dir", "", "a directory in filer") + hasStoppedRemoteSync := remoteMountCommand.Bool("iHaveStoppedRemoteSync", false, "confirm to stop weed filer.remote.sync first") if err = remoteMountCommand.Parse(args); err != nil { return nil @@ -58,6 +61,9 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writer return fmt.Errorf("directory %s is not mounted", *dir) } + if !*hasStoppedRemoteSync { + return fmt.Errorf("make sure \"weed filer.remote.sync\" is stopped to avoid data loss") + } // purge mounted data if err = c.purgeMountedData(commandEnv, *dir); err != nil { return fmt.Errorf("purge mounted data: %v", err) @@ -71,12 +77,6 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writer return nil } -func (c *commandRemoteUnmount) findRemoteStorageConfiguration(commandEnv *CommandEnv, writer io.Writer, remote *filer_pb.RemoteStorageLocation) (conf *filer_pb.RemoteConf, err error) { - - return filer.ReadRemoteStorageConf(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress, remote.Name) - -} - func (c *commandRemoteUnmount) purgeMountedData(commandEnv *CommandEnv, dir string) error { // find existing directory, and ensure the directory is empty |
