Page tree
Skip to end of metadata
Go to start of metadata

It is possible to run Magnolia CMS while using Azure DB as the storage mechanism for data.

JackRabbit offers a specific DDL schema for Azure DB (Microsoft Azure SQL Database). These are the steps that need to be taken in order to correctly install your repository on an Azure DB schema.

  1. Copy jackrabbit-bundle-mysql-search.xml from the empty webapp overlay, rename it to jackrabbit-bundle-azure-search.xml and place it in WEB-INF/config/repo-conf/.
    The configuration file for mysql can be easily adapted to work for Azure DB.
  2. Use the PersistanceManager class for MSSQL: org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager.
    Since Azure DB is based on Microsoft SQL Server the classes for MSSQL may be used.
  3. Change the schema type from 'mssql' to 'azure'.
    There is a special set of schema DDL files available for Azure DB. The main difference is that it creates clustered indexes, instead of non-clustered indexes.
  4. Configure a JNDI datasource or specify your the driver class and connection parameters directly in the jackrabbit bundle configuration file.

Warning

Using the schema type 'mssql' instead of 'azure' on Azure DB should be considered as a mis-configuration. It works but comes with a huge performance penalty, causing all sorts of buggy behavior in Magnolia CMS that can be traced back to timeouts on database queries. It is important for clustered indexes to be created, as these drastically improve the performance of the JackRabbit (2.3+) repositories that are stored in Azure DB. Use 'azure' as schema type!

JackRabbit bundle configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN" "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
<Repository>
    <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
        <param name="driver" value="javax.naming.InitialContext"/>
        <param name="url" value="java:jboss/mydatasource"/>
        <param name="schema" value="azure"/>
        <param name="schemaObjectPrefix" value="fsrep_"/>
    </FileSystem>
    <Security appName="Jackrabbit">
        <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" />
        <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
            <param name="anonymousId" value="anonymous" />
        </LoginModule>
    </Security>
    <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
        <param name="driver" value="javax.naming.InitialContext"/>
        <param name="url" value="java:jboss/mydatasource"/>
        <param name="databaseType" value="azure"/>
        <param name="schemaObjectPrefix" value="ds_" />
        <param name="minRecordLength" value="8192"/>
    </DataStore>
    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
    <Workspace name="default">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:jboss/mydatasource"/>
            <param name="schema" value="azure"/>
            <param name="schemaObjectPrefix" value="fs_${wsp.name}_"/>
        </FileSystem>
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:jboss/mydatasource"/>
            <param name="schema" value="azure" /><!-- warning, this is not the schema name, it's the db type -->
            <param name="schemaObjectPrefix" value="pm_${wsp.name}_" />
            <param name="externalBLOBs" value="false" />
            <param name="bundleCacheSize" value="100" />
        </PersistenceManager>
        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
            <!-- SearchIndex will get the indexing configuration from the classpath, if not found in the workspace home -->
            <param name="indexingConfiguration" value="/info/magnolia/jackrabbit/indexing_configuration.xml"/>
            <param name="useCompoundFile" value="true"/>
            <param name="minMergeDocs" value="100"/>
            <param name="volatileIdleTime" value="3"/>
            <param name="maxMergeDocs" value="100000"/>
            <param name="mergeFactor" value="10"/>
            <param name="maxFieldLength" value="10000"/>
            <param name="bufferSize" value="10"/>
            <param name="cacheSize" value="1000"/>
            <param name="forceConsistencyCheck" value="false"/>
            <param name="autoRepair" value="true"/>
            <param name="queryClass" value="org.apache.jackrabbit.core.query.QueryImpl"/>
            <param name="respectDocumentOrder" value="true"/>
            <param name="resultFetchSize" value="100"/>
            <param name="extractorPoolSize" value="3"/>
            <param name="extractorTimeout" value="100"/>
            <param name="extractorBackLogSize" value="100"/>
            <!-- needed to highlight the searched term -->
            <param name="supportHighlighting" value="true"/>
            <!-- custom provider for getting an HTML excerpt in a query result with rep:excerpt() -->
            <param name="excerptProviderClass" value="info.magnolia.jackrabbit.lucene.SearchHTMLExcerpt"/>
        </SearchIndex>
    </Workspace>
    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:jboss/mydatasource"/>
            <param name="schema" value="azure"/>
            <param name="schemaObjectPrefix" value="fsver_"/>
        </FileSystem>
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
            <param name="driver" value="javax.naming.InitialContext"/>
            <param name="url" value="java:jboss/mydatasource"/>
            <param name="schema" value="azure" /><!-- warning, this is not the schema name, it's the db type -->
            <param name="schemaObjectPrefix" value="version_" />
            <param name="externalBLOBs" value="false" />
        </PersistenceManager>
    </Versioning>
</Repository>
  • No labels

2 Comments

  1. Hi-

    Thanks for the write up! In the future, if you could please register for a personal account and use that account to create pages we would appreciate that. Rather then use our training user "Training Participants - FullStack Developer". 

    Cheers

    1. Hi Richard Gange

      Yeah, that was by mistake. Somehow my browser had me logged in as the training user while I wasn't expecting that!

      Regards