You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
3.2 KiB

5 years ago
  1. package command
  2. type MountOptions struct {
  3. filer *string
  4. filerMountRootPath *string
  5. dir *string
  6. dirListCacheLimit *int64
  7. collection *string
  8. replication *string
  9. ttlSec *int
  10. chunkSizeLimitMB *int
  11. dataCenter *string
  12. allowOthers *bool
  13. umaskString *string
  14. nonempty *bool
  15. outsideContainerClusterMode *bool
  16. }
  17. var (
  18. mountOptions MountOptions
  19. mountCpuProfile *string
  20. mountMemProfile *string
  21. )
  22. func init() {
  23. cmdMount.Run = runMount // break init cycle
  24. mountOptions.filer = cmdMount.Flag.String("filer", "localhost:8888", "weed filer location")
  25. mountOptions.filerMountRootPath = cmdMount.Flag.String("filer.path", "/", "mount this remote path from filer server")
  26. mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory")
  27. mountOptions.dirListCacheLimit = cmdMount.Flag.Int64("dirListCacheLimit", 1000000, "limit cache size to speed up directory long format listing")
  28. mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files")
  29. mountOptions.replication = cmdMount.Flag.String("replication", "", "replication(e.g. 000, 001) to create to files. If empty, let filer decide.")
  30. mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
  31. mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 4, "local write buffer size, also chunk large files")
  32. mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center")
  33. mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system")
  34. mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111")
  35. mountOptions.nonempty = cmdMount.Flag.Bool("nonempty", false, "allows the mounting over a non-empty directory")
  36. mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
  37. mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
  38. mountOptions.outsideContainerClusterMode = cmdMount.Flag.Bool("outsideContainerClusterMode", false, "allows other users to access the file system")
  39. }
  40. var cmdMount = &Command{
  41. UsageLine: "mount -filer=localhost:8888 -dir=/some/dir",
  42. Short: "mount weed filer to a directory as file system in userspace(FUSE)",
  43. Long: `mount weed filer to userspace.
  44. Pre-requisites:
  45. 1) have SeaweedFS master and volume servers running
  46. 2) have a "weed filer" running
  47. These 2 requirements can be achieved with one command "weed server -filer=true"
  48. This uses github.com/seaweedfs/fuse, which enables writing FUSE file systems on
  49. Linux, and OS X.
  50. On OS X, it requires OSXFUSE (http://osxfuse.github.com/).
  51. If the SeaweedFS system runs in a container cluster, e.g. managed by kubernetes or docker compose,
  52. the volume servers are not accessible by their own ip addresses.
  53. In "outsideContainerClusterMode", the mount will use the filer ip address instead, assuming:
  54. * All volume server containers are accessible through the same hostname or IP address as the filer.
  55. * All volume server container ports are open external to the cluster.
  56. `,
  57. }