Configuring high availability for Repository with external database


By default, the repository contains an embedded database. You can enable high availability for the repository by configuring the repository to use an external database and leveraging the clustering features of the external database to provide failover.

Important

External databases specified in the following list are the only supported databases that can be configured for the repository.

For the MySQL, Oracle, and MS SQL Server Databases, after upgrading the platform, update the class names in the repository.xml files and place the database's connector/driver jar file in the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory before starting the repository server.

Before you begin

Important

For advanced database configuration information, refer to the documentation for your database type.

  • Do not start the repository server before configuring the repository to use an external server. If you are upgrading to the latest version of the repository, configure the external database first and then start the repository server. 

To configure the repository to use a MySQL database

  1. Create an external database:
    1. In the external database, set the max_allowed_packet variable to a value between 512 MB and 1 GB.
      For information about how to set this variable, see the product documentation for your database.
    2. Set up the database user:
      • Create the user and user password.
      • Set up read and write permissions for the user.
    3. In the external database, create a new database (for example, repository), using the credentials created in step 1.b.
  2. Extract the contents of the repository .war file into a new baorepo directory:
    1. Under the repoInstallationDirectory/tomcat/webapps/ directory, create the baorepo subdirectory.
    2. In the baorepo subdirectory, unzip the repoInstallationDirectory/tomcat/webapps/baorepo.war file.
  3. Place the database's connector/driver jar file in the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory.
    Example:
    You could place the mysql-connector-<compatibleVersion>-bin.jar file in the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory.

    Important

    The connector/driver jar file required based on the database version is listed in the following table:

    Database version

    Required JAR

    MySQL versions earlier than MySQL8

    mysql-connector-java-<MySQL-VERSION>-bin.jar

    MySQL8

    mysql-connector-java-8.0.28 jar

    Important

    The compatible version for database's connector/driver jar for MySQL8 is 8.0.28. Do not use any other version of the jar file, otherwise database might get corrupted.

  4. Open the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/classes/META-INF/repository.xml file in a text editor and update it with the connection information for the external database.
    The MySQL database connection properties are as follows:

    Parameter

    Description

    class

    Abstract base class for the FileSystem, DataStore, PersistenceManager, and Cluster tags.

    driver

    The fully-qualified class name of the JDBC driver.

    com.mysql.cj.jdbc.Driver

    URL

    URL and port number for the external database.

    jdbc:mysql://<database hostname>:<port>/<database name>

    You can omit the port number if you use the default port for the database.

    user

    Database user name that you created in step 1.

    password

    Password that you assigned to the database user.

    schema

    The string value that indicates the database type. Use the exact string value.

    This is not the name of the database schema.

    schemaObjectPrefix

    The string of characters at the beginning of the object name.

    externalBLOBs

    The external file system where the data is stored. This parameter is specific to the PersistenceManager tag located in the Workspace section in the file.

    1. Modify the FileSystem tag.

      File System for MySQL
      <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="fs_"/>
      </FileSystem>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the FileSystem class with "com.bmc.repository.server.security.BAODbFileSystem"
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    2. Add a new DataStore tag.

      Data Store for MySQL
      <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="databaseType" value="mysql" />
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="datastore_"/>
      </DataStore>

      Important

      • For schemaObjectPrefix parameter, the value must be unique for each user or schema pointing to the same database.
      • To use the encrypted database password in the repository.xml file
        1. Replace the DataStore class with "com.bmc.repository.server.security.BAODbDataStore"
        2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    3. Replace both the existing PersistenceManager tags located under the Workspace and Versioning sections. 

      Persistence Manager for MySQL - Workspace schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="${wsp.name}"/>
      <param name="externalBLOBs" value="false"/>
      </PersistenceManager>
      Persistence Manager for MySQL - Versioning schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="version_"/>
      </PersistenceManager>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the PersistenceManager class with "com.bmc.repository.server.security.BAOMySqlPersistenceManager".
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    4. Add a new Cluster tag.

      Cluster for MySQL
      <Cluster id="<unique cluster id>" syncDelay="2000">
      <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
      <param name="revision" value="${rep.home}/revision.log" />
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="journal_"/>
      </Journal>
      </Cluster>

      Important

      • You must assign a unique cluster id to each new repository.
      • To use the encrypted database password in the repository.xml file
        1. Replace the Journal class with "com.bmc.repository.server.security.BAODatabaseJournal"
        2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
      Click here to view a sample MySQL repository.xml file
      <?xml version="1.0"?>
       <!--
           Licensed to the Apache Software Foundation (ASF) under one or more
           contributor license agreements.  See the NOTICE file distributed with
           this work for additional information regarding copyright ownership.
           The ASF licenses this file to You under the Apache License, Version 2.0
           (the "License"); you may not use this file except in compliance with
           the License.  You may obtain a copy of the License at
       
               http://www.apache.org/licenses/LICENSE-2.0
       
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        -->

       <!-- Example Repository Configuration File
             Used by
             - org.apache.jackrabbit.core.config.RepositoryConfigTest.java
             -
        -->

       <Repository>
           <!--
                virtual file system where the repository stores global state
                (e.g. registered namespaces, custom node types, etc.)
            -->

           <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
             <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
             <param name="driver" value="com.mysql.cj.jdbc.Driver" />
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="fs_"/>
           </FileSystem>
           
           <!-- data store configuration -->
           
           <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
            <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
             <param name="driver" value="com.mysql.cj.jdbc.Driver" />
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="databaseType" value="mysql" />
             <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="datastore_"/>
           </DataStore>
           
           <!--
                security configuration
            -->

           <Security appName="Jackrabbit">
               <!--
                    security manager:
                    class: FQN of class implementing the JackrabbitSecurityManager interface
                -->

               <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security">
                   <!--
                    workspace access:
                    class: FQN of class implementing the WorkspaceAccessManager interface
                    -->

                   <!-- <WorkspaceAccessManager class="..."/> -->
                   <!-- <param name="config" value="${rep.home}/security.xml"/> -->
               </SecurityManager>
       
               <!--
                    access manager:
                    class: FQN of class implementing the AccessManager interface
                -->

               <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
                   <!-- <param name="config" value="${rep.home}/access.xml"/> -->
               </AccessManager>
       
               <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
                  <!--
                      anonymous user name ('anonymous' is the default value)
                    -->

                  <param name="anonymousId" value="anonymous"/>
                  <!--
                      administrator user id (default value if param is missing is 'admin')
                    -->

                  <param name="adminId" value="admin"/>
               </LoginModule>
           </Security>
       
           <!--
                location of workspaces root directory and name of default workspace
            -->

           <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
           <!--
                workspace configuration template:
                used to create the initial workspace if there's no workspace yet
            -->

           <Workspace name="${wsp.name}">
               <!--
                    virtual file system of the workspace:
                    class: FQN of class implementing the FileSystem interface
                -->

               <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                   <param name="path" value="${wsp.home}"/>
               </FileSystem>
               <!--
                    persistence manager of the workspace:
                    class: FQN of class implementing the PersistenceManager interface
                -->

               <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
                 <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
                 <param name="driver" value="com.mysql.cj.jdbc.Driver" />
                 <param name="user" value="<database user>"/>
                 <param name="password" value="<database password>"/>
                 <param name="schema" value="<schema name>"/>
                 <param name="schemaObjectPrefix" value="${wsp.name}"/>
                 <param name="externalBLOBs" value="false"/>
               </PersistenceManager>
               <!--
                    Search index and the file system it uses.
                    class: FQN of class implementing the QueryHandler interface
                -->

               <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
                   <param name="path" value="${wsp.home}/index"/>
                   <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
                   <param name="extractorPoolSize" value="2"/>
                   <param name="supportHighlighting" value="true"/>
               </SearchIndex>
           </Workspace>
       
           <!--
                Configures the versioning
            -->

           <Versioning rootPath="${rep.home}/version">
               <!--
                    Configures the filesystem to use for versioning for the respective
                    persistence manager
                -->

               <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                   <param name="path" value="${rep.home}/version" />
               </FileSystem>
       
               <!--
                    Configures the persistence manager to be used for persisting version state.
                    Please note that the current versioning implementation is based on
                    a 'normal' persistence manager, but this could change in future
                    implementations.
                -->

               <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
           <param name="driver" value="com.mysql.cj.jdbc.Driver" />
           <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
           <param name="user" value="<database user>"/>
           <param name="password" value="<database password>"/>
           <param name="schema" value="<schema name>"/>
           <param name="schemaObjectPrefix" value="version_"/>
         </PersistenceManager>
           </Versioning>
       
           <!--
                Search index for content that is shared repository wide
                (/jcr:system tree, contains mainly versions)
            -->

         <!--  <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
                
      <param name="path" value="${rep.home}/repository/index"/>
                
      <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
                
      <param name="extractorPoolSize" value="2"/>
                
      <param name="supportHighlighting" value="true"/>
            </SearchIndex>
            -->

           
           <Cluster id="<unique cluster id>" syncDelay="2000">
         <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
         <param name="revision" value="${rep.home}/revision.log" />
         <param name="driver" value="com.mysql.cj.jdbc.Driver" />
         <param name="url" value="jdbc:mysql://<database hostname>:<port>/<database name>" />
         <param name="user" value="<database user>"/>
         <param name="password" value="<database password>"/>
         <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="journal_"/>
         </Journal>
         </Cluster>
       
           <!-- <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/> -->
      </Repository>
  5. Run the following commands to set up the secondary (High-availability) repository:
    • select * from journal_local_revisions where journal_id = '<unique cluster id for first repository>';
    • insert into journal_local_revisions (journal_id, revision_id) values ('<unique cluster id for second repository>', 1); //replace 1 with the output of select query
  6. Start the repository server.

    If you update any configuration values after the repository is started, update the repository.xml file located at the repoInstallationDirectory/repository/config directory. Also, update the workspace.xml file located at the repoInstallationDirectory/repository/workspaces/default and the repoInstallationDirectory/repository/workspaces/security directories, and then restart the repository server.

    If you want to point to a different database, you must delete the repository workspace (delete the repoInstallationDirectory/repository folder) and restart the repository. Cluster the external database to provide high-availability for the repository.

To configure the repository to use an Oracle database

  1. Create an external database:
    1. Set up the database user:
      • Create the user and user password.
      • Set up read and write permissions for the user. Permissions must include:
        • CREATE SESSION
        • CREATE TABLE
        • CREATE SEQUENCE
    2. In the external database, create a new database (for example, repository), using the credentials created in Step 1a.
  2. Extract the contents of the repository .war file into a new baorepo directory:
    1. Under the repoInstallationDirectory/tomcat/webapps/ directory, create the baorepo subdirectory.
    2. In the baorepo subdirectory, unzip the repoInstallationDirectory/tomcat/webapps/baorepo.war file.
  3. Place the database's connector/driver jar file in the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory.
    Example:
    You would place the ojdbc<compatibleVersion>.jar file in repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory.

    Note

    The connector/driver jar file required based on the database version is listed in the following table:

    Database version

    Required JAR

    Oracle 12c

    ojdbc6-11.2.0.2.0.jar

    Oracle 19c

    ojdbc8.jar

    The Oracle driver jar file is bundled with TrueSight Orchestration Platform and is available at the following location:

    (For the repository) AO_HOME/repo/lib/shared

    (For the CDP) AO_HOME/CDP/lib/shared

  4. Open the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/classes/META-INF/repository.xml file in a text editor and update it with the connection information for the external database.
    The Oracle database connection properties are as follows:

    Parameter

    Description

    class

    Abstract base class for the FileSystem, DataStore, PersistenceManager, and Cluster tags.

    driver

    The fully-qualified class name of the JDBC driver.

    oracle.jdbc.OracleDriver

    URL

    URL and port number for the external database.

    jdbc:oracle:thin:@<hostname>:<port number>/<service_name>

    You can omit the port number if you use the default port for the database.

    user

    Database user name that you created in step 1.

    password

    Password that you assigned to the database user.

    schema

    The string value that indicates the database type. Use the exact string value.

    This is not the name of the database schema.

    schemaObjectPrefix

    The string of characters at the beginning of the object name.

    externalBLOBs

    The external file system where the data is stored. This parameter is specific to the PersistenceManager tag located in the Workspace section in the file.

    1. Modify the FileSystem tag.

      File System for Oracle
      <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
      <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="fs_"/>
      </FileSystem>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the FileSystem class with "com.bmc.repository.server.security.BAOOracleFileSystem"
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    2. Add a new DataStore tag.

      Data Store for Oracle
      <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
      <param name="driver" value="oracle.jdbc.OracleDriver" />
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="databaseType" value="oracle" />
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="datastore_"/>
      </DataStore>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the DataStore class with "com.bmc.repository.server.security.BAODbDataStore"
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    3. Replace both the existing PersistenceManager tags located under the Workspace and Versioning sections.

      Persistence Manager for Oracle - Workspace schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
      <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
      <param name="driver" value="oracle.jdbc.OracleDriver"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="${wsp.name}"/>
      <param name="externalBLOBs" value="false"/>
      </PersistenceManager>
      Persistence Manager for Oracle - Versioning schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
      <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
      <param name="driver" value="oracle.jdbc.OracleDriver"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="version_"/>
      </PersistenceManager>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the PersistenceManager class with "com.bmc.repository.server.security.BAOOraclePersistenceManager".
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    4. Add a new Cluster tag.

      Cluster for Oracle
      <Cluster id="<unique cluster id>" syncDelay="2000">
      <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
      <param name="revision" value="${rep.home}/revision.log" />
      <param name="driver" value="oracle.jdbc.driver.OracleDriver" />
      <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="journal_"/>
      </Journal>
      </Cluster>

      Important

      • You must assign a unique cluster id to each new repository.
      • To use the encrypted database password in the repository.xml file
        1. Replace the Journal class with "com.bmc.repository.server.security.BAOOracleDatabaseJournal"
        2. Encrypt the password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
      Click here to view a sample repository.xml file
        <?xml version="1.0"?>
       <!--
           Licensed to the Apache Software Foundation (ASF) under one or more
           contributor license agreements.  See the NOTICE file distributed with
           this work for additional information regarding copyright ownership.
           The ASF licenses this file to You under the Apache License, Version 2.0
           (the "License"); you may not use this file except in compliance with
           the License.  You may obtain a copy of the License at
       
               http://www.apache.org/licenses/LICENSE-2.0
       
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        -->

       <!-- Example Repository Configuration File
             Used by
             - org.apache.jackrabbit.core.config.RepositoryConfigTest.java
             -
        -->

       <Repository>
           <!--
                virtual file system where the repository stores global state
                (e.g. registered namespaces, custom node types, etc.)
            -->

           <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
             <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="fs_"/>
           </FileSystem>
           
           <!-- data store configuration -->
           
           <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
            <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
             <param name="driver" value="oracle.jdbc.OracleDriver" />
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="databaseType" value="oracle" />
             <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="datastore_"/>
           </DataStore>
           
           <!--
                security configuration
            -->

           <Security appName="Jackrabbit">
               <!--
                    security manager:
                    class: FQN of class implementing the JackrabbitSecurityManager interface
                -->

               <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security">
                   <!--
                    workspace access:
                    class: FQN of class implementing the WorkspaceAccessManager interface
                    -->

                   <!-- <WorkspaceAccessManager class="..."/> -->
                   <!-- <param name="config" value="${rep.home}/security.xml"/> -->
               </SecurityManager>
       
               <!--
                    access manager:
                    class: FQN of class implementing the AccessManager interface
                -->

               <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
                   <!-- <param name="config" value="${rep.home}/access.xml"/> -->
               </AccessManager>
       
               <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
                  <!--
                      anonymous user name ('anonymous' is the default value)
                    -->

                  <param name="anonymousId" value="anonymous"/>
                  <!--
                      administrator user id (default value if param is missing is 'admin')
                    -->

                  <param name="adminId" value="admin"/>
               </LoginModule>
           </Security>
       
           <!--
                location of workspaces root directory and name of default workspace
            -->

           <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
           <!--
                workspace configuration template:
                used to create the initial workspace if there's no workspace yet
            -->

           <Workspace name="${wsp.name}">
               <!--
                    virtual file system of the workspace:
                    class: FQN of class implementing the FileSystem interface
                -->

               <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                   <param name="path" value="${wsp.home}"/>
               </FileSystem>
               <!--
                    persistence manager of the workspace:
                    class: FQN of class implementing the PersistenceManager interface
                -->

               <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
                 <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
                 <param name="driver" value="oracle.jdbc.OracleDriver"/>
                 <param name="user" value="<database username>"/>
                 <param name="password" value="<database password>"/>
                 <param name="schema" value="<schema name>"/>
                 <param name="schemaObjectPrefix" value="${wsp.name}"/>
                 <param name="externalBLOBs" value="false"/>
               </PersistenceManager>
               <!--
                    Search index and the file system it uses.
                    class: FQN of class implementing the QueryHandler interface
                -->

               <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
                   <param name="path" value="${wsp.home}/index"/>
                   <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
                   <param name="extractorPoolSize" value="2"/>
                   <param name="supportHighlighting" value="true"/>
               </SearchIndex>
           </Workspace>
       
           <!--
                Configures the versioning
            -->

           <Versioning rootPath="${rep.home}/version">
               <!--
                    Configures the filesystem to use for versioning for the respective
                    persistence manager
                -->

               <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                   <param name="path" value="${rep.home}/version" />
               </FileSystem>
       
               <!--
                    Configures the persistence manager to be used for persisting version state.
                    Please note that the current versioning implementation is based on
                    a 'normal' persistence manager, but this could change in future
                    implementations.
                -->

               <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
           <param name="driver" value="oracle.jdbc.OracleDriver"/>
           <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
           <param name="user" value="<database username>"/>
           <param name="password" value="<database password>"/>
           <param name="schema" value="<schema name>"/>
           <param name="schemaObjectPrefix" value="version_"/>
         </PersistenceManager>
           </Versioning>
       
           <!--
                Search index for content that is shared repository wide
                (/jcr:system tree, contains mainly versions)
            -->

         <!--  <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
                
      <param name="path" value="${rep.home}/repository/index"/>
                
      <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
                
      <param name="extractorPoolSize" value="2"/>
                
      <param name="supportHighlighting" value="true"/>
            </SearchIndex>
            -->

           
           <Cluster id="<unique cluster id>" syncDelay="2000">
         <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
         <param name="revision" value="${rep.home}/revision.log" />
         <param name="driver" value="oracle.jdbc.driver.OracleDriver" />
         <param name="url" value="jdbc:oracle:thin:@<hostname>:<port number>/<service_name>"/>
         <param name="user" value="<database username>"/>
         <param name="password" value="<database password>"/>
         <param name="schema" value="<schema name>"/>
         <param name="schemaObjectPrefix" value="journal_"/>
         </Journal>
         </Cluster>
       
           <!-- <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/> -->
       </Repository>
  5. Run the following commands to set up the secondary (High-availability) repository:
    --> select * from journal_local_revisions where journal_id = '<unique cluster id for first repository>';
    --> insert into journal_local_revisions (journal_id, revision_id) values ('<unique cluster id for second repository>', 1); //replace 1 with the output of select query
    commit;
  6. Start the repository server.

    If you want to update any configuration values after the repository server is started, you must update the repository.xml file located at the repoInstallationDirectory/repository/config directory. Also, you must update the workspace.xml file located at the repoInstallationDirectory/repository/workspaces/default and the repoInstallationDirectory/repository/workspaces/security directories, and then restart the repository server.

    If you want to point to a different database, you must delete the repository's workspace (delete the repoInstallationDirectory/repository folder) and restart the repository. Cluster the external database to provide high-availability for the repository.

To configure the repository to use a Microsoft SQL Server 2016 and SQL Server 2019 database

  1. Create an external database:
    1. Set up the database user:
      • Create the user and user password.
      • Set up read and write permissions for the user. Permissions must include:
        • CREATE SESSION
        • CREATE TABLE
        • CREATE SEQUENCE
    2. In the external database, create a new database (for example, repository), using the credentials created in Step 1a.
  2. Extract the contents of the repository .war file into a new baorepo directory:
    1. Under the repoInstallationDirectory/tomcat/webapps/ directory, create the baorepo subdirectory.
    2. In the baorepo subdirectory, unzip the repoInstallationDirectory/tomcat/webapps/baorepo.war file.
  3. Place the database's connector/driver jar file in the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/lib directory.

    The compatible connector/driver jar file required based on the database version is listed in the following table:

    Database version

    Required jar file

    SQL Server 2016

    mssql-jdbc-6.4.0.jre8

    SQL Server 2019

    mssql-jdbc-9.2.1.jre8

  4. Open the repoInstallationDirectory/tomcat/webapps/baorepo/WEB-INF/classes/META-INF/repository.xml file in a text editor and update it with the connection information for the external database.
    The Microsoft SQL Server 2016 and SQL Server 2019 database connection properties are as follows:

    Parameter

    Description

    class

    Abstract base class for the FileSystem, DataStore, PersistenceManager, and Cluster tags.

    driver

    The fully-qualified class name of the JDBC driver.

    com.microsoft.sqlserver.jdbc.SQLServerDriver

    URL

    URL and port number for the external database.

    jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>

    You can omit the port number if you use the default port for the database.

    user

    Database user name that you created in step 1.

    password

    Password that you assigned to the database user.

    schema

    The string value that indicates the database type. Use the exact string value.

    This is not the name of the database schema.

    schemaObjectPrefix

    The string of characters at the beginning of the object name.

    externalBLOBs

    The external file system where the data is stored. This parameter is specific to the PersistenceManager tag located in the Workspace section in the file.

    1. Modify the FileSystem tag.

      File System for Microsoft SQL Server 2016 and SQL Server 2019
      <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="fs_"/>
      </FileSystem>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the FileSystem class with "com.bmc.repository.server.security.BAOMSSqlFileSystem"
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    2. Add a new DataStore tag.

      Data Store for Microsoft SQL Server 2016 and SQL Server 2019
      <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="user" value="<database user>"/>
      <param name="password" value="<database password>"/>
      <param name="databaseType" value="mssql" />
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="datastore_"/>
      </DataStore>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the DataStore class with "com.bmc.repository.server.security.BAODbDataStore"
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    3. Replace both the existing PersistenceManager tags located under the Workspace and Versioning sections.

      Persistence Manager for Microsoft SQL Server 2016 and SQL Server 2019 - Workspace schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="${wsp.name}"/>
      </PersistenceManager>
      Persistence Manager for Microsoft SQL Server 2016 and SQL Server 2019 - Versioning schema
      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="version_"/>
      </PersistenceManager>

      Important

      To use the encrypted database password in the repository.xml file 

      1. Replace the PersistenceManager class with "com.bmc.repository.server.security.BAOMSSqlPersistenceManager".
      2. Enter the encrypted password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
    4. Add a new Cluster tag.

      Cluster for Microsoft SQL Server 2016 and SQL Server 2019
      <Cluster id="<unique cluster id>" syncDelay="2000">
      <Journal class="org.apache.jackrabbit.core.journal.MSSqlDatabaseJournal">
      <param name="revision" value="${rep.home}/revision.log" />
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="journal_"/>
      </Journal>
      </Cluster>

      Important

      • You must assign a unique cluster id to each new repository.
      • To use the encrypted database password in the repository.xml file
        1. Replace the Journal class with "com.bmc.repository.server.security.BAOMSSqlDatabaseJournal"
        2. Encrypt the password that you assigned to the database user. For details, see Using-the-Maintenance-Tool-to-encrypt-a-password.
      Click here to view a sample repository.xml file
      <?xml version="1.0"?>
      <!--
         Licensed to the Apache Software Foundation (ASF) under one or more
         contributor license agreements.  See the NOTICE file distributed with
         this work for additional information regarding copyright ownership.
         The ASF licenses this file to You under the Apache License, Version 2.0
         (the "License"); you may not use this file except in compliance with
         the License.  You may obtain a copy of the License at

             http://www.apache.org/licenses/LICENSE-2.0

         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
      -->

      <!-- Example Repository Configuration File
           Used by
           - org.apache.jackrabbit.core.config.RepositoryConfigTest.java
           -
      -->

      <Repository>
         <!--
              virtual file system where the repository stores global state
              (e.g. registered namespaces, custom node types, etc.)
          -->

      <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
             <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="fs_"/>
         </FileSystem>

      <!-- data store configuration -->
         <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
            <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
             <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
             <param name="user" value="<database user>"/>
             <param name="password" value="<database password>"/>
             <param name="databaseType" value="mssql" />
             <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="datastore_"/>
         </DataStore>

         <!--
              security configuration
          -->

         <Security appName="Jackrabbit">
             <!--
                  security manager:
                  class: FQN of class implementing the JackrabbitSecurityManager interface
              -->

             <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security">
                 <!--
                  workspace access:
                  class: FQN of class implementing the WorkspaceAccessManager interface
                  -->

                 <!-- <WorkspaceAccessManager class="..."/> -->
                 <!-- <param name="config" value="${rep.home}/security.xml"/> -->
             </SecurityManager>

             <!--
                  access manager:
                  class: FQN of class implementing the AccessManager interface
              -->

             <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
                 <!-- <param name="config" value="${rep.home}/access.xml"/> -->
             </AccessManager>

             <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
                <!--
                    anonymous user name ('anonymous' is the default value)
                  -->

                <param name="anonymousId" value="anonymous"/>
                <!--
                    administrator user id (default value if param is missing is 'admin')
                  -->

                <param name="adminId" value="admin"/>
             </LoginModule>
         </Security>

         <!--
              location of workspaces root directory and name of default workspace
          -->

         <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
         <!--
              workspace configuration template:
              used to create the initial workspace if there's no workspace yet
          -->

         <Workspace name="${wsp.name}">
             <!--
                  virtual file system of the workspace:
                  class: FQN of class implementing the FileSystem interface
              -->

             <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                 <param name="path" value="${wsp.home}"/>
             </FileSystem>
             <!--
                  persistence manager of the workspace:
                  class: FQN of class implementing the PersistenceManager interface
              -->

             <!--<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
                
      <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
                
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
              </PersistenceManager>-->

      <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
      </PersistenceManager>
             <!--
                  Search index and the file system it uses.
                  class: FQN of class implementing the QueryHandler interface
              -->

             <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
                 <param name="path" value="${wsp.home}/index"/>
                 <param name="supportHighlighting" value="true"/>
             </SearchIndex>
         </Workspace>

         <!--
              Configures the versioning
          -->

         <Versioning rootPath="${rep.home}/version">
             <!--
                  Configures the filesystem to use for versioning for the respective
                  persistence manager
              -->

             <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
                 <param name="path" value="${rep.home}/version" />
             </FileSystem>

             <!--
                  Configures the persistence manager to be used for persisting version state.
                  Please note that the current versioning implementation is based on
                  a 'normal' persistence manager, but this could change in future
                  implementations.
              -->

             <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager">
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="version_"/>
      </PersistenceManager>
         </Versioning>

         <!--
              Search index for content that is shared repository wide
              (/jcr:system tree, contains mainly versions)
          -->

         <!--<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
              
      <param name="path" value="${rep.home}/repository/index"/>
              
      <param name="supportHighlighting" value="true"/>
          </SearchIndex>-->


         <Cluster id="<unique cluster id>" syncDelay="2000">
      <Journal class="org.apache.jackrabbit.core.journal.MSSqlDatabaseJournal">
      <param name="revision" value="${rep.home}/revision.log" />
      <param name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
      <param name="url" value="jdbc:sqlserver://<database hostname>:<port>;databaseName=<database name>"/>
      <param name="user" value="<database username>"/>
      <param name="password" value="<database password>"/>
      <param name="schema" value="<schema name>"/>
      <param name="schemaObjectPrefix" value="journal_"/>
      </Journal>
      </Cluster>
      </Repository>
  5. Run the following commands to set up the secondary (High-availability) repository:
  6. --> select * from journal_local_revisions where journal_id = '<unique cluster id for first repository>';
    --> insert into journal_local_revisions (journal_id, revision_id) values ('<unique cluster id for second repository>', 1); //replace 1 with the output of select query
  7. Start the repository server.

    If you want to update any configuration values after the repository server is started, you must update the repository.xml file located at the repoInstallationDirectory/repository/config directory. Also, you must update the workspace.xml file located at the repoInstallationDirectory/repository/workspaces/default and the repoInstallationDirectory/workspaces/security directories, and then restart the repository server.

    If you want to point to a different database, you must delete the repository's workspace (delete the repoInstallationDirectory/repository folder) and restart the repository. Cluster the external database to provide high-availability for the repository.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*