Context Navigation

Using a "real" database

The default install of the Raptor MUA ships with a built-in lightweight database namely, HyperSQL (​http://hsqldb.org/). Raptor uses HyperSQL with persistent disk cached tables as opposed to the faster persistent memory tables - which limits the size of tables to the size of working memory. As a result, this configuration should work well for test environments or production environments with small amounts of data, but for real production environments with larger data sets (number of stored events), it is recommended to switch to a heavy weight database e.g. Postgres (​http://www.postgresql.org/).

Some rough rules of thumb that users have discovered are as follows:

HSQL works fine up to about 100,000 events.

A real database on a VM works fine up to about 1,000,000 events.

Beyond this, you need to think about a real database on dedicated hardware.

Raptor currently supports the following databases:

MySQL

Oracle

Postgres

How to switch to a real database

Switching to a real database is relatively easy within the MUA. The steps you need to follow are:

Install and configure a production ready database (either on the same server or a different server).

Add a user "raptor" with a password of your choosing with admins rights (Alternatively you could choose to use the default Postgres user for ease of setup).

Make sure the user running the raptor software (root unless you've changed it) can access the database. e.g. on postgres change /var/lib/pgsql/data/pg_hba.conf to allow connections from anyone on localhost.

2. Configuring the Raptor MUA to use the database

Edit the file mua/conf/database.xml.

Change

<ref bean="muac3p0DataSourceHSQLDB" />

to the value relevant to the database you're using:

For MySQL

<ref bean="muac3p0DataSourceMySQL" />

For Oracle

<ref bean="muac3p0DataSourceOracle" />

For Postgres

<ref bean="muac3p0DataSourcePostgres" />

Find the following code fragment:

<!-- All of these hibernate.dialect properties should be commented out apart from the one you want to use -->
<prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>
<!-- <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect</prop>-->
<!-- <prop key="hibernate.dialect"> org.hibernate.dialect.OracleDialect</prop> -->
<!-- <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop>-->

and swap the comments around such the the correct entry is uncommented. E.g. for Oracle

<!-- All of these hibernate.dialect properties should be commented out apart from the one you want to use -->
<!--<prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>-->
<!-- <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect</prop>-->
<prop key="hibernate.dialect"> org.hibernate.dialect.OracleDialect</prop>
<!-- <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop>-->

In the bean relevant for your database, change the connection parameters to match those of your database (i.e. jdbcUrl, user, and password).

3. Setting up the database schema

The most reliable way to set up the database schema is to get hibernate to do it for you. To do this, perform the following steps:

Edit the file mua/conf/database.xml.

Find the bean with id of "muaSessionFactor" (should be one of the very first in the file)

In this, find the property with name "hibernate properties".

In this, find the prop with the key of "hibernate.hbm2ddl.auto".

Change the value from "update" to "create".

Restart the MUA. Hibernate will now create the schema relevant to the dialect you chose in section 2 of this guide.

IMPORTANT: Once the MUA has started, change the value from "create" back to "update" - if you do not do this, next time the MUA is started hibernate will wipe out your database and recreate it from scratch, losing all data in the process!

The other option is to manually create the schema yourself. The generic dialect schema (relevant to event-name-limit.hbm.xml) is attached to this page.