forked from samzyy/DB-based-replicated-filesystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
97 lines (62 loc) · 3.15 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
mysqlfs - MySQL FileSystem
$Id: README 55 2009-07-12 22:23:33Z chickenandporn $
MySQLfs is a FUSE filesystem driver which stores files in a MySQL database.
* Requirements
- mysql-client libraries 5.0 or later
- mysql-server 5.0 or later
- fuse 2.5 or later
- autotools
* Build
If compiling from version-control, use "autoreconf -vfi" first.
For both version-control and tarball version run:
$ ./configure
$ make
* Usage
1. Create database and account
mysql> CREATE DATABASE mysqlfs;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON mysqlfs.* TO mysqlfs@"%" IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
(note FAQ: Errors #1 "Access Denied For User" below)
2. Create tables
$ mysql -uroot -p mysqlfs < schema.sql
(note FAQ: Errors #2 "Can't Create/Write to File" below)
3. Mount database as a filesystem
$ mkdir fs
$ ./mysqlfs -ohost=localhost -ouser=user -opassword=pass -odatabase=mysqlfs fs
4. 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.
* Options
-ohost=<hostname>
MySQL server host
-ouser=<username>
MySQL username
-opassword=<password>
MySQL password
-odatabase=<db>
MySQL database name
* FAQ: ERRORS
1. Access Denied For User 'mysql'@'localhost'
ie: (using the example GRANT above)
$ ./mysqlfs -ohost=localhost -ouser=mysqlfs -opassword=password -odatabase=mysqlfs fs
2009-06-14 00:59:29 89956 ERROR: mysql_real_connect(): Access denied for user 'mysqlfs'@'localhost' (using password: YES)
2009-06-14 00:59:29 89956 ERROR: mysql_real_connect(): Access denied for user 'mysqlfs'@'localhost' (using password: YES)
2009-06-14 00:59:29 89956 Failed to connect MySQL server.
2009-06-14 00:59:29 89956 Error: pool_init() failed
MySQL is sticky sometimes with access; on MacOSX, I had to specifically allow localhost:
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON mysqlfs.* TO mysqlfs@"localhost" IDENTIFIED BY 'password';
$ sudo /usr/local/mysql/bin/mysqladmin reload
Remember, also, that 'localhost' and '127.0.0.1' may appear differently. Check also your /etc/hosts entry, some
systems define 127.0.0.1 as their uname() which causes problems doing PTRs against it, expecting 'localhost'
but getting 'myhostname'
2. Can't Create/Write to File (while building database)
ie: (using the "Create tables" step #2 above)
$ sudo /usr/local/mysql/bin/mysql mysqlfs < schema.sql
ERROR 1 (HY000) at line 23: Can't create/write to file '/usr/local/mysql/data/mysqlfs/data_blocks.MYI' (Errcode: 13)
On MacOSX with http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.35-osx10.5-x86.dmg ,
rather than "CREATE DATABASE mysqlfs", I had to use:
$ sudo /usr/local/mysql/bin/mysqladmin create mysqlfs && sudo chown _mysql /usr/local/mysql/data/mysqlfs
The grant/flush commands worked fine after that. In my usage, I'm "sudo" which can affect the output, so the
error might have been mine alone. I'm commenting here in case someone else sees it.
Copyright (C) 2006 Tsukasa Hamano <[email protected]>
Copyright (C) 2006 Michal Ludvig <[email protected]>