Project

General

Profile

Actions

DB Worker Node Add-on » History » Revision 4

« Previous | Revision 4/14 (diff) | Next »
Udo Offermann, 02.04.2013 14:16


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 only H2 Database Engine is 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 the H2 database fulfills your requirements.

The add-on contains only a wrapper component that launches the H2 database in embedded mode (the h2 database jar is part of the
z2-base:source:base|com.zfabrik.db.drivers module) during 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).

In order to run the database within a separate process one has to configure the DB worker node in the environment module. This is illustrated at z2-samples:source:z2-samples-dbworker|environment, see also Sample_DBWorker_Node.

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 almost 11 years ago · 4 revisions