[Csync2] Working on database abstration layer and mysql support

Dennis Schafroth dennis at schafroth.dk
Sun Aug 29 22:36:43 CEST 2010


Hey,

Attached is a patch to a database abstraction. I have it running on two Fedora 13 and a OpenSUSE 11.3. It should be considered beta status, and I would like to get feed back on how it works for others set-ups (non production!). 


I have mostly tested using MySQL 5. I have done some minor testing on sqlite 3, and haven't seen any regression, but wont promise.

The SQL statements has been modified to a level so they work for these databases, but some more advanced SQL mapping  is prob. needed to support more.

DB API with support for:
- sqlite 2 (not tested), sqlite 3 (somewhat tested), mysql 5  
- New global configuration: database <file with database spec> containing one of: 
	- mysql://user:passwd@host:port/schema 
	- sqlite3://path/to/file
	- sqlite2://path/to/file
- For testing the -a option can be used to give a similar database specification. 
- No support for creating the database and tables in mysql 5. There is a ./sql/csync.sql for creating the tables where it uses UTF-8 binary character encoding, but this must be changed to match your file system setup and case (in)sensitive !!!  

I have done some changes in the autoconf / automake, in which I am no expert. 

mysql support is currently only enabled if you configure with --enable-mysql. 

For a mysql set-up: 
1) configure and built with mysql support
2) create a database as root/admin and grant access to your csync2 user. 
3) create the tables/indexes using the sql/csync2.sql (modified to your setup) 
4) create the database file spec file. 
5) add the global configuration:  database <database spec file> 

Should now be ready to test. 

Also included in the patch is a option for syslog logging (-l) and a change in backup strategy in the daemon. I prefer to create a identical directory tree in the backup, instead of the flat structure. 

cheers, 
:-Dennis Schafroth

On 22/08/2010, at 21.51, Lars Ellenberg wrote:

> On Sat, Aug 21, 2010 at 11:05:27PM +0200, Dennis Schafroth wrote:
>> Hey, 
>> 
>> I am working on a patch to introduce a simple database abstraction
>> layer, so it will be easier to introduce alternative databases. I also
>> have the a basic mysql version (almost) working, it has crashed on a
>> OpenSuse box, but worked on my Fedora boxes.
>> 
>> If there are any brave volunteers, that wants to try, let me know. It
>> wont be clean at the moment. 
> 
> Great.
> Please post a unified diff against latest svn to this list.
> Or, if you prefer, send it pm my way.
> Or put it online as git/mercurial/whatever.
> 
> Thanks,
> 
> -- 
> : Lars Ellenberg
> : LINBIT | Your Way to High Availability
> : DRBD/HA support and consulting http://www.linbit.com
> 
> DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
> _______________________________________________
> Csync2 mailing list
> Csync2 at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/csync2/attachments/20100829/b0d583db/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: db_api.patch.gz
Type: application/x-gzip
Size: 21308 bytes
Desc: not available
URL: <http://lists.linbit.com/pipermail/csync2/attachments/20100829/b0d583db/attachment-0001.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/csync2/attachments/20100829/b0d583db/attachment-0003.htm>


More information about the Csync2 mailing list