Project

General

Profile

DB Worker Node Add-on » History » Version 3

Udo Offermann, 02.04.2013 13:45

1 3 Udo Offermann
h1. DB Worker Node Add-on
2 2 Udo Offermann
3
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":http://www.h2database.com/ 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.
4
5
The add-on contains only a wrapper component that launches the H2 database in embedded mode (the h2 database jar is part of the 
6
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). 
7 1 Udo Offermann
8 3 Udo Offermann
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]].
9
10
The following files must be added or changed in the environment in order to run the DB worker node:
11
* *dbWorkerRepository.properties* (new file): this _z2 component repository_ points to this Add-on git repository.
12
* *dbWorker.properties* (new file): component containing JVM settings for the DB worker node like Java heap size, debug port etc.
13
* *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@.
14
* *dbWorkerUp.properties* (new file): this _z2 system state_ is attained by the dbWorker component.
15
* *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).
16
17
The DB worker node is fully transparent to the web applications. Thus the remaining steps are the same as for any other external databases:
18
* *systemDB.properties*: contains the h2 connection string (see also http://www.h2database.com/html/features.html#database_url)
19
* *samplesDB.properties*: the samples DB contains the name of the sample database plus its credentials
20
21
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.