Documentation

Database Configuration for Cluster Nodes

At minimum, nodes in a DXP cluster must be configured to share the same database (or database cluster) in order to function. Optimizations discussed here can further improve database performance for a DXP cluster and should be considered with consideration for your usage of DXP and expected transaction volume.

Warning

Clustering will not work with the embedded HSQL database.

Read-Writer Database Configuration

To improve database performance, you can use a read-writer database configuration. Instead of using the same data source for read and read-write operations, this strategy uses a separate data source for each operation type. DXP’s Aspect Oriented Programming (AOP) transaction infrastructure directs read transactions to the read data source and read-write transactions to the write data source.

Read-Writer Database Interaction

Connections to separate read and read-write data sources are configured using JDBC or JNDI Portal Properties (e.g., in a portal-ext.properties file), as explained in the following sections. The data sources should use separate instances of the DXP database, where the read-write database instance is replicated to the read database instance.

JDBC

Edit your portal-ext.properties file following these steps to connect directly to your separate read and write data sources using JDBC:

  1. Set the default connection pool provider. For provider information, see the JDBC properties reference. The default setting specifies HikariCP as the pool provider:

    jdbc.default.liferay.pool.provider=hikaricp
    
  2. Configure JDBC connections to your separate read and write data sources. Here’s an example:

    jdbc.read.driverClassName=[place your driver name here]
    jdbc.read.url=[place the URL to your "read" database here]
    jdbc.read.username=[place your user name here]
    jdbc.read.password=[place your password here]
    
    jdbc.write.driverClassName=[place your driver name here]
    jdbc.write.url=[place the URL to your "read-write" database here]
    jdbc.write.username=[place your user name here]
    jdbc.write.password=[place your password here]
    

    For example JDBC connection values, please see Database Templates.

  3. Configure DXP to use the write data source (the data source whose prefix is jdbc.write.) to create the Counter data source. A separate data source is always dedicated to the counter.

    counter.jdbc.prefix=jdbc.write.
    
  4. Optionally validate the data connections to make sure bad connections are handled gracefully.

    Some connection pools used with JDBC4 (check your driver’s JDBC version) validate connections automatically. Other connection pools may require additional, vendor-specific connection validation properties—specify them in a Portal Properties file. Refer to your connection pool provider documentation for connection validation details.

  5. Enable the read-writer database configuration by copying the default spring.configs and spring.infrastructure.configs Portal Properties to your portal-ext.properties file and adding the following Spring configuration file paths to them.

    Add to spring.configs:

    META-INF/dynamic-data-source-spring.xml
    

    Add to spring.infrastructure.configs:

    META-INF/dynamic-data-source-infrastructure-spring.xml
    

    For more information, see the Spring configuration Portal Properties.

JNDI

Edit your portal-ext.properties file following these steps to connect to your read and write data sources on your app server using JNDI:

  1. Set your read and write JNDI data source user names and passwords.

    jdbc.read.jndi.name=[place your "read" data source JNDI name here]
    
    jdbc.read.username=*[place your user name here]
    jdbc.read.password=[place your password here]
    
    jdbc.write.jndi.name=[place your "read-write" data source JNDI name here]
    
    jdbc.write.username=[place your user name here]
    jdbc.write.password=[place your password here]
    
  2. Configure DXP to use the write data source (the data source whose prefix is jdbc.write.) to create the Counter data source. A separate data source is always dedicated to the counter.

    counter.jdbc.prefix=jdbc.write.
    
  3. Optionally validate the data connections to make sure bad connections are handled gracefully.

    Some connection pools used with JDBC4 (check your driver’s JDBC version) validate connections automatically. Other connection pools may require additional, vendor-specific connection validation properties—specify them in a Portal Properties file. Refer to your connection pool provider documentation for connection validation details.

  4. Enable the read-writer database configuration by copying the default spring.configs and spring.infrastructure.configs Portal Properties to your portal-ext.properties file and add the following Spring configuration file paths to them.

    Add to spring.configs:

        META-INF/dynamic-data-source-spring.xml
    

    Add to spring.infrastructure.configs:

    META-INF/dynamic-data-source-infrastructure-spring.xml
    

    For more information, see the Spring configuration Portal Properties.

DXP uses a read data source, a write data source, and a counter data source the next time it starts.

Database Replication

Using a database cluster improves fault tolerance and DXP performance. Database cluster instances must be stay in sync. Replication is the process of copying changed data and changed schema from one database instance to another. All supported databases support replication. If you’re using a database cluster, set up the databases for replication by following the database vendor’s instructions.

What’s Next

Now that you’ve configured the database for your cluster, you can continue addressing the DXP clustering requirements. The next requirement is to make your File Store accessible to all nodes and configure each node with that File Store.