The following sections give you information and instructions on how to cluster the business process profile of WSO2 EI with a third-party load balancer.
...
Install NGINX Plus or Nginx community version configured in a server within your cluster network.
Create a VHost file (ei
.http.conf
) in the/etc/
nginx/
conf.d directory and add the following configurations into it.This configures NGINX Plus to direct the HTTP requests to the two WSO2 EI nodes (xxx.xxx.xxx.xx1 and xxx.xxx.xxx.xx2) via the HTTP 80 port using thehttp://ei.wso2.com/
URL.Code Block title Nginx Community Version and NGINX Plus upstream wso2.ei.com { server xxx.xxx.xxx.xx1:82809765; server xxx.xxx.xxx.xx2:82809765; } server { listen 80; server_name ei.wso2.com; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_read_timeout 5m; proxy_send_timeout 5m; proxy_pass http://wso2.ei.com; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Create a VHost file (ei.https.conf) in the /etc/nginx/conf.d directory and add the following configurations into it. This configures NGINX Plus to direct the HTTPS requests to the two WSO2 EI nodes (xxx.xxx.xxx.xx1 and xxx.xxx.xxx.xx2) via the HTTPS 443 port using the
https://ei.wso2.com/
URL.Localtabgroup Localtab active true title Nginx Community Version Code Block upstream ssl.wso2.ei.com { server xxx.xxx.xxx.xx1:82439445; server xxx.xxx.xxx.xx2:82439445; ip_hash; } server { listen 443; server_name ei.wso2.com; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_read_timeout 5m; proxy_send_timeout 5m; proxy_pass https://ssl.wso2.ei.com; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Localtab title NGINX Plus Code Block upstream ssl.wso2.ei.com { server xxx.xxx.xxx.xx1:8243; server xxx.xxx.xxx.xx2:8243; sticky learn create=$upstream_cookie_jsessionid lookup=$cookie_jsessionid zone=client_sessions:1m; } server { listen 443; server_name ei.wso2.com; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_read_timeout 5m; proxy_send_timeout 5m; proxy_pass https://ssl.wso2.ei.com; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Configure Nginx to access the Management Console as https://mgtui.asei.wso2.com/carbon via HTTPS 443 port. To do this, create a VHost file (ui.asei.https.conf) in the
/etc/nginx/conf.d/
directory and add the following configurations into it.Code Block title Nginx Community Version and NGINX Plus server { listen 443; server_name ui.ei.wso2.com; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_read_timeout 5m; proxy_send_timeout 5m; proxy_pass https://xxx.xxx.xxx.xx1:9443/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } error_log /var/log/nginx/ui-error.log ; access_log /var/log/nginx/ui-access.log; }
Follow the instructions below to create SSL certificates for both WSO2 EI nodes.
Tip Enter the host name (ei
.wso2.com
) as the common name when creating keys.- Execute the following command to create the Server Key: $sudo
opensslgenrsa -des3 -out server.key 1024
- Execute the following command to request to sign the certificate:
$sudo
openssl-new -key server.key -out server.csr
- Execute the following commands to remove the passwords:
$sudo cp server.key server.key.org
$sudo
openssl-in server.key.org -out server.key
Execute the following commands to sign your SSL Certificate:
$sudo
opensslx509 -
req-days 365 -in server.
csr-signkey server.key -out server.crt
Execute the following command to add the certificate to the
<EI_HOME>/repository/resources/security/client-
truststore.
jks file: keytool-import -
trustcacerts-alias server -file server.
crt-
keystoreclient-
truststore.jks
- Execute the following command to create the Server Key: $sudo
Execute the following command to restart the NGINX Plus server:
$sudo service
nginxrestart
Tip Execute the following command if you do not need to restart the server when you are simply making a modification to the VHost file:
$sudo service nginx reload
...
Configure the datasources to point to the
REGISTRY_LOCAL1
,WSO2_REGISTRY_DB
, andWSO2_USER_DB
databases as follows in the<EI_HOME>/wso2/business-process/conf/datasources/master-datasources.xml
file as follows:Tip Replace the username, password, and database URL of your MySQL environment accordingly.
Code Block language xml <datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <providers> <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> </providers> <datasources> <datasource> <name>REGISTRY_LOCAL1</name> <description>The datasource used for registry- local</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>REGISTRY_DB</name> <description>The datasource used for registry- config/governance</description> <jndiConfig> <name>jdbc/WSO2RegistryDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>WSO2_USER_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2UMDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> </datasources> </datasources-configuration>
Tip Repeat this configuration on the second WSO2 EI node to configure the datasources to point to the
REGISTRY_LOCAL2
,WSO2_REGISTRY_DB
, andWSO2_USER_DB
databases as follows: (Change the username, password, and database URL as needed for your environment):Code Block language xml <datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <providers> <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> </providers> <datasources> <datasource> <name>REGISTRY_LOCAL2</name> <description>The datasource used for registry- local</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL2?autoReconnect=true</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>REGISTRY_DB</name> <description>The datasource used for registry- config/governance</description> <jndiConfig> <name>jdbc/WSO2RegistryDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>WSO2_USER_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2UMDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> <username>regadmin</username> <password>regadmin</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> </datasources> </datasources-configuration>
Add the following configuration in the
<EI_HOME>/wso2/business-process/conf/user-mgt.
xml file to configure the user stores.Tip Enter the datasource information for the user store that you configured in the
<EI_HOME>/conf/
datasources/master-
datasources.
xml file. You can change the admin username and password as well. However, you should do this before starting the server.Code Block language xml <Configuration> <AddAdmin>true</AddAdmin> <AdminRole>admin</AdminRole> <AdminUser> <UserName>admin</UserName> <Password>admin</Password> </AdminUser> <EveryOneRoleName>everyone</EveryOneRoleName> <Property name="dataSource">jdbc/WSO2UMDB</Property> </Configuration>
- Update the
dataSource
property in all nodes in the<EI_HOME>/wso2/business-process/conf/user-mgt.xml
file as shown below to configure the datasource:<Property name="dataSource">jdbc/WSO2UMDB</Property>
Add the following configuration in the
<EI_HOME>/wso2/business-process/conf/
datasources/bps-
datasources.
xml file to configure the connection to the business process profile related database as shown below. Change the driver class, database URL, username, and password as needed for your environment:Note Set the
<defaultAutoCommit>
property to true in every node with the business process profile. This is an important setting for the BPEL engine.Code Block language xml <datasource> <name>BPM_DS</name> <description></description> <jndiConfig> <name>bpmds</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/BPM_DB</url> <username>root</username> <password>root</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> <useDataSourceFactory>false</useDataSourceFactory> <defaultAutoCommit>true</defaultAutoCommit> <maxActive>100</maxActive> <maxIdle>20</maxIdle> <maxWait>10000</maxWait> </configuration> </definition> </datasource>
Add the following configurations in the
<EI_HOME>/wso2/business-process/conf/datasources/activiti-datasources.xml
file.Code Block language xml <datasource> <name>ACTIVITI_DB</name> <description>The datasource used for activiti engine</description> <jndiConfig> <name>jdbc/ActivitiDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/BPMN_DB</url> <username>root</username> <password>root</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Edit the
<EI_HOME>/wso2/business-process/conf/axis2/axis2.xml
file as follows to set up the cluster configurations.- Enable clustering for this node as follows:
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
- Set the membership scheme to "wka" to enable the well-known address registration method. (This node sends cluster initiation messages to the WKA members):
<parameter name="membershipScheme">wka</parameter>
- Specify the name of the cluster this node will join as follows:
<parameter name="domain">wso2.ei.domain</parameter>
- Specify the host to communicate cluster messages as follows:
<parameter name="localMemberHost">xxx.xxx.xxx.xx1</parameter>
Specify the port to communicate cluster messages as follows:
<parameter name="localMemberPort">4100</parameter>
Info This port number is not affected by the port offset value specified in the
<EI_HOME>/conf/carbon.
xml
file. If this port number is already assigned to another server, the clustering framework automatically increments this port number. However, if there are two servers running on the same machine, ensure that a unique port is set for each server.Specify the well-known members as follows: (The port value for the WKA node must be the same value as it's localMemberPort (in this case it is 4100).
Info You can also use IP address ranges for the hostname (e.g., 192.168.1.2-10). However, you can define a range only for the last portion of the IP address. Smaller the range, the faster the time it takes to discover members since each node has to scan a lesser number of potential members.
- Enable clustering for this node as follows:
Change the
<taskServerMode>
configuration in the<EI_HOME>wso2/business-process/conf/etc/tasks-config.
xml file as follows:<taskServerMode>STANDALONE</taskServerMode>
Info WSO2 EI ships with the task server component. By default, this component waits for two task server nodes when you enable clustering. Hence, change this entry to
STANDALONE
to start the business process profile.The task server configuration does not have an impact on the server runtime functionality. Hence, using AUTO or STANDALONE for this will not affect how the BPEL processes are executed during runtime.
However, when the AUTO setting is enabled in this default setting when clustering is enabled, the server will wait till it picks up another node so that there are two task server instances up and running. Hence, you will need to start both nodes simultaneously. Therefore, if you want to use AUTO, change the
taskServerCount
to 1 so that you can start the management node first.Add the following configurations in the
<EI_HOME>/wso2/business-process/conf/bps.
xml file:Note This is required only if you are using BPEL/ WS-Human Task functionality.
Enable distributed lock as follows:
<tns:UseDistributedLock>true</tns:UseDistributedLock>
Info This entry enables the Hazelcast-based synchronizations mechanism to prevent concurrent modification of the instance state by cluster members.
Configure the scheduler thread pool size as follows:
<tns:ODESchedulerThreadPoolSize>0</tns:ODESchedulerThreadPoolSize>
Info Thread pool size must always be smaller than the maximum active database connections configured in the
<EI_HOME>/wso2/business-processconf/
datasources/master-
datasources.
xml file. When configuring the thread pool size, allocate 10-15 threads per core depending on your setup. Leave some additional number of database connections since WSO2 EI uses database connections for API management as well.Example settings for a two node cluster are:
Oracle Server configured database connection size - 250
maxActive
entry in the<EI_HOME>/wso2/business-process/conf/
datasources/master-
datasources.
xml file for each node - 100SchedulerTreadPool
size for each node - 50
Optionally, uncomment the elements accordingly and give an unique ID to assign a unique ID to a node as follows:
<tns:NodeId>node1</tns:NodeId>
...