A WSO2 ESB cluster should contain two or more ESB instances that are configured to run within the same domain. To make an instance a member of the cluster, you must configure it to either of the available membership schemes:
...
Before you begin, download and extract WSO2 ESB and WSO2 ELB to a local directory on the sever. For this example, we have extracted one copy of the ELB and two copies of the ESB on the server with IP xxx.xxx.xxx.206 (the x's represent your actual IP prefix), and we extracted two copies of the ESB on the server with the IP xxx.xxx.xxx.132:
Server xxx.xxx.xxx.206:
...
- Open the
<ELB_HOME>/repository/conf/loadbalancer.conf
file. Locate the ESB configuration and edit it as follows:
Code Block language html/xml esb { domains { wso2.esb.domain { hosts esb.cloud-test.wso2.com; sub_domain worker; tenant_range *; } } }
...
In this file, we specified the domain name (wso2.esb.domain
), which is used to identify the cluster. On startup, a node with this domain name will look for a cluster with this same domain name.
...
In the previous diagram, you can see that all the service requests need to be routed to the worker nodes through the ELB, which is the front end to the entire cluster. We used the hosts
attribute to configure the the publicly accessible host name (esb.cloud-test.wso2.com
), which clients can use to send their requests to the cluster. This We will map the host name must be mapped to the ELB server IP address via the host entries in the /etc/hosts
filelater.
Finally, the tenant_range
attribute is used to handle tenant-aware load-balancing, which is another very powerful feature of the ELB. This attribute allows us to partition tenants into several clusters, so that when there is a large number of tenants to work with, we can instruct each cluster to work only with a particular tenant or a few selected tenants. This approach is also useful if you need a particular cluster to be dedicated to work for a single special tenant ("Private Jet Mode"). In this example, we are not enabling tenant partitioning, so we have used an asterisk ( * ) in front of the tenant_range
attribute to represent all possible tenants.
...
- Enable clustering for this node:
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
- Set the membership scheme to
wka
to enable the Well Known Address registration method (this node will send cluster initiation messages to WKA members that we will define later):<parameter name="membershipScheme">wka</parameter>
- Specify the name of the cluster this node will join:
<parameter name="domain">wso2.esb.domain</parameter>
- Specify the port used to communicate cluster messages:
<parameter name="localMemberPort">4000</parameter>
Note: This port number will not be affected by the port offset incarbon.xml
. If this port number is already assigned to another server, the clustering framework will automatically increment this port number. However, if two servers are running on the same machine, you must ensure that a unique port is set for each server. Define the ESB manager node as a well-known member of the cluster by providing its host name and localMemberPorts the
localMemberPort
port you just specified:Code Block language html/xml <members> <member> <hostName>mgr.esb.wso2.com</hostName> <port>4001</port> </member> </members>
- Enable clustering for this node:
We have now completed the clustering-related configuration for the ELB. In the next section, we will make one last change to the ELB that will increase usability.
...
Configure ELB to listen on default ports
We will now change the ELB configuration to listen to the default HTTP and HTTPS ports.
...
- In the
<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
transport, enable service requests to be sent to the ELB's default HTTP port instead of having to specify port 8280:<parameter name="port">80</parameter>
- In the
<transportReceiver name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLListener">
transport, enable service requests to be sent to the ELB's default HTTPS port instead of having to specify port 8243:<parameter name="port">443</parameter>
- In the
Note: We have used hosts names above(esb.cloud-test.wso2.com and mgr.esb.wso2.com) but in case we didn’t have DNS to to map them, we have to manually map them accordingly. In In the next section below, we will see how these host name mapping can be carried out.
##left off here; continue editing and formatting from this point forward
3.1.4 Map IPs
map the host names we specified to real IPs.
Mapping host names to IPs
In the ELB we have used specified two host names, one is used : esb.cloud-test.wso2.com
for worker hosts in loadbalancer.conf and other one is used for manager node. So it has to be mapped to a real IP. So open and mgr.esb.wso2.com
for the manager node. We will now map them to IPs in case there is no DNS to map them.
Open the server's /etc/hosts
file and add the following lines.
<ELB-IP> esb.cloud-test.wso2.com
, where <ELP-IP> and <ESB-Manager-IP> mgr.esb.wso2.com
In the case of this sample, it is:
are the actual IP addresses (in this example, xxx.xxx.xxx.206):
Code Block | ||
---|---|---|
| ||
<ELB-IP> esb.cloud-test.wso2.com |
...
<ESB-Manager-IP> mgr.esb.wso2.com |
Now we are all complete with the configurations of the ELB. Lets start We have now finished configuring the ELB and ready to start the ELB server.
Starting the ELB server
Start the ELB server by typing the following command in the terminal:
sudo -E sh <ELB_HOME>/bin/wso2server.sh
Info |
---|
If you |
...
skipped the step of configuring the ELB to listen |
...
on the default |
...
ports, you do not need to use the |
...
with the following command: |
...
|
The ELB should print logs to the server console like similar to the following,“INFO - TribesClusteringAgent Initializing :
Code Block | ||
---|---|---|
| ||
INFO - TribesClusteringAgent Initializing cluster... |
...
INFO - TribesClusteringAgent Cluster domain: wso2.esb.domain |
...
INFO - TribesClusteringAgent Using wka based membership management scheme |
...
INFO - WkaBasedMembershipScheme Receiver Server Socket bound to:/xxx.xxx.xxx.206:4000 |
...
INFO - WkaBasedMembershipScheme Receiver Server Socket bound to:/xxx.xxx.xxx.206:4000 |
...
INFO - TribesClusteringAgent Local Member xxx.xxx.xxx.206:4000(wso2.esb.domain) |
...
INFO - TribesUtil No members in current cluster |
...
INFO - TribesClusteringAgent Cluster initialization completed. |
”
Now lets move on to Configuring You are ready to configure the ESB manager node of our setup. Secondly, we need to enable clustering capabilities of on the ESB worker nodes and instruct those about , and configure them to recognize the Well Known Member ( Which is the ESB in this case ) in the cluster.
##left off here
3.2. Set up Central Database
...