mount.go 3.1 KB

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