![]() | Note |
---|---|
This documentation describes the configuration of a clustered database in a RAID1. For further information, refer to the ObjectWeb C-JDBC documentation http://c-jdbc.objectweb.org/doc/index.html. |
This configuration starts three HSQL instances, which are formed by C-JDBC as a RAID1. A RAID1 stores the same data in two different databases and uses a third database as a recovery log.
Download the C-JDBC binaries from the C-JDBC site (http://c-jdbc.objectweb.org).
Extract the C-JDBC archive into a folder:
tar xvfz c-jdbc-xx-bin.tar.gz |
Set the environment variables:
export JAVA_HOME=<Path_to_JDK_HOME> export CJDBC_HOME=<Path_to_CJDBC_HOME> |
Modify the $CJDBC_HOME/demo/demo-raidb1.sh file.
The ports for the HSQLDB instances have to be modified in order to match the sampleCluster2. Change the ports for the three databases to 11001, 11002, 11003.
Configure the C-JDBC controller file:
Modify the ports in $CJDBC_HOME/config/virtualdatabase/hsqldb-raidb1.xml according to values defined in the section above. To avoid problems in the Datasource configuration of JOnAS, you must also set a password with which the users can log in.
Back up the original configuration:
mv $CJDBC_HOME/config/controller/controller.xml \ $CJDBC_HOME/config/controller/controller.xml.original |
Create a link for the new configuration:
ln -s $CJDBC_HOME/config/controller/controller-raidb1.xml \ $CJDBC_HOME/config/controller/controller.xml |
Modify the file $CJDBC_HOME/config/controller/controller.xml to specify the configuration file of the virtual database, which is $CJDBC_HOME/config/virtualdatabase/hsqldb-raidb1.xml
Start the HSQL instances:
$CJDBC_HOME/demo/demo-raidb1.sh |
Start the C-JDBC controller:
$CJDBC_HOME/bin/controller.sh |
Connect to the C-JDBC controller using the JDBC driver in $CJDBC_HOME/drivers and the URL jdbc:cjdbc://localhost:25322/myDB with:
username: <user>
password: <pass>
![]() | Note |
---|---|
No password is specified by default, but you should specify one in the $CJDBC_HOME/config/virtualdatabase/hsqldb-raidb1.xml file. |
###################### C-JDBC DataSource configuration example ###### DataSource configuration # datasource.name jdbc_1 datasource.url jdbc:cjdbc://localhost:25322/myDB datasource.classname org.objectweb.cjdbc.driver.Driver datasource.username user datasource.password pass datasource.mapper rdb.hsql # Note: You must specify the mapper of the databases used as backend # by C-JDBC. # A heterogeneous C-JDBC configuration cannot be used here! |