QUICKSTART.txt for DBIx-FileStore
1) Have Mysql installed and running, along with DBI and DBD::mysql.
2) Choose what database, dbuser and dbpasswd you're going to use.
(DBIx-Filestore uses a table called 'files' and another called
'fileblocks' which are created in step 4. See table-definitions.sql
and the documentation for DBIx::FileStore for technical details.)
3) Copy the file fdb.conf-sample to either /etc/fdb.conf or ~/.fdbrc,
and edit it to specify your dbname, dbuser and dbpasswd.
4) Set up the needed tables in mysql via a command like:
mysql dbname < table-definitions.sql
5) Go through the normal perl test and install process:
perl Makefile.PL (install any prerequisites it might flag)
make
make test
sudo make install
6) You now have the DBIx-FileStore system installed.
7) As a simple test, let's copy a file
into the filestore:
% cd /etc/
% fdbput hosts
That copies the file '/etc/hosts' into the filestore under the name 'hosts'
You can see it in the database with fdbls:
% fdbls
hosts
fdbls also has a few interesting options, including -h, -l, and
-m, which shows the file's size, update time (in the filestore),
and MD5 checksum:
% fdbls -h -l -m hosts
7.44K 20101116 19:28 fp911CO8MLqOLmCGtmx7wA hosts
You can view its contents via the command fdbcat:
% fdbcat hosts | head -7
# /etc/hosts hardwired addresses.
# DO NOT EDIT! CHANGES WILL BE OVERWRITTEN ON THE NEXT RUN OF
# /home/admin/bin/setup/hosts-setup
#
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
We can also see some data about the files in the filestore:
% fdbstat
fdbstat: DB has 7623 bytes in 1 files stored in 1 blocks.
8) See the documentation for the 'fdb' tools in the script folder:
fdbcat, fdbget, fdbls, fdbmv, fdbput, fdbrm, fdbstat,
and fdbtidy.
9) fdbslurp (which is the inverse of fdbcat in
that it slurps from stdin instead of printing
to stdout) is left as an exercise for the reader.