2.1.3.1. Isolated-database configuration

Isolated-database configuration allows configuring single database for repository but separate database tables for each workspace.

  1. Configure the data container in the org.exoplatform.services.naming.InitialContextInitializer service. It is the JNDI context initializer, which registers (binds) naming resources (DataSources) for data containers.

    For example:

    
       <external-component-plugins>
        <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
        <component-plugin>
          <name>bind.datasource</name>
          <set-method>addPlugin</set-method>
          <type>org.exoplatform.services.naming.BindReferencePlugin</type>
          <init-params>
            <value-param>
              <name>bind-name</name>
              <value>jdbcjcr</value>
            </value-param>
            <value-param>
              <name>class-name</name>
              <value>javax.sql.DataSource</value>
            </value-param>
            <value-param>
              <name>factory</name>
              <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </value-param>
              <properties-param>
                <name>ref-addresses</name>
                <description>ref-addresses</description>
                <property name="driverClassName" value="org.postgresql.Driver"/>
                <property name="url" value="jdbc:postgresql://exoua.dnsalias.net/portal"/>
                <property name="username" value="exoadmin"/>
                <property name="password" value="exo12321"/>
              </properties-param>
          </init-params>
        </component-plugin>
      </external-component-plugins>

    The database connection parameters are configured:

    • driverClassName. For example: "org.hsqldb.jdbcDriver", "com.mysql.jdbc.Driver", "org.postgresql.Driver"

    • url. For example: "jdbc:hsqldb:file:target/temp/data/portal", "jdbc:mysql://exoua.dnsalias.net/jcr"

    • username. For example: "sa", "exoadmin"

    • password. For example: "exo12321"

  2. Configure the repository service. Each workspace will be configured for the same data container.

    For example:

    
    <workspaces>
       <workspace name="ws">
          <!-- for system storage -->
          <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
             <properties>
                <property name="source-name" value="jdbcjcr" />
                <property name="db-structure-type" value="isolated" />
                ...
             </properties>
             ...
          </container>
          ...
       </workspace>

       <workspace name="ws1">
          <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
             <properties>
                <property name="source-name" value="jdbcjcr" />
                <property name="db-structure-type" value="isolated" />
                ...
             </properties>
             ...
          </container>
          ...
       </workspace>
    </workspaces>

    In this step, you have configured two workspaces which will be persisted in different database tables.

Note

The repository configuration parameters support human-readable formats of values. For example: 200K - 200 Kbytes, 30m - 30 minutes, and more.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus