From b2f43cdc559c5d9bf90d80e716e2d6e5983c0434 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 12:45:09 -0700 Subject: [PATCH 1/7] Updated Distributed Filer (markdown) --- Distributed-Filer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Distributed-Filer.md b/Distributed-Filer.md index c124f45..b2ca48d 100644 --- a/Distributed-Filer.md +++ b/Distributed-Filer.md @@ -16,12 +16,12 @@ For production, you would want to set replication_factor to 3 if there are at least 3 Cassandra servers. ```cql -create keyspace seaweed WITH replication = { +create keyspace seaweedfs WITH replication = { 'class':'SimpleStrategy', 'replication_factor':1 }; -use seaweed; +use seaweedfs; CREATE TABLE filemeta ( directory varchar, From 76ba8ca9f87d41300a5e3089a496ae48c6d952f0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 13:04:55 -0700 Subject: [PATCH 2/7] Updated _Sidebar (markdown) --- _Sidebar.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_Sidebar.md b/_Sidebar.md index 5728821..8984de8 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -16,6 +16,7 @@ * [[Distributed Filer]] * [[Filer Commands and Operations]] * [[Mount]] + * [[Customize Filer Store]] * Use Cases * [[Use Cases]] * [[Actual Users]] From 0a8013912090ceef74632507067f09918b8ff74d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 13:16:14 -0700 Subject: [PATCH 3/7] Created Customize Filer Store (markdown) --- Customize-Filer-Store.md | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Customize-Filer-Store.md diff --git a/Customize-Filer-Store.md b/Customize-Filer-Store.md new file mode 100644 index 0000000..d710f5a --- /dev/null +++ b/Customize-Filer-Store.md @@ -0,0 +1,51 @@ +It is fairly easy if you need to store filer metadata with other data store. + +Let's use "yourstore" as the chosen name. + +Here are the steps: +1. add a package under github.com/chrislusf/seaweedfs/weed/filer2/yourstore +2. implement the filer2.FilerStore interface +``` +package filer2 + +import ( + "errors" +) + +type FilerStore interface { + GetName() string + // Initialize initializes the file store + Initialize(configuration Configuration) error + InsertEntry(*Entry) error + UpdateEntry(*Entry) (err error) + FindEntry(FullPath) (entry *Entry, err error) + DeleteEntry(FullPath) (err error) + ListDirectoryEntries(dirPath FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error) +} + +``` +3. Remember to add yourstore to the list of supported stores +``` +func init() { + filer2.Stores = append(filer2.Stores, &YourStore{}) +} +``` +4. Load yourstore. Just import it in github.com/chrislusf/seaweedfs/weed/server/filer_server.go +``` +import ( + "net/http" + "strconv" + "github.com/chrislusf/seaweedfs/weed/filer2" + _ "github.com/chrislusf/seaweedfs/weed/filer2/cassandra" + _ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb" + _ "github.com/chrislusf/seaweedfs/weed/filer2/memdb" + _ "github.com/chrislusf/seaweedfs/weed/filer2/mysql" + _ "github.com/chrislusf/seaweedfs/weed/filer2/postgres" + _ "github.com/chrislusf/seaweedfs/weed/filer2/redis" + _ "github.com/chrislusf/seaweedfs/weed/filer2/yourstore" + // ^^ add here + "github.com/chrislusf/seaweedfs/weed/security" + "github.com/chrislusf/seaweedfs/weed/glog" +) + +``` \ No newline at end of file From 7d0573448a670845ea834497d1dfc8844dc40e1e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 13:20:58 -0700 Subject: [PATCH 4/7] Updated Customize Filer Store (markdown) --- Customize-Filer-Store.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Customize-Filer-Store.md b/Customize-Filer-Store.md index d710f5a..7f58947 100644 --- a/Customize-Filer-Store.md +++ b/Customize-Filer-Store.md @@ -3,8 +3,8 @@ It is fairly easy if you need to store filer metadata with other data store. Let's use "yourstore" as the chosen name. Here are the steps: -1. add a package under github.com/chrislusf/seaweedfs/weed/filer2/yourstore -2. implement the filer2.FilerStore interface +1. Add a package under github.com/chrislusf/seaweedfs/weed/filer2/yourstore +2. Implement the filer2.FilerStore interface ``` package filer2 @@ -13,6 +13,7 @@ import ( ) type FilerStore interface { + // GetName gets the name to locate the configuration in filer.toml file GetName() string // Initialize initializes the file store Initialize(configuration Configuration) error @@ -24,6 +25,7 @@ type FilerStore interface { } ``` + 3. Remember to add yourstore to the list of supported stores ``` func init() { From 7fe8a8cd2993ad4e30a310bfb7a40fbc59d90919 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 13:22:09 -0700 Subject: [PATCH 5/7] Updated Customize Filer Store (markdown) --- Customize-Filer-Store.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Customize-Filer-Store.md b/Customize-Filer-Store.md index 7f58947..8a9555a 100644 --- a/Customize-Filer-Store.md +++ b/Customize-Filer-Store.md @@ -49,5 +49,5 @@ import ( "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/glog" ) - +5. Send a pull request! ``` \ No newline at end of file From 888cfb8eaf3c80b46e12bb5384fb9d2299ca9366 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 13:22:24 -0700 Subject: [PATCH 6/7] Updated Customize Filer Store (markdown) --- Customize-Filer-Store.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Customize-Filer-Store.md b/Customize-Filer-Store.md index 8a9555a..e98985a 100644 --- a/Customize-Filer-Store.md +++ b/Customize-Filer-Store.md @@ -49,5 +49,5 @@ import ( "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/glog" ) +``` 5. Send a pull request! -``` \ No newline at end of file From 32027273b660efc34168a9ddd51d1194fbc45afb Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 Jun 2018 16:35:12 -0700 Subject: [PATCH 7/7] Updated Filer (markdown) --- Filer.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Filer.md b/Filer.md index 1a5298a..c7673de 100644 --- a/Filer.md +++ b/Filer.md @@ -108,17 +108,6 @@ curl "http://localhost:8888/path/to/sources/?pretty=y" curl "http://localhost:8888/path/to/sources/?lastFileName=abc.txt&limit=50&pretty=y" ``` -## Mount the filer - -On Mac, you would need to install [FUSE for macOS](https://osxfuse.github.io/) - -``` -weed mount -dir some_directory -``` -After mounting, the directory will act just as a local directory. - -The "weed mount" is well optimized. Only the file metadata is stored on filer server. The actual file contents are all read from and write to directly the volume servers. - ## Upgrading from previous Filer storage Upgrading is complicated since the storage format is very different.