Monday, May 11, 2015

H2 database in WSO2 products.

H2 is open source and free to distribute. Therefore WSO2 product has selected H2 as the default embedded database. All WSO2 products use embedded H2  databases to store application data in default distribution.

Eg:  WSO2 Identity Server use WSO2CARBON_DB to store registry, user management and identity management related data (service providers, SSO configurations, tokens ..etc). WSO2 API Manager use WSO2AM_DB to store API related data.

You can browse those databases , please look at this post

The H2 database can run in different modes including embedded mode, server mode and mixed mode.

This embedded database can be corrupted due to various reasons including failed file locking at the concurrent access (, kill Java process to shut down the server, low disc space  ..etc.

WSO2 highly recommend to use standard production ready database like MySQL, Oracle, PostgreSQL ..etc for production/Dev/QA deployment rather using embedded H2 database(s).

The registry database has three logical partition called , local, config and governance. You can only use the default embedded H2 database only for the local registry.

In local registry we store mount configurations, if the local registry is corrupted we can simply delete default embedded H2 database and restart the server  with -Dsetup parameter. Then new database will be created and mount configuration will populate automatically.