mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge branch 'master' of https://github.com/chrislusf/seaweedfs.wiki
commit
04723d71f4
53
Customize-Filer-Store.md
Normal file
53
Customize-Filer-Store.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
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 gets the name to locate the configuration in filer.toml file
|
||||
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"
|
||||
)
|
||||
```
|
||||
5. Send a pull request!
|
|
@ -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,
|
||||
|
|
11
Filer.md
11
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.
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* [[Distributed Filer]]
|
||||
* [[Filer Commands and Operations]]
|
||||
* [[Mount]]
|
||||
* [[Customize Filer Store]]
|
||||
* Use Cases
|
||||
* [[Use Cases]]
|
||||
* [[Actual Users]]
|
||||
|
|
Loading…
Reference in a new issue