

The MoSQL logo: a PostgreSQL elephant in disguise Faced with a need to have a live backup of their MongoDB clusters in a PostgreSQL instance, the developers at Stripe developed, and have now released as open source, MoSQL. MoSQL is a Ruby application which streams the changes in a MongoDB cluster and reformats them into a stream of SQL which can be sent to a more traditional SQL-based relational database.

Configuring it does require that the administrators create a "collection map" that maps the fields of a JSON document into the columns of the SQL database. MoSQL can optionally be configured to record any fields which it comes across in an _extra_props column for later analysis. The developers recommend running MoSQL for the first time on a secondary node of the MongoDB cluster as it will create a lot of disk activity.

The developers of MoSQL note that the process of transferring the data means that while production services can be running on the MongoDB cluster, the data in the SQL database can use the full power of SQL for offline analytics and reporting. MoSQL has been released under the MIT licence and can be cloned from the project's GitHub repository.

(djwm)