diff --git a/Path-Specific-Configuration.md b/Path-Specific-Configuration.md new file mode 100644 index 0000000..b9dd7b1 --- /dev/null +++ b/Path-Specific-Configuration.md @@ -0,0 +1,64 @@ +## Requirements +Writes to SeaweedFS can configure most storage options, such as Collection, Replication, TTL, etc. However, you may want to configure these storage options on the filer side. + +For example, an administrator can create a `/scratch/` directory, configured so that anything written to it is automatically given a 7-day TTL. This directory could be used to store things like CI build artifacts, and it would naturally roll off old files without any intervention. + +This could also be used to implement a system-wide "trash can" (e.g. all deletes move objects to the trash and apply a TTL to them). + +## How it works +On filer, there is one special file, `/etc/filer.conf`. It has all the path-specific configurations. + +All filers will read this configuration and apply the storage option based on the write target file path. + +## How to configure + +Here is an example of using `weed shell`. You can also write the `/etc/filer.conf` file directly. All filers will reload this file if it is changed. + +``` +$ weed shell + +# fs.configure will display current filer.conf content +> fs.configure + +# add a location specific collection setting +> fs.configure -locationPrefix=/tests/ -collection=special +locations: < + location_prefix: "/tests/" + collection: "special" +> + +# save the above setting +> fs.configure -locationPrefix=/tests/ -collection=special -apply +locations: < + location_prefix: "/tests/" + collection: "special" +> +> fs.configure +locations: < + location_prefix: "/tests/" + collection: "special" +> + +# delete the above setting and save to the filer +> fs.configure -locationPrefix=/tests/ -delete -apply +> + +# see more options +> fs.configure -h +Usage of fs.configure: + -apply + update and apply filer configuration + -collection string + assign writes to this colletion + -delete + delete the configuration by locationPrefix + -fsync + fsync for the writes + -locationPrefix string + path prefix, required to update the path-specific configuration + -replication string + assign writes with this replication + -ttl string + assign writes with this ttl + +``` \ No newline at end of file