JeromeDL/Installation/SeveralInstancesOnOneMachine

From Corrib Clan Wiki

Jump to: navigation, search

monallic lachicnaca ccnoroo

Contents

Several instances of JeromeDL on one machine

JeromeDL has still some points where hardcoded paths make it impossible to simply change an instalation directory. Some modifications have to be done in source code and property files. One should also configure each instance properly in Tomcat. This document describes how to establish several instances on one machine and connect them togather.


Big concept

We will try to achieve the following situation. For each instance we will create a separate directory with Tomcat, Exist, Sesame and JeromeDL. After configuring them properly Apache2 will be installed with mod_jk2 to receive connections on port 80 and pass them on to appropriate instances of JeromeDL.


Instalation and configuration

for each instance:

  • create a directory for a new instance of JeromeDL (eg. /www/addres_of_your_library)


Jakarta-Tomcat:

  • unpack Jakarta-Tomcat-5.5.7 inside this directory
    • edit conf/server.xml and change ports that they are unique and don't collide with other ports used by rest of Tomcats
    • add appropriate Context node that define your web application (consult it with JeromeDL instalation guide)
    • change Host node that it is also unique (address of this JeromeDL instance)


Exist:

  • install Exist inside your instance directory (consult it with JeromeDL instalation guide) and make sure to change a port on which Exist will run. You will find it in configuration file exist/tools/jetty/etc/jetty.xml. The port should be unique and doesn't collide with others.


Sesame:

  • download Sesame web application and put it in Jakarta-Tomcat webapp directory. You should also change Sesame configuration file to add appropriate repositories (consult it with JeromeDL instalation guide)


JeromeDL: modules:

  • get all JeromeDL modules from cvs and put them somewhere inside your instance directory (eg. instance_directory/modules)
    • edit base/src/jeromedllog.properties file and change names or paths of all log files that you can recognize them later when you will run several JeromeDL instances. If you added new path that doesn't exist you will have to create it before running stage
    • edit base/src/jeromedl.properties file and change sql_database_uri for a unique one (eg. from jdbc:mysql://localhost/jeromedl?autoReconnect=true to jdbc:mysql://localhost/address_of_your_library?autoReconnect=true). As you can see each instance will use its own database in mysql. You must add such database to mysql and add appropriate permissions to some users (consult it with JeromeDL instalation guide)
    • edit base/src/sesame.properties file. There is only one line, change it so it has appropriate url address of your new instance.
    • edit base/src/coreconfig.properties file and make the similar change with serveraddress and installdir properties

webapp:

  • get JeromeDLv2 webapp from cvs and put it into Jakarta-Tomcat webapps directory (consult it with JeromeDL instalation guide)
    • edit WEB-INF/src/jeromedl.properties and synchronize it with the same file in base module
    • edit WEB-INF/src/jenaback.properties and make sure sql_databsse_uri property is the same as in above file
    • edit WEB-INF/src/xmldb.properties and add appropriate port to address associated with xmldb_dbPath property. This is the port you chose for Exist
  • now create paths.sh file inside your instance directory and put there this content (remember to change instance_directory:
find . -name *.dtd -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.xsd -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.xsl -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.xml -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.java -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.wsdd -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
find . -name *.properties -exec sed -i 's|/www/webapps|/instance_directory/jakarta-tomcat-5.5.7/webapps|' {} \;
  • give execute permission to this file (chmod +x) and run it


Apache2:

  • install Apache2 server with mod_jk2 module
  • now follow the documentation which you can find on Apache2 web page. You will have to load mod_jk2 module, define some workers which will serve incoming requests and pass them to appropriate Tomcats and the last but not least define virtual hosts. You can make it all in few different ways. I will put an example below. It defines three JeromeDL servers which are accessible through different addresses:


  • /etc/httpd/conf/httpd.conf extended with (definition of virtual hosts)
NameVirtualHost *:80
<VirtualHost *:80>
       ServerName library.deri.ie
       DocumentRoot /corrib/library.deri.ie/jakarta-tomcat-5.5.7/webapps/JeromeDL/
       <IfModule mod_jk2.c>
               <Location "/*">
                       JkUriSet worker ajp13:localhost:8009
               </Location>
       </IfModule>
</VirtualHost>
<VirtualHost *:80>
       ServerName library.deri.at
       DocumentRoot /corrib/library.deri.at/jakarta-tomcat-5.5.7/webapps/JeromeDL/
       <IfModule mod_jk2.c>
               <Location "/*">
                       JkUriSet worker ajp13:localhost:7009
               </Location>
       </IfModule>
</VirtualHost>
<VirtualHost *:80>
       ServerName library.deri.org
       DocumentRoot /corrib/library.deri.org/jakarta-tomcat-5.5.7/webapps/JeromeDL/
       <IfModule mod_jk2.c>
               <Location "/*">
                       JkUriSet worker ajp13:localhost:9009
               </Location>
       </IfModule>
</VirtualHost>


  • new /etc/httpd/conf.d/mod_jk2.conf file (loads mod_jk2 module, defines workers definition file, sets log files)
# Sample mod_jk2.conf  08-Feb-2004, located at:
# http://www.gknw.com/development/apache/docs/win32/mod_jk2/mod_jk2x.conf
#   
# Load the mod_jk2 module
#   
LoadModule jk2_module modules/mod_jk2.so
<IfModule mod_jk2.c>
   #-----------------------------------------------
   # Set the Apache2 logger level
   #-----------------------------------------------
   #
   JkSet2 logger level debug
   #-----------------------------------------------
   # Set the alternate log file
   #-----------------------------------------------
   #
   JkSet2 logger.file:0 file ${serverRoot}/logs/jk2.log
   JkSet2 logger.file:0 level debug
   #-----------------------------------------------
   # Set the scoreboard file
   #-----------------------------------------------
   #
   JkSet2 shm: file ${serverRoot}/logs/jk2.shm
   JkSet2 shm: size 1048576
   #-----------------------------------------------
   # Where to find the workers2.properties file
   #-----------------------------------------------
   #
   JkSet config.file ${serverRoot}/conf/workers2.properties
</IfModule>


  • new /etc/httpd/conf/workers2.properties file (defines workers)


#---- workers2.properties
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
host=127.0.0.1
port=8009
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[channel.socket:localhost:7009]
info=Ajp13 forwarding over socket
tomcatId=localhost:7009
host=127.0.0.1
port=7009
[ajp13:localhost:7009]
channel=channel.socket:localhost:7009
[channel.socket:localhost:9009]
info=Ajp13 forwarding over socket
tomcatId=localhost:9009
host=127.0.0.1
port=9009
[ajp13:localhost:9009]
channel=channel.socket:localhost:9009
[channel.socket:localhost:8109]
info=Ajp13 forwarding over socket
tomcatId=localhost:8109
host=127.0.0.1
port=8109
[ajp13:localhost:8109]
channel=channel.socket:localhost:8109
     [shm]
     file=/opt/tomcat/work/jk.shm
     size=1048576


As you can see there are three Tomcat servers which have AJP 1.3 Connectors accessible on different ports (7009, 8009, 9009)

Running

for each instance:

  • run Exist
  • set CATALINA_HOME to point at appropriate Jakarta-Tomcat directory (different for each instance)
  • run Jakarta-Tomcat
  • track logs to ensure you didn't forget anything
  • to fasten these instances into hypercup network just proceed according to JeromeDL instalation guide


krystian[dot]samp[funny-character-like-a-snail]deri[point]org.com.pl[choose-first-one]

Good Luck

krystian

Facts about JeromeDL/Installation/SeveralInstancesOnOneMachine — Click + to find similar pages.RDF feed
Personal tools

Corrib cluster project is supported by Enterprise Ireland under Grant No. ILP/05/203, Science Foundation Ireland under Grant No. SFI/02/CE1/I131.
Hosted at DERI, NUI Galway.