<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Here comes the Sun &#187; mysql</title>
	<atom:link href="http://sunng.info/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunng.info/blog</link>
	<description>47% users on this site use *nix</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:08:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Introduction to Amoeba</title>
		<link>http://sunng.info/blog/2010/08/introduction-to-amoeba/</link>
		<comments>http://sunng.info/blog/2010/08/introduction-to-amoeba/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 09:22:26 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[ANN]]></category>
		<category><![CDATA[amoeba]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/2010/08/introduction-to-amoeba/</guid>
		<description><![CDATA[Amoeba is a distributed database middleware works as mysql proxy, provides sharding and high availability support for large scale applications using multiple mysql servers as backend. Compatible with mysql protocol, Amoeba is fully transparent to any client using standard mysql &#8230; <a href="http://sunng.info/blog/2010/08/introduction-to-amoeba/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Amoeba is a distributed database middleware works as mysql proxy, provides sharding and high availability support for large scale applications using multiple mysql servers as backend.</p>
<p>Compatible with mysql protocol, Amoeba is fully transparent to any client using standard mysql drivers, which means, to use Amoeba you don&#8217;t have to modify any code of database connector. You just configure rules for amoeba, then the client request will automatically route to certain mysql instance. Amoeba has a flexible set of configuration rules that can satisfy your requirements.</p>
<p>Amoeba is written in Java, and deployed on Linux server in most cases. The IO module is built on the top of Java nonblocking IO, which keeps communication between client, Amoeba and mysql at a high performance.</p>
<p>The project is initialized in 2008. Stable release 1.2.1-GA have been available since July, 2010 . It is now serving on the production environment of the social networks <a href="http://t.sdo.com/">http://t.sdo.com/</a></p>
<p>Project home:<br />
<a href="http://code.google.com/p/amoeba/">http://code.google.com/p/amoeba/</a></p>
<p>Development logs:<br />
<a href="http://amoeba.meidusa.com/wordpress/">http://amoeba.meidusa.com/wordpress/</a></p>
<p>The post is brought to you by <a href="http://fedorahosted.org/lekhonee">lekhonee</a> v0.7</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/08/introduction-to-amoeba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Geometry in Grails and MySQL</title>
		<link>http://sunng.info/blog/2009/10/mapping-geometry-in-grails-and-mysql/</link>
		<comments>http://sunng.info/blog/2009/10/mapping-geometry-in-grails-and-mysql/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 11:14:36 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[手艺]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[jts]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.classicning.com/blog/?p=238</guid>
		<description><![CDATA[针对地理数据的ORM，有一个Hibernate的扩展HibernateSpatial项目可以将JTS对象映射到MySQL/PostGIS/Oracle中。这个扩展同样可以用在Grails里，这里有一篇简单的介绍，关于在Grails和MySQL中管理地理数据： http://www.grails.org/MySQL+GIS-Geometry+with+Grails 不过按照这个文章里介绍的方法用，很可能会遭遇这样的报错： org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003 这个问题最终在这里得到了解答： http://n2.nabble.com/No-Dialect-mapping-for-JDBC-type-2003-td1141106.html 按照邮件列表里的反映，上面的配置在Postgis里是可以work的，但是如果用Mysql还需要指定JPA的columnDefinition，对应的Hibernate属性是sql-type。虽然作者承诺会在今后的版本里修改这个问题，不过眼下的M2版本还没有修正这个问题。为此，Grails的用户特地提出在Grails中加入sql-type的支持： http://jira.codehaus.org/browse/GRAILS-3201 现在按照下面文档的说明，可以在mapping里指定sqlType了： http://grails.org/doc/latest/ref/Database%20Mapping/column.html 实例代码里的domain定义应该改成： import com.vividsolutions.jts.geom.Polygon import org.hibernatespatial.GeometryUserType public class MyPoly { String name Polygon poly static mapping = { poly type: GeometryUserType， sqlType:"GEOMETRY" } } &#8230; <a href="http://sunng.info/blog/2009/10/mapping-geometry-in-grails-and-mysql/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>针对地理数据的ORM，有一个Hibernate的扩展<a href="http://www.hibernatespatial.org/" target="_blank">HibernateSpatial</a>项目可以将JTS对象映射到MySQL/PostGIS/Oracle中。这个扩展同样可以用在Grails里，这里有一篇简单的介绍，关于在Grails和MySQL中管理地理数据：<br />
<a href="http://www.grails.org/MySQL+GIS-Geometry+with+Grails" target="_blank">http://www.grails.org/MySQL+GIS-Geometry+with+Grails</a></p>
<p>不过按照这个文章里介绍的方法用，很可能会遭遇这样的报错：</p>
<blockquote><p>org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003</p></blockquote>
<p>这个问题最终在这里得到了解答：<br />
<a href="http://n2.nabble.com/No-Dialect-mapping-for-JDBC-type-2003-td1141106.html" target="_blank">http://n2.nabble.com/No-Dialect-mapping-for-JDBC-type-2003-td1141106.html</a><br />
按照邮件列表里的反映，上面的配置在Postgis里是可以work的，但是如果用Mysql还需要指定JPA的columnDefinition，对应的Hibernate属性是sql-type。虽然作者承诺会在今后的版本里修改这个问题，不过眼下的M2版本还没有修正这个问题。为此，Grails的用户特地提出在Grails中加入sql-type的支持：<br />
<a href="http://jira.codehaus.org/browse/GRAILS-3201" target="_blank">http://jira.codehaus.org/browse/GRAILS-3201</a><br />
现在按照下面文档的说明，可以在mapping里指定sqlType了：<br />
<a href="http://grails.org/doc/latest/ref/Database%20Mapping/column.html" target="_blank">http://grails.org/doc/latest/ref/Database%20Mapping/column.html</a></p>
<p>实例代码里的domain定义应该改成：</p>
<pre class="brush:groovy">
import com.vividsolutions.jts.geom.Polygon
import org.hibernatespatial.GeometryUserType

public class MyPoly {
    String name
    Polygon poly

    static mapping = {
        poly type: GeometryUserType， sqlType:"GEOMETRY"
    }

}
</pre>
<p>于是，再也没有莫名其妙的No Dialect报错了。</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2009/10/mapping-geometry-in-grails-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MySQL on ArchLinux</title>
		<link>http://sunng.info/blog/2009/07/using-mysql-on-archlinux/</link>
		<comments>http://sunng.info/blog/2009/07/using-mysql-on-archlinux/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 14:19:21 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[手艺]]></category>
		<category><![CDATA[装备]]></category>
		<category><![CDATA[ArchLinux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.classicning.com/blog/?p=123</guid>
		<description><![CDATA[su - pacman -S mysql mysql-gui-tools run mysql_install_db &#8211;user=mysql in /var/lib/mysql vim /etc/my.cnf, disable skip_networking to allow tcp/ip connection vim /etc/hosts.allow, add mysql:all:allow /etc/rc.d/mysql start mysqladmin -u root password #NEW_PASSWORD# to set root password su -]]></description>
			<content:encoded><![CDATA[<ol>
<li><em>su -</em></li>
<li><em>pacman -S mysql mysql-gui-tools<br />
</em></li>
<li>run <em>mysql_install_db &#8211;user=mysql</em> in <em>/var/lib/mysql</em></li>
<li><em>vim /etc/my.cnf</em>, disable <em>skip_networking </em>to allow tcp/ip connection<em><br />
</em></li>
<li><em>vim /etc/hosts.allow</em>, add <em>mysql:all:allow</em></li>
<li><em>/etc/rc.d/mysql start</em></li>
<li><em>mysqladmin -u root password #NEW_PASSWORD#</em> to set root password<em><br />
</em></li>
</ol>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">
<ol>
<li></li>
<li><em>su -</em></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2009/07/using-mysql-on-archlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB dump with chroot</title>
		<link>http://sunng.info/blog/2009/07/db-dump-with-chroot/</link>
		<comments>http://sunng.info/blog/2009/07/db-dump-with-chroot/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 11:59:07 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[装备]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.classicning.com/blog/?p=104</guid>
		<description><![CDATA[I caught chroot first time when attempting to install gentoo linux. Of course, its a tool of great useful. Two months ago I had my laptop crashed, and all static files were recovery easily by copy while raw db data &#8230; <a href="http://sunng.info/blog/2009/07/db-dump-with-chroot/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I caught chroot first time when attempting to install gentoo linux. Of course, its a tool of great useful. Two months ago I had my laptop crashed, and all static files were recovery easily by copy while raw db data file seems to be difficult to handle.</p>
<p>The old file system is in a mobile disk, mounted at /media/disk-1/. Now I try to use chroot to rollback to that environment, so that all standard dump tools will be available.</p>
<p>Before you chroot to the system, don&#8217;t forget to bind /dev to new location. Or you might get error prompt such as &#8220;/dev/null Permission Denied&#8221; (it&#8217;s a common error). Just execute command below:<br />
<em>$ sudo mount &#8211;bind /dev /media/disk-1/dev</em></p>
<p>Then change root to my old system:<br />
<em>$ sudo chroot /media/disk-1</em></p>
<p>Now you become root user automatically.</p>
<h3>MySQL Dump</h3>
<p>In a standard ubuntu mysql installation, we should launch mysql db from init.d by:<br />
<em># /etc/init.d/mysql start</em></p>
<p>But it&#8217;s no longer available in such environment. Fortunately, there is a direct way:<br />
<em># mysqld_safe &amp;</em></p>
<p>OK, go on to dump database with mysqldump:<br />
<em># mysqldump &#8211;all-databases &gt; mysql_dump_file</em></p>
<h3>Postgresql Dump</h3>
<p>We cannot use init.d to start pgsql either. Therefore, try to run it by:<br />
<em># su postgres -c &#8220;/usr/lib/postgresql/8.3/bin/pg_ctl start -D /etc/postgresql/8.3/main&#8221;</em></p>
<p><em>/etc/postgresql/8.3/main</em> is the default data directory in standard installation(with apt-get). This directory is supposed to contain a file named with &#8220;postgesql.conf&#8221;</p>
<p>Now pgsql db is also running. As root user we have no privilege to run pgsql utilities. so take following steps:<br />
<em># touch pgsql_dump_file<br />
# chmod a+w pgsql_dump_file<br />
# su postgres -c &#8220;pg_dumpall -f pgsql_dump_file&#8221;</em></p>
<h3>Conclusion</h3>
<p>Personally, I found it&#8217;s too complex and low efficiency to backup and restore data with mysql and postgresql. If there is no critical requirement(just like personal data management), file based db(Surely I mean sqlite) is no doubt better choice. Easy management(lots of gui tool now provided), smooth copy and move, standard db interface for programming, and enough functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2009/07/db-dump-with-chroot/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

