DB Worker Node Add-on » History » Version 13
Henning Blohm, 20.06.2013 09:08
1 | 3 | Udo Offermann | h1. DB Worker Node Add-on |
---|---|---|---|
2 | 2 | Udo Offermann | |
3 | 6 | Udo Offermann | 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":http://www.h2database.com/ and "Apache Derby":http://db.apache.org/ 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. |
4 | 1 | Udo Offermann | |
5 | 12 | Henning Blohm | 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). So in short, all worker nodes connect to the database worker node like they would connect to any other database server. |
6 | 1 | Udo Offermann | |
7 | 6 | Udo Offermann | h2. Using the DB Worker Node Add-on |
8 | |||
9 | 13 | Henning Blohm | At first one 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. The file @dbWorkerAddon.properties@ attached to this page is a z2 repository component for this add-on which you can directly add to the _environment_. Here is the gist of it, pointing to the master branch of the ZFabrik provided repositories: |
10 | 1 | Udo Offermann | |
11 | 13 | Henning Blohm | <pre> |
12 | com.zfabrik.systemStates.participation=com.zfabrik.boot.main/sysrepo_up |
||
13 | com.zfabrik.component.type=com.zfabrik.gitcr |
||
14 | gitcr.optional=true |
||
15 | gitcr.uri=http://git.z2-environment.net/z2-addons.dbworker |
||
16 | gitcr.branch=master |
||
17 | </pre> |
||
18 | 9 | Udo Offermann | |
19 | 13 | Henning Blohm | Secondly the DB worker must be launched in addition to the web worker (and possibly other worker nodes, like a batch job processing job worker). To achieve that, we modify the _home layout_, that is defined in the environment at @environment/home.properties@. Attached to this page is a modified @home.properties@ that launches the DB worker and afterwards the web worker: |
20 | 9 | Udo Offermann | |
21 | 1 | Udo Offermann | <pre> |
22 | 7 | Udo Offermann | com.zfabrik.component.type=com.zfabrik.homeLayout |
23 | home.workers = com.zfabrik.db.environment/h2Worker, environment/webWorker |
||
24 | </pre> |
||
25 | 3 | Udo Offermann | |
26 | 10 | Udo Offermann | Note that @com.zfabrik.db.environment/h2Worker@ precedes @environment/webWorker@ so that the DB is up and running before the web worker is started. |
27 | 7 | Udo Offermann | To use Derby instead of H2 you simply replace the @home.workers@ by |
28 | 3 | Udo Offermann | |
29 | 7 | Udo Offermann | <pre> |
30 | home.workers = com.zfabrik.db.environment/derbyWorker, environment/webWorker |
||
31 | </pre> |
||
32 | |||
33 | The DB worker node is fully transparent to the web applications so there is no need for further changes. As usual you have to make sure that the applications on the web worker are using the corresponding JDBC drivers and database client settings (connection string, user and password etc). Also using migration tools like flyway or other automatic schema generation feature as provided by hibernate for example can be used as usual. |