In a standard WSO2 Open Banking 1.4.0 deployment, users can skip the steps mentioned below.
Configuring the user store
Configuring the datasources
Mounting the registry
Expand
title
Click here to find more information on the steps...
Configuring the user store
WSO2 products allow you to configure multiple user stores to store your users and their roles. Your user store can be one of the following:
A Directory Service that can communicate over LDAP protocol like OpenLDAP
Active Directory
A database that can communicate over JDBC
Tip
Note: The instructions in this page demonstrate configuring a JDBC user store. The user store configurations are available in the <WSO2_OB_KM_HOME>/repository/conf/user-mgt.xml file. Point all the cluster nodes to the same user store.
For more information on how to set up other types of user stores, see Configuring User Stores.
Configuring the datasources
Create databases. See Setting up the Physical Database in the WSO2 Administration Guide for database scripts and more information. This documentation demonstrates deployment with user management database (WSO2UM_DB) and an identity database (WSO2AM_DB).
Tip
Alternatively, you can create more databases for each type of data to separate the data logically. Note that this will NOT make a difference in performance and is not actually necessary.
Configure the datasource for the databases in both nodes of your cluster in the <WSO2_OB_KM_HOME>/repository/conf/datasources/master-datasources.xml file that contains database related configurations. For instructions on how to configure the datasource depending on the type of database you created, see Changing the Carbon Database in the WSO2 Product Administration Guide. Following is a sample configuration of the user management, identity, and registry databases for a MySQL database. Make sure your datasource configurations are as follows:
Code Block
language
xml
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2AM_DB</name>
<description>The datasource used for API Manager database</description>
<jndiConfig>
<name>jdbc/WSO2AM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/openbank_apimgtdb?autoReconnect=true&useSSL=false</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>150</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2UM_DB</name>
<description>The datasource used by user manager</description>
<jndiConfig>
<name>jdbc/WSO2UM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/openbank_userdb?autoReconnect=true&useSSL=false</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>150</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2CONFIG_DB</name>
<description>The datasource used by the registry</description>
<jndiConfig>
<name>jdbc/WSO2Config_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/openbank_iskm_configdb?autoReconnect=true&useSSL=false</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>150</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2REG_DB</name>
<description>The datasource used by the registry</description>
<jndiConfig>
<name>jdbc/WSO2REG_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/openbank_govdb?autoReconnect=true&useSSL=false</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>150</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
Open the <WSO2_OB_KM_HOME>/repository/conf/finance/open-banking.xml file and configure the WSO2OpenBankingDB datasource in both nodes of your cluster.
Code Block
language
xml
<DataSource>
<!-- Include a data source name (jndiConfigName) from the set of data sources defined in master-datasources.xml
-->
<Name>jdbc/WSO2OpenBankingDB</Name>
</DataSource>
Mounting the registry
Mount the governance and configuration registry in the <WSO2_OB_KM_HOME>/repository/conf/registry.xml file to share the registry across all nodes in the cluster. For more information on mounting the registry, see Sharing Databases in a Cluster.
Make sure the WSO2Config_DB and WSO2REG_DB configurations are updated in both nodes as follows:
Note: The production recommendation is to set the <versionResourcesOnChange> property in the <WSO2_OB_KM_HOME>/repository/conf/registry.xml file to false. This is because the automatic versioning of resources can be an extremely expensive operation.
Navigate to Home > Registry > Browse. Image RemovedImage Added
Multiexcerpt
MultiExcerptName
DeploymentSteps
Clustering Key Manager for high availability
Follow the instructions below to cluster WSO2 Open Banking Key Manager.
Install WSO2 OB KM on each node.
Do the following changes to the <WSO2_OB_KM_HOME>/repository/conf/axis2/axis2.xml file for both nodes.
Enable clustering on node 1 and node 2 by setting the clustering element to true:
xml
Specify the name of the cluster that the WSO2 OB KM node will join.
Use the Well Known Address (WKA) based clustering method. In WKA-based clustering, we need to have a subset of cluster members configured in all the members of the cluster. At least one well known member has to be operational at all times.
WSO2 supports the following membership schemes as well.
Configure the localMemberHost and localMemberPort entries. These must be different port values for the two nodes if they are on the same server to prevent any conflicts.
Under the members section, add the hostName and port for each WKA member. As we have only two nodes in our sample cluster configuration, we will configure both nodes as WKA nodes.
xml
Note: You can also use IP address ranges for the hostName. For example, 192.168.1.2-10. This should ensure that the cluster eventually recovers after failures. One shortcoming of doing this is that you can define a range only for the last portion of the IP address. You should also keep in mind that the smaller the range, the faster the time it takes to discover members since each node has to scan a lesser number of potential members.
Configure caching.
It is not recommended to use distributed caching due to many practical issues that are related to configuring and running this properly. WSO2 Open Banking Key Manager employs Hazelcast as the primary method of implementing cluster messages while using distributed caching in a simple setup.
For information on clustering, see .
About Caching
Why caching
Caching is an additional layer on top of databases. It enables to keep the recently used data that are fetched from the database in local memory, so that for subsequent data requests instead of fetching from the database the data can be served from the local memory. Caching has certain advantages and disadvantages that you need to evaluate when deciding on your caching strategy.
Advantages
The load on the underlying database or LDAP is reduced as data is served from already fetched data in memory.
Improved performance due to the reduced number of database calls for repetitive data fetching.
Disadvantages
Coherency problems may occur when the data change is not immediately reflected on cached data if one node or an external system updates the database.
Data in memory can become stale yet be served. For example, serving data from memory while its corresponding record in the database is deleted.
Historically, WSO2 Open Banking Key Manager used distributed caching to utilize the above-mentioned advantages as well as to minimize the coherence problem. However, in newer deployment patterns where the network is not tightly controlled, distributed caching fails in unexpected ways. Hence, we no longer recommend using distributed caching. Instead, it is recommended to have local caches (if required) and cache invalidation messages (if required) by considering the information given below.
The ForceLocalCache property
When Hazelcast clustering is enabled, certain caches act as distributed caches. The ForceLocalCache property within the <cache> section in the <WSO2_OB_KM_HOME>/repository/conf/carbon.xml file marks that all the caches should act like local caches even in a clustered setup.
Cache invalidation uses Hazelcast messaging to distribute the invalidation message over the cluster and invalidate the caches properly. This is used to minimize the coherence problem in a multi-node setup.
Typical clustered deployment cache scenarios
Scenario
Local Caching
Distributed Caching
Hazelcast Clustering
Distributed Invalidation
Description
1. All caches are local with distributed cache invalidation
Enabled
Not Applicable
Enabled
Enabled
This is the recommended approach.
Hazelcast messaging invalidates the caches.
2. All caches are local without distributed cache invalidation
Enabled
Not Applicable
Disabled
Disabled
Invalidation clears only the caches in specific nodes. Other caches are cleared at cache expiration.
Hazelcast communication is not used.
As the decisions take time to propagate over nodes (default cache timeout is 15 minutes), there is a security risk in this method. To reduce the risk, reduce the default cache timeout period. To learn how to reduce the default cache timeout period, see Configuring Cache Layers - timeout.
3. No caching
Disabled
Disabled
Disabled
Disabled
The data are directly acquired from the database.
Eliminates the security risks caused due to not having cache invalidation.
This method will create a performance degradation due to the lack of caching.
4. Certain caches are disabled while the remaining are local
Enabled for the available local caches
Not Applicable
Enabled
Enabled
To reduce the security risk created in the second scenario and to improve performance in comparison with the third scenario, disable the security-related caches and sustain the performance-related caches as local caches.
This requires identification of these caches depending on the use case.
5. Distributed caching enabled
Disabled—the ForceLocalCache property is set to false.
Enabled
Enabled
Not Applicable
This scenario is only recommended if the network has tight tolerance where the network infrastructure is capable of handling high bandwidth with very low latency.
Typically this applies only when you deploy all the nodes in a single server rack having fiber-optic cables. In any other environments, this implementation will cause cache losses. Thus, this implementation is not recommended for general use.
Configure the following:
Make sure the jdbc/WSO2UM_DB datasource is configured in the <WSO2_OB_KM_HOME>/repository/conf/user-mgt.xml file. This refers to the user store you configured in the section above.
xml
Make sure the <WSO2_OB_KM_HOME>/repository/conf/identity/identity.xml file of both node1 and node2 is configured to use jdbc/WSO2AM_DB datasource. This refers to the datasource you configured in the section above.
xml
Configure the <WSO2_OB_KM_HOME>/repository/conf/identity/identity.xml file in both node1 and node2, so that they are pointed to the load balancer.
xml
Add the following authentication endpoint configurations to the <WSO2_OB_KM_HOME>/repository/conf/identity/application-authentication.xml> file in both node1 and node 2.
Configuring Open Banking API Manager
Make sure to do the following changes in your Open Banking API Manager server:
By default, the in-sequences files for the APIs in the <WSO2_OB_APIM_HOME>/repository/resources/finance/apis directory are pointed to Open Banking Key Manager. In order to use the load balancer, update the in-sequence files by pointing them to the load balancer, instead of Open Banking Key Manager where applicable.
To point the Open Banking API Manager to the Key Manager cluster, open the <WSO2_OB_APIM_HOME>/repository/conf/api-manager.xml and configure the following:
xmlxmlxmlxml
Changing hostnames and ports
Configure the Key Manager node1 using the following steps.
Go to the <WSO2_OB_KM_HOME>/repository/conf/tomcat/catalina-server.xml file and configure the proxy ports as follows:
xmlxml
Tip: If you are using an Openshift Docker container for the deployment, do the following.
Add the following TomcatRemoteIPValve to the <WSO2_OB_KM_HOME>/repository/conf/tomcat/catalina-server.xml file.
xml
In the <WSO2_OB_KM_HOME>/repository/conf/carbon.xml file, define the hostname for your server.
xml
This hostname is used by the OB Key Manager cluster. It must be specified in the /etc/hosts file as:
127.0.0.1 wso2.obkm.com
Follow all the configuration steps that were done in node1 for node2 as well.
Enabling artifact synchronization
To enable synchronization for runtime artifacts, you must have a shared file system. You can use one of the following depending on your environment.
Network File System (NFS): This is one of the most commonly known shared file systems and can be used in a Linux environment.
Server Message Block (SMB) file system: This can be used in a Windows environment.
Amazon EFS: This can be used in an AWS environment.
Once you choose a file system, mount it in the nodes that participate in the cluster.
Create two directories called Deployment and Tenants in the shared file system.
Create a symlink from the <WSO2_OB_KM_HOME>/repository/deployment path to the Deployment directory of the shared file system that you created in step 2 of this section.
Create a symlink from the <WSO2_OB_KM_HOME>/repository/tenants path to the Tenants directory of the shared file system that you created in step 2 of this section.
Instead of mounting the file system directly to the <WSO2_OB_KM_HOME>/repository/deployment and <WSO2_OB_KM_HOME>/repository/tenants paths, a symlink is created to avoid issues that may occur if you delete the product to redeploy it; in which case the file system would get mounted to a non-existing path.
Fronting with a load balancer
In this section, an Nginx server is used as an example. If you need to set up the WSO2 Open Banking Key Manager cluster with Nginx, you can follow the instructions given below (you must do this after setting up the cluster following the above instructions). When clustering WSO2 Open Banking Key Manager with a load balancer, make sure to enable sticky sessions. This is required for the management console and the dashboard to work and if we disable temporary session data persistence in the <WSO2_OB_KM_HOME>/repository/conf/identity/identity.xml file.
Sticky sessions for SSO
Sticky sessions are required to ensure a flawless Single Sign On (SSO) workflow when temporary session data persistence is disabled. It is recommended to use sticky sessions for SSO in order to have a higher throughput.
For more information on sticky sessions, see . The following is the deployment diagram with the load balancer.
Configuring Nginx
Click here to see how it is done
Use the following steps to configure NGINX Plus version 1.7.11 or nginx community version 1.9.2 as the load balancer for WSO2 products. (In these steps, we refer to both versions collectively as "Nginx".)
Install Nginx (NGINX Plus or nginx community) in a server configured in your cluster.
Configure Nginx to direct the HTTP requests to the two worker nodes via the HTTP 80 port using http://obkm.wso2.com/<service>. .
To do this, create a VHost file (obkm.http.conf) in the /etc/nginx/conf.d directory and add the following configurations into it.
Note: Shown below is a general Nginx configuration. Click this link for more specific configuration with exposing various endpoints:
Nginx configuration with exposing /oauth2, /commonauth, and other endpoints
Nginx configuration with exposing /oauth2, /commonauth, and other endpoints
HTTP configurations
Now that you've configured HTTP requests, you must also configure HTTPS requests. Configure Nginx to direct the HTTPS requests to the two worker nodes via the HTTPS 443 port using https://obkm.wso2.com/<service>. To do this, create a VHost file (obkm.https.conf) in the /etc/nginx/conf.d directory and add the following configurations into it.
Note: The configurations for nginx community version and NGINX Plus are different here since the community version does not support the sticky directive.
truenginx Community VersionNGINX Plus
Configure Nginx to access the Management Console as Console as https://mgt.obkm.wso2.com/carbon via HTTPS 443 port. This is to direct requests to the manager node. To do this, create a VHost file (mgt.obkm.https.conf) in the /etc/nginx/conf.d directory and add the following configurations into it.
Management Console configurations
Reload the Nginx server. $sudo service nginx reload
If you have made modifications to anything other than the VHost files, you may need to restart the Nginx server instead of reloading:
$sudo service nginx restart
Create SSL certificates
Click here to see how it is done
Create SSL certificates for both the manager and worker nodes using the instructions that follow:
Create the server key.
bash
Create the certificate signing request.
bash
Remove the password.
bash
Sign your SSL certificate.
bash
Execute the following command to import the created certificate file to the client truststore:
bash
While creating keys, enter the hostname ( obkm.wso2.com or mgt.obkm.wso2.com ) as the common name.
Configure the Proxy Port in Open Banking Key Manager Nodes
Click here to see how it is done
By default, WSO2 Open Banking Key Manager runs on 9446 port. The following steps describe how you can configure a proxy port of 443.
Open <WSO2_OB_KM_HOME>/repository/conf/tomcat/catalina-server.xml file and add the proxy port 443 in https connector as follows.
xml
It is not possible to configure proxy port from load balancer itself since there is a post request while authenticating to IS Dashboard. So, If you are planning to use Identity server Dashboard, you must do this configuration. Below configurations are also needed if you are using the dashboard.
Configure proxy port and host in <WSO2_OB_KM_HOME>/repository/deployment/server/jaggeryapps/dashboard/conf/site.json file as follows:
xml
Configure proxy port and host in <WSO2_OB_KM_HOME>/repository/deployment/server/jaggeryapps/portal/conf/site.json file as follows:
xml
Configure proxy port and host in <WSO2_OB_KM_HOME>/repository/deployment/server/webapps/shindig/WEB-INF/web.xml
xml
Starting up and verifying product nodes
If both nodes are running on the same server, set the port offset to avoid port conflicts.
Click here to see how it is done
By default, the Open Banking Key Manager server port offset is 3. So if you're running both Key Manager nodes in the same server the port offset can be as follows:
OB_KM_NODE1: offset 3
OB_KM_NODE2: offset 4
Changing the offset for default ports
When you run multiple WSO2 products, multiple instances of the same product, or multiple WSO2 product clusters on the same server or virtual machines (VMs), you must change their default ports with an offset value to avoid port conflicts. The default HTTP and HTTPS ports (without offset) of a WSO2 product are 9763 and 9443 respectively. Port offset defines the number by which all ports defined in the runtime such as the HTTP/S ports will be changed. For example, if the default HTTP port is 9763 and the port offset is 1, the effective HTTP port will change to 9764. For each additional WSO2 product instance, you set the port offset to a unique value. The default port offset is 0.
There are two ways to set an offset to a port:
Pass the port offset to the server during startup. The following command starts the server with the default port incremented by 3:
Set the Ports configuration in <WSO2_OB_KM_HOME>/repository/conf/carbon.xml with the desired value as follows:
xml
Usually, when you offset the port of the server, all ports it uses are changed automatically. However, there are few exceptions as follows in which you have to change the ports manually according to the offset. The following table indicates the changes that occur when the offset value is modified.
WSO2 Server instance
PortOffset
Sample Default Port Value
WSO2 Product 1
0
9443
WSO2 Product 2
1
9444
WSO2 Product 3
2
9445
WSO2 Product 4
3
9446
WSO2 Product 5
4
9447
Start Nginx.
Go to <WSO2_OB_KM_HOME>/bin and start the nodes using the following command on both nodes: