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.

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