Grails, mongodb, nosql technologies

Fixing support of replica set by Grails mongo plugin

If you are going to use mongodb for production grails application you might stuck with the issue that replica set is really not supported by current version 1.0.0.M1 of mongodb plugin.

It is quite surprising because mongo java driver supports replica set configuration quite fine.

The problem is that GORM plugin is built on top of version 0.5.1 of gmongo library which doesn't support replica set. Only current development version 0.7 of gmongo library supports this feature.

So, the basic method of hacking grails to support this feature is to rebuild GORM mongo plugin with gmongo 0.7 and use right GMongo constuctor in grails-datastore-gorm-mongo by changing one line of its source code. Then you will have to hack around a bit to rebuild everything successfully because snapshots of used modules are very unstable and you will have to do minor hacks everywhere.

At the end you will have something that is attached to this post - e.g. binary replacements for jars for grails .ivy2 repository. You can just unpack with overwrite the attached file into root of your home folder and enjoy replica set support of hacked mongo GORM plugin 1.0.0.M1.

Looking to hire a software developer?
Don't hesitate to contact us.

Comments