Skip to content

skeyby/mysqlfs

 
 

Repository files navigation

                      mysqlfs - MySQL FileSystem

MySQLfs is a FUSE filesystem driver which stores files in a MySQL database.

===> Requirements

  To use this package you need:
  - mysql-client libraries 5.0 or later on the local machine
  - A MySQL server 5.0 or later somewhere on the network (or on the local machine)
  - fuse 2.6 or later

===> Building instruction

  To build the package you need:
  - CMake
  - fuse-devel libs
  - mysql-devel libs

  On FreeBSD 12.x or later you can install requirements with.
  #> pkg install mysql80-client cmake gmake fusefs-libs 

  And remember to kldload fusefs before starting MySQLfs

  On Debian 9 you can install requirements with:
  #> sudo apt install -y cmake g++ libfuse-dev libmariadbclient-dev-compat

  Run the following commands:
  #> cmake .
  #> make
  #> make install

  Instead of last command 'make install' you can use 'checkinstall' to build the DEB-package.

===> First installation / upgrading

   NOTE: if you are upgrading skip directly to step #2

1. Create a database and a MySQL account
   mysql> CREATE DATABASE mysqlfs;
   mysql> GRANT ALL PRIVILEGES ON mysqlfs.* TO mysqlfs@"%" IDENTIFIED BY 'pass';
   mysql> FLUSH PRIVILEGES;

2. Execute mysqlfs_setup and answer to the questions about your db.

4. Mount the filesystem (please change the parameters <> accordingly)
   $ mkdir /mnt/fs
   $ mysqlfs -ohost=<host> -ouser=<user> -opassword=<pass> -odatabase=<mysqlfs> /mnt/fs

5. Instead of setting connection options on the command line
   you may create a [mysqlfs] section in your ~/.my.cnf file and
   set the parameters there.

6. Mount on boot: add into /etc/fstab the next line
   mysqlfs /mnt/fs fuse host=<host>,user=<user>,password=<pass>,database=<mysqlfs>,allow_other,big_writes,x-systemd.automount 0 2


===> Upgrading from 0.4.0 or lower versions

   To upgrade your existing installation unfortunately you have to make some changes
   to the database.

   The recomended solution to upgrade your system is to compile a a newMySQLfs and
   create a NEW filesystem in a NEW database. Mount it alongside the old one and then
   just copy datas from the old filesystem to the new one. THIS IS THE RECOMENDED
   (AND PROBABILY THE ONLY CERTAIN) SOLUTION.

   IN THE SQL DIR YOU CAN FIND A 0.4.0_to_0.4.1.sql FILE, BUT IT IS "INFORMATIVE"
   ONLY - IT'S NOT MEANT TO BE RUN ON A RUNNING FILESYSTEM

   The problem lies in the handling of "sparse files": increasing the blocksize
   without proper remapping of the underlying database can cause improper results.
   More specifically your files will probably get filled with zeroes. You probably
   don't want that.

===> Running options

  -ohost=<hostname>
    MySQL server host

  -ouser=<username>
    MySQL username

  -opassword=<password>
    MySQL password

  -odatabase=<db>
    MySQL database name

  -obig_writes
    Enable big_writes (strongly suggested)

  -oallow_other
    Enable filesystem access to different users than the one who mounted it.
    The corresponding option must be enabled in /etc/fuse.conf

  -odefault_permissions
    Disable some extended permission checkings on files. 

===> Compatibility Matrix

  During development mysqlfs is checked against:

  * FreeBSD 10
  * Fedora Linux 15
  * Debian Linux 6
  * Debian Linux 7
  * Debian Linux 9

  * MySQL 5.1
  * MySQL 5.5
  * MySQL 5.6
  * MariaDB 10.1

  NOTE:
  * FreeBSD 9 + FUSE-KMOD is NOT supported

===> Authors

Copyright (C) 2006 Tsukasa Hamano <code@cuspy.org>
Copyright (C) 2006 Michal Ludvig <michal@logix.cz>
Copyright (C) 2012-2020 Andrea Brancatelli <andrea@brancatelli.it>

About

MySQLfs is a FUSE - File System in User land - module which stores data in a MySQL database

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 67.0%
  • PHP 11.1%
  • CMake 11.1%
  • TSQL 4.6%
  • Shell 4.4%
  • PLpgSQL 1.3%
  • C++ 0.5%