Posts

Showing posts from July, 2013

Exporting from MySQL to H2

Image
When it comes to testing, you can't beat the convenience of an embedded database. It can be created, populated and cleaned up without any dependencies on outside infrastructure, making it ideal for self contained test suites. However, there is a very good chance that you don't use an embedded database in your production environment. In my case, I have a MySQL database in production, and want to use H2 in testing. Getting data from MySQL into H2 is not as straight forward as you might think. You might have some luck with CopyDB , Scriptella , or OpenDBCopy . But in the end I simply used mysqldump and a couple of hacks to get data from MySQL to H2. Dump the data Dump the data from MySQL with the following command: mysqldump --compatible=ansi,no_table_options,no_field_options,no_key_options --hex-blob --skip-opt -uroot -p Database > importansi.sql This will strip out most of the MySQL specific syntax and give you something that you can clean up for H2 to import.

Setting up a MariaDB Galera cluster in Centos 6

Image
 Synopsis One of the big draw cards of MariaDB over MySQL is open source support for clustering. While the open source version of MySQL allows for replication amongst a number of read only nodes, MariaDB has true multi-master replication. If you have read the documentation at https://kb.askmonty.org/en/getting-started-with-mariadb-galera-cluster/, you could be forgiven for believing that setting up a cluster is a trivial process. Unfortunately those instructions leave out a few vital details that will prevent your cluster from working. These are the steps I used to get a MariaDB Galera Cluster running in Centos 6. Configure the YUM repo Go to https://downloads.mariadb.org/mariadb/repositories/ and select Centos as the OS, and 5.5 as the version. Galera (the clustering component of MariaDB) is only available with version 5.5 at this time. I have the 64 bit version of Centos, so the resulting file looks like this: # MariaDB 5.5 CentOS repository list - created 2013-07-03