Home > Database > Mysql Tutorial > body text

A sneak peek of the MySQL file system (1)

黄舟
Release: 2016-12-15 11:43:09
Original
743 people have browsed it

This is a Linux file system under development that can handle the MySQL database on Linux as a file system. The development team hopes to get more suggestions. The following article is translated from:

http://no.spam.ee/~tonu/mysqlfs.html
--------------- ------------------

 In fact, this is not a file system in the usual sense. It has no disk space. Instead, it uses the MySQL daemon to store data. SQL tables and some functions can be implemented through the file system.

1. How to achieve it?

Let’s look at usage examples:

[root@localhost /root]# mount -t corbafs -o `cat /tmp/mysqlcorbafs.ior` none /mnt/mysql/

[root@localhost /root]# mount

/dev/hda3 on / type ext2 (rw)

none on /proc type proc (rw)

none on /dev/pts type devpts (rw,gid=5,mode=620)

/dev /hda1 on /mnt/win type vfat (rw,mode=777)

/dev/hda4 on /mnt/linux type vfat (rw,noexec,nosuid,nodev,mode=777)

none on /mnt/mysql type corbafs (rw,IOR:01e50d401b00000049444c3a436f72626146532f46696c6553797374656d3a
312e300000010000000000000030000000010100000 a0000003132372e302e302e
310008041800000000000009224bc335663462a01000000ef7ae13c0943c59f)


[root@localhost /root]# ls -la /mnt/mysql/


total 0


-r-xr-xr-x 1 root root 4096 dets 29 22:21 .uptime

dr-xr-xr-x 1 root root 4096 dets 29 22:21 test

dr-xr-xr-x 1 root root 4096 dets 29 22:21 mysql


[root@localhost /root]# cat /mnt/mysql/.uptime


1994


[root@localhost /root]# cat /mnt/mysql/mysql/user/Host


cpq.spam.ee

cpq.spam.ee

localhost

localhost

localhost

localhost

localhost

localhost


[root@localhost /root]# cat /mnt/mysql/mysql/user/Insert_priv

N

N

N

N

N

N

Y

Y


[root@localhost /root]# umount /mnt/mysql/

Second, why do you do this?


  In some situations, doing this can make the job easier. Both MySQL and file systems can be called databases, but they have completely different concepts, advantages and disadvantages. In a file system, objects can be found quickly and easily, even if their names change. Every beginner should probably learn operations like move/copy/rename/delete. But SQL is different. It uses applications to manipulate data stored on the file system. The MySQL file system brings SQL to the user level. Users can operate the database the way they know how.


  - If any new product needs to access data through the network, it must support some protocols and possibly other methods to access the file system through the network. MySQL tables can be accessed in this way, even if MySQL has not been ported to the corresponding platform.


  - Backup and version control, ordinary file systems can be achieved through any backup software. Data can be compared using diff and version controlled using cvs.


  -Shorter programming time. Sometimes people need to save simple data, like the current date or site name. These data rarely change. The ordinary method needs to be used:

 Connect to the server-> Select database-> Execute the command -> Store the results


After using the MySQL file system, you only need one sentence: (PHP implementation)


include(¨/mountpoint/database/table/field¨);


Or, change Expressed in this way:


include(¨/mnt/mysql/sitedata/topic/todaytopic¨);

This way it is easy to understand and takes up less space. You can also share /mnt/mysql through SAMBA to directly modify the SQL database. You can write text directly to the database, or use the copy/paste function to put images into the database, which is much less labor-intensive than writing hundreds of lines of programs in Perl or PHP.

3. How is the performance?


At the time of publishing this article, this file system is still in the prototype development stage, so the speed is not yet ideal. If it comes time for official release, some database functions will be faster than using SQL. Of course, many are still incomparable with SQL, both in terms of performance and functionality, and many complex queries still need to be completed through SQL statements. However, this saves a lot of development and training time, so it is also a saving in terms of efficiency.

4. Supported table types:

Currently this file system supports all table types: MyISAM, DBD, HEAP, ISAM.

The above is the sneak peek of MySQL file system (1). For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!