A mini file storage service. mini-fstore internally uses miso.
- MySQL
- Redis
- Consul
- RabbitMQ
For more configuration, check miso and gocommon.
Property | Description | Default Value |
---|---|---|
fstore.storage.dir | Storage Directory | ./storage |
fstore.trash.dir | Trash Directory | ./trash |
fstore.tmp.dir | Temporary directory | /tmp |
fstore.pdelete.strategy | Strategy used to 'physically' delete files, there are two types of strategies available: direct / trash. When using 'direct' strategy, files are deleted directly. When using 'trash' strategy, files are moved into the trash directory. | trash |
fstore.backup.enabled | Enable endpoints for mini-fstore file backup, see fstore_backup. | false |
fstore.backup.secret | Secret for backup endpoints authorization, see fstore_backup. | |
task.sanitize-storage-task.dry-run | Enable dry-run mode for StanitizeStorageTask | false |
mini_fstore_generate_file_key_duration
: histogram, used to monitor the duration of each random file key generation.
The /file/stream
endpoint can be used for media streaming.
<body>
<video controls>
<source src="http://localhost:8084/file/stream?key=0fR1H1O0t8xQZjPzbGz4lRx%2FbPacIg" type="video/mp4">
Yo something is wrong
</video>
</body>
Currently, mini-fstore nodes must all share the same database and the same storage devices. Some sort of distributed file system can be used and shared among all mini-fstore nodes if necessary.
- File Backup Tools: fstore_backup.
mini-fstore automatically detects duplicate files by comparing filename, size and md5 checksum. If duplicate file is detected, these files are symbolically linked to the same file previously uploaded. This can massively reduce file storage, but multiple file records (multiple file_ids) can all point to a single file.
Whenever a file is marked logically deleted, the file is not truely deleted. In order to cleanup the storage for the deleted files including those that are possibly symbolically linked, you have to prevent any file upload, and use the following endpoint to trigger the maintenance process:
curl -X POST http://localhost:8084/maintenance/remove-deleted
mini-fstore also provides maintenance endpoint that sanitize storage directory. Sometimes files are uploaded to storagte directory, but are somehow not saved in database. These dangling files are handled by this endpoint.
curl -X POST http://localhost:8084/maintenance/sanitize-storage