eXo Platform 3.5

## Chapter 22. Configuring JBoss AS with eXo JCR in cluster

## Launching Cluster

### Deploying eXo JCR to JBoss As

To deploy eXo JCR to JBoss, do the following steps:

1. Download the latest version of eXo JCR .ear file distribution.

2. Copy <jcr.ear> into <%jboss_home%/server/default/deploy>

3. Put exo-configuration.xml to the root <%jboss_home%/exo-configuration.xml>

4. Configure JAAS by inserting XML fragment shown below into <%jboss_home%/server/default/conf/login-config.xml>

       <application-policy name="exo-domain">

          <authentication>

             <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"></login-module>

          </authentication>

       </application-policy>

5. Ensure that you use JBossTS Transaction Service and JBossCache Transaction Manager. Your exo-configuration.xml must contain such parts:

       <component>

          <key>org.jboss.cache.transaction.TransactionManagerLookup</key>

          <type>org.jboss.cache.GenericTransactionManagerLookup</type>^

       </component>

       <component>

          <key>org.exoplatform.services.transaction.TransactionService</key>

          <type>org.exoplatform.services.transaction.jbosscache.JBossTransactionsService</type>

          <init-params>

             <value-param>

                <name>timeout</name>

                <value>300</value>

             </value-param>

          </init-params>

       </component>

6. Start server:

   - bin/run.sh for Unix

   - bin/run.bat for Windows

7. Try accessing `http://localhostu:8080/browser` with root/exo as login/password if you have done everything right, you'll get access to repository browser.

### Configuring JCR to use external configuration

- To manually configure repository, create a new configuration file (e.g., exo-jcr-configuration.xml). For details, see JCR Configuration. Your configuration must look like:

      <repository-service default-repository="repository1">

         <repositories>

            <repository name="repository1" system-workspace="ws1" default-workspace="ws1">

               <security-domain>exo-domain</security-domain>

               <access-control>optional</access-control>

               <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>

               <workspaces>

                  <workspace name="ws1">

                     <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">

                        <properties>

                           <property name="source-name" value="jdbcjcr" />

                           <property name="dialect" value="oracle" />

                           <property name="multi-db" value="false" />

                           <property name="update-storage" value="false" />

                           <property name="max-buffer-size" value="200k" />

                           <property name="swap-directory" value="../temp/swap/production" />

                        </properties>

                        <value-storages>

                           see "

      " part.

                        </value-storages>

                     </container>

                     <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">

                        <properties>

                           <property name="root-nodetype" value="nt:unstructured" />

                        </properties>

                     </initializer>

                     <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">

                           see  "

      " part.

                     </cache>

                     <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">

                        see  "

      " part.

                     </query-handler>

                     <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">

                        see  "

      " part.

                     </lock-manager>

                  </workspace>

                  <workspace name="ws2">

                              ...

                  </workspace>

                  <workspace name="wsN">

                              ...

                  </workspace>

               </workspaces>

            </repository>

         </repositories>

      </repository-service>

- Then, update RepositoryServiceConfiguration configuration in exo-configuration.xml to use this file:

      <component>

         <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>

         <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>

         <init-params>

            <value-param>

               <name>conf-path</name>

               <description>JCR configuration file</description>

               <value>exo-jcr-configuration.xml</value>

            </value-param>

         </init-params>

      </component>

## Requirements

### Environment requirements

- Every node of cluster MUST have the same mounted Network File System with the read and write permissions on it.

  "/mnt/tornado" - path to the mounted Network File System (all cluster nodes must use the same NFS).

- Every node of cluster MUST use the same database.

- The same Clusters on different nodes MUST have the same names (e.g., if Indexer cluster in workspace production on the first node has the name "production_indexer_cluster", then indexer clusters in workspace production on all other nodes MUST have the same name "production_indexer_cluster" ).

### Configuration requirements

Configuration of every workspace in repository must contains of such parts:

- Value Storage configuration:

      <value-storages>

         <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">

            <properties>

               <property name="path" value="/mnt/tornado/temp/values/production" />    <!--path within NFS where ValueStorage will hold it's data-->

            </properties>

            <filters>

               <filter property-type="Binary" />

            </filters>

         </value-storage>

      </value-storages>

- Cache configuration:

      <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">

         <properties>

            <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-data.xml" />     <!--    path to JBoss Cache configuration for data storage -->

            <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" />                     <!--    path to JGroups configuration -->

            <property name="jbosscache-cluster-name" value="JCR_Cluster_cache" />                              <!--    JBoss Cache data storage cluster name -->

            <property name="jgroups-multiplexer-stack" value="false" />

            <property name="jbosscache-shareable" value="true" />

         </properties>

      </cache>

- Indexer configuration:

      <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">

         <properties>

            <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />

            <property name="index-dir" value="/mnt/tornado/temp/jcrlucenedb/production" />                       <!--    path within NFS where ValueStorage will hold it's data -->

            <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-indexer.xml" />    <!--    path to JBoss Cache configuration for indexer -->

            <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" />                       <!--    path to JGroups configuration -->

            <property name="jbosscache-cluster-name" value="JCR_Cluster_indexer" />                              <!--    JBoss Cache indexer cluster name -->

            <property name="jgroups-multiplexer-stack" value="false" />

            <property name="jbosscache-shareable" value="true" />

         </properties>

      </query-handler>

- Lock Manager configuration:

      <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">

         <properties>

            <property name="time-out" value="15m" />

            <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-lock.xml" />       <!--    path to JBoss Cache configuration for lock manager -->

            <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" />                       <!--    path to JGroups configuration -->

            <property name="jbosscache-cluster-name" value="JCR_Cluster_locks" />                                <!--    JBoss Cache locks cluster name -->

            <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks"/>                              <!--    the name of the DB table where lock's data will be stored -->

            <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>

            <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>

            <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk"/>

            <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>

            <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>

            <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>

            <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr"/>

            <property name="jgroups-multiplexer-stack" value="false" />

            <property name="jbosscache-shareable" value="true" />

         </properties>

      </lock-manager>

## How to stop the node properly

To be sure that all transactions are over and JCR is in consistent state after stopping node, you need to follow next steps:

- Connect using JMX to one of cluster's node which you won't need to stop.

- Use RepositorySuspendController suspend all repositories (see 37.1 Repository suspending)

- Stop the node

- Use RepositorySuspendController to resume all repositories (see 37.3 Repository resuming)

Copyright © 2009-2012. All rights reserved. eXo Platform SAS