Project

General

Profile

Actions

DB Worker Node Add-on » History » Revision 6

« Previous | Revision 6/14 (diff) | Next »
Udo Offermann, 03.04.2013 15:07


DB Worker Node Add-on

The DB Worker Node Add-on is a all-in-one-system z2 installation comprising the z2-Environment plus a database (at the moment H2 Database Engine and Apache Derby are supported). The purpose is to have a quick and easy system setup like development or demonstration environments. Of course one can use it also for productive systems if H2 or Derby fulfills your requirements.

The add-on provides wrapper components that launches the actual database during the z2 bootstrap. Since the wrapper is launched on a separate z2 worker node (i.e. the DB Worker node) the database runs in server mode from the web applications point of view (which are running on the web worker node).

Using the DB Worker Node Add-on

At first you have to tell the z2-Environment where to find the DB Worker Node Add-on. Usually this is done in the environment module which is used to describe the overall system setup.

In order to run the database within a separate process one has to configure the DB worker node in the com.zfabrik.db.environment module

The following files must be added or changed in the environment in order to run the DB worker node:
  • dbWorkerRepository.properties (new file): this z2 component repository points to this Add-on git repository.
  • dbWorker.properties (new file): component containing JVM settings for the DB worker node like Java heap size, debug port etc.
  • home.properties (changed file): the home layout component lists all workers to start in the given order. It's recommended to start the DB worker node before all other nodes: home.workers=environment/dbWorker,environment/webWorker.
  • dbWorkerUp.properties (new file): this z2 system state is attained by the dbWorker component.
  • h2DatabaseServer.properties (new file): the H2 database launcher component participates in the dbWorkerUp system state, thus it will be launched inside the separate JVM of the DB worker node. This component contains also several H2 command arguments like TCP port, ssl mode etc (see the documentation of the main method at http://www.h2database.com/javadoc/org/h2/tools/Server.html for more details).
The DB worker node is fully transparent to the web applications. Thus the remaining steps are the same as for any other external databases:

As mentioned before the database is started as the first node during the overall z2 bootstrap process so that the database is available before the web applications are started. The database schema can be generated using migration tools like flyway, automatic schema generation feature from hibernate or simply by using the database specific DDL via JDBC.

Updated by Udo Offermann over 11 years ago · 6 revisions