📄 1827.html
字号:
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif">
<div align=center><font class=normalfont>搜索文章:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>MySQL文件系统</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br> 这个文件系统还处于实现中,还不是正式产品。<br>
<br>
这是一款正在开发中的Linux文件系统,能把Linux上的MySQL 数据库作为文件系统来处<br>
理。开发小组希望能得到更多的建议,下面的文章翻译自:<br>
http://no.spam.ee/~tonu/mysqlfs.html<br>
<br>
--------------------------------<br>
实际上,这不是通常意义上的文件系统,它没有磁盘空间, 而是使用MySQL守护程序来<br>
存储数据。可以把SQL 表和一些函数通过文件系统来实现。<br>
<br>
一、怎样实现?<br>
让我们来看使用实例:<br>
<br>
[root@localhost /root]# mount -t corbafs -o `cat /tmp/mysqlcorbafs.ior` none<br>
/mnt/mysql/<br>
<br>
[root@localhost /root]# mount<br>
/dev/hda3 on / type ext2 (rw)<br>
none on /proc type proc (rw)<br>
none on /dev/pts type devpts (rw,gid=5,mode=620)<br>
/dev/hda1 on /mnt/win type vfat (rw,mode=777)<br>
/dev/hda4 on /mnt/linux type vfat (rw,noexec,nosuid,nodev,mode=777)<br>
none on /mnt/mysql type corbafs<br>
(rw,IOR:01e50d401b00000049444c3a436f72626146532f46696c6553797374656d3a312e<br>
300000010000000000000030000000010100000a0000003132372e302e302e310008041800<br>
0000000000009224bc335663462a01000000ef7ae13c0943c59f)<br>
<br>
[root@localhost /root]# ls -la /mnt/mysql/<br>
<br>
total 0<br>
<br>
-r-xr-xr-x 1 root root 4096 dets 29 22:21 .uptime<br>
dr-xr-xr-x 1 root root 4096 dets 29 22:21 test<br>
dr-xr-xr-x 1 root root 4096 dets 29 22:21 mysql<br>
<br>
[root@localhost /root]# cat /mnt/mysql/.uptime<br>
<br>
1994<br>
<br>
[root@localhost /root]# cat /mnt/mysql/mysql/user/Host<br>
<br>
cpq.spam.ee<br>
cpq.spam.ee<br>
localhost<br>
localhost<br>
localhost<br>
localhost<br>
localhost<br>
localhost<br>
<br>
[root@localhost /root]# cat /mnt/mysql/mysql/user/Insert_priv<br>
N<br>
N<br>
N<br>
N<br>
N<br>
N<br>
Y<br>
Y<br>
<br>
[root@localhost /root]# umount /mnt/mysql/<br>
<br>
二、为什么要这样做呢?<br>
<br>
在一些情形下,这样做能让工作更加轻松。MySQL和文件系统都能叫做数据库, 但是有<br>
着绝然不同的概念和优缺点。在文件系统里,对象能很快而且很容易找到,即使改变名字也<br>
能很快找到。每一个初学者大概都应该学会move/copy/rename/delete这样的操作。<br>
但是SQL 不一样,它通过应用程序来操纵存储在文件系统上的数据。 而MySQL文件系统<br>
把SQL做到了用户级。用户能用他们知道的方式来操作数据库。<br>
-任何一个新产品需要通过网络存取数据的话,必须支持一些协议以及可能的其他办法通<br>
过网络存取文件系统。MySQL表就可以通过这样的方式来存取, 即使MySQL没有移植到对应的<br>
平台。<br>
-备份和版本控制,普通的文件系统通过任何备份软件就可以实现。数据可以通过diff来<br>
比较并且用cvs来控制版本。<br>
-更短的编程时间,有时候人们需要保存简单的数据,像当前日期或者站点名字, 这些<br>
数据很少改变,普通的方法需要使用:<br>
连接服务器-> 选择数据库 -> 执行命令-> 存储结果<br>
而使用 MySQL 文件系统后,只需要一句话:(PHP实现)<br>
include(¨/mountpoint/database/table/field¨);<br>
或者,换一种方式表达:<br>
include(¨/mnt/mysql/sitedata/topic/todaytopic¨);<br>
这样就很容易理解,也占用了较少的空间。还可以通过SAMBA 来共享/mnt/mysql,达到<br>
直接修改SQL 数据库的目的。能直接写文本到数据库,或者使用拷贝/粘贴功能把图片放入<br>
数据库,这要比用Perl或者PHP写几百行程序省力多了。<br>
<br>
三、性能如何?<br>
在发表这篇文章的时候,这个文件系统还处于原型开发阶段,因此,速度还不是很理想。<br>
如果到了正式发布的时候,一些数据库功能会比使用 SQL 要快。当然, 很多还是没法<br>
和SQL 相比,无论是性能上还是功能上,很多复杂的查询依然需要通过SQL 语句来完成。但<br>
是,这样节省了很多开发和培训的时间,所以在效率上来说也是一种节省。<br>
<br>
四、支持的表类型:<br>
目前这个文件系统支持所有的表类型:MyISAM,DBD,HEAP,ISAM。<br>
<br>
五、其他的特色:<br>
在第一步开发中实现的还只是只读,很快会有能读写的版本出来。目前的计划是把数据库<br>
对象映射成文件和目录对象。让我们来看看例子:<br>
<br>
--8<-----------------------------<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -