Skip to main content

Setting up Tomcat Cluster for SpagoBI 5.1.

Setting up Tomcat Cluster for SpagoBI 5.1.

Setting up SpagoBI 5.1 on Tomcat with MySQL is in the previous post.
Details on Tomcat Clustering.

Objective

Create a Cluster of Tomcat running SpagoBI, so that we can have a redundant setup. We will be setting up session based clustering as this is quick and easy.

Setup Overview as below.

                             /--> spagobi-node-1
                            /--> spagobi-node-2
Apache (httpd)  -----[RoundRobin]----> spagobi-node-3
                            \--> spagobi-node-4
                             \--> spagobi-node-5

Configuration port information for each spagobi Instance.

We will be configuring all the instance on the same server, for this test.
NOTE : In a real environment we will have multiple servers, each hosting a single instance of SpagoBI. In that case we will not need to do the below port distribution.
                SHUTDOWN    AJP        SSL
spagobi-node-1    8005        8009    8443
spagobi-node-2    8015        8019    8444
spagobi-node-3    8025        8029    8445
spagobi-node-4    8035        8039    8446
spagobi-node-5    8045        8049    8447

Create Multiple Instance of the existing tomcat.

We will be creating multiple instance of the same server in /opt
[ahmed@ahmed-server ~]# cd /opt/
[ahmed@ahmed-server opt]# cp -rf apache-tomcat-7.0.59 apache-tomcat-7.0.59-8019
[ahmed@ahmed-server opt]# cp -rf apache-tomcat-7.0.59 apache-tomcat-7.0.59-8029
[ahmed@ahmed-server opt]# cp -rf apache-tomcat-7.0.59 apache-tomcat-7.0.59-8039
[ahmed@ahmed-server opt]# cp -rf apache-tomcat-7.0.59 apache-tomcat-7.0.59-8049
[ahmed@ahmed-server opt]# mv apache-tomcat-7.0.59 apache-tomcat-7.0.59-8009
Here is how the new directories look like.

Updating server.xml file.

We will first update the base 8009 Instance and later copy to all other instances.
vim /opt/apache-tomcat-7.0.59-8009/conf/server.xml

Setting up the SHUTDOWN port.

We will be setting the below port for each server for SHUTDOWN
spagobi-node-1    8005
spagobi-node-2    8015
spagobi-node-3    8025
spagobi-node-4    8035
spagobi-node-5    8045
Make the change in the tag as below.
<Server port="8005" shutdown="SHUTDOWN">
Here is how it looks on the server.xml
"Shutdown Port"

Comment below tag as we will not be using this.

<!--
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" /> 
-->
Here is how it looks for my setup.
"Disable Port 8080"

Update spago_service_url and spago_host_url.

Change the server and host url to point to the server on port 80.
As all the services will be served from this port.
<Environment name="spagobi_service_url" type="java.lang.String" value="http://localhost:8080/SpagoBI"/>
<Environment name="spagobi_host_url" type="java.lang.String" value="http://localhost:8080"/>
Change to ipaddress of the Server or locahost.
<Environment name="spagobi_service_url" type="java.lang.String" value="http://10.10.18.94/SpagoBI"/>
<Environment name="spagobi_host_url" type="java.lang.String" value="http://10.10.18.94"/>
Her is how it looks like.
"Change Spago"

Setting AJP port.

Below are the ports which we will be setting for each server.
                AJP        SSL
spagobi-node-1    8009    8443
spagobi-node-2    8019    8444
spagobi-node-3    8029    8445
spagobi-node-4    8039    8446
spagobi-node-5    8049    8447
Here is how it would look for spagobi-node-1, will need to do it for other instances as well.
<Connector port="8009" URIEncoding="UTF-8" protocol="AJP/1.3" redirectPort="8443" />

Setting name for our node.

As stated above AJP 8009, is spagobi-node-1 so we add jvmRoute="spagobi-node-1" to below tag.
<Engine name="Catalina" defaultHost="localhost" jvmRoute="spagobi-node-1">
Here is how the server.xml looks like.
"AJP and Node Name"

Making Changes to rest of the server.xml.

First lets copy server.xml to all the other instance.
cp /opt/apache-tomcat-7.0.59-8009/conf/server.xml /opt/apache-tomcat-7.0.59-80[1-4]9/conf/
cp /opt/apache-tomcat-7.0.59-8009/conf/server.xml /opt/apache-tomcat-7.0.59-80[123]9/conf/
cp /opt/apache-tomcat-7.0.59-8009/conf/server.xml /opt/apache-tomcat-7.0.59-8019/conf/
cp /opt/apache-tomcat-7.0.59-8009/conf/server.xml /opt/apache-tomcat-7.0.59-8029/conf/
Update SHUTDOWN port on all the instance.
sed -i -- 's/8005/8015/g' /opt/apache-tomcat-7.0.59-8019/conf/server.xml
sed -i -- 's/8005/8025/g' /opt/apache-tomcat-7.0.59-8029/conf/server.xml
sed -i -- 's/8005/8035/g' /opt/apache-tomcat-7.0.59-8039/conf/server.xml
sed -i -- 's/8005/8045/g' /opt/apache-tomcat-7.0.59-8049/conf/server.xml
Update AJP port.
sed -i -- 's/8009/8049/g' /opt/apache-tomcat-7.0.59-8049/conf/server.xml
sed -i -- 's/8009/8039/g' /opt/apache-tomcat-7.0.59-8039/conf/server.xml
sed -i -- 's/8009/8029/g' /opt/apache-tomcat-7.0.59-8029/conf/server.xml
sed -i -- 's/8009/8019/g' /opt/apache-tomcat-7.0.59-8019/conf/server.xml
Update SSL port.
sed -i -- 's/8443/8444/g' /opt/apache-tomcat-7.0.59-8019/conf/server.xml
sed -i -- 's/8443/8445/g' /opt/apache-tomcat-7.0.59-8029/conf/server.xml
sed -i -- 's/8443/8446/g' /opt/apache-tomcat-7.0.59-8039/conf/server.xml
sed -i -- 's/8443/8447/g' /opt/apache-tomcat-7.0.59-8049/conf/server.xml
Update node-name for all the Instance. This is important as this will identify each instance.
sed -i -- 's/node-1/node-2/g' /opt/apache-tomcat-7.0.59-8019/conf/server.xml
sed -i -- 's/node-1/node-3/g' /opt/apache-tomcat-7.0.59-8029/conf/server.xml
sed -i -- 's/node-1/node-4/g' /opt/apache-tomcat-7.0.59-8039/conf/server.xml
sed -i -- 's/node-1/node-5/g' /opt/apache-tomcat-7.0.59-8049/conf/server.xml

Configuring httpd Server.

Assuming httpd is already installed. If not the execute sudo yum install httpd on centos.
Add the below configuration to httpd.conf file in the end.
Location : /etc/https/conf/https.conf
<Proxy balancer://spagobicluster stickysession=JSESSIONID>
  BalancerMember ajp://127.0.0.1:8009 min=10 max=100 route=spagobi-node-1 loadfactor=1
  BalancerMember ajp://127.0.0.1:8019 min=10 max=100 route=spagobi-node-2 loadfactor=1
  BalancerMember ajp://127.0.0.1:8029 min=10 max=100 route=spagobi-node-3 loadfactor=1
  BalancerMember ajp://127.0.0.1:8039 min=10 max=100 route=spagobi-node-4 loadfactor=1
  BalancerMember ajp://127.0.0.1:8049 min=10 max=100 route=spagobi-node-5 loadfactor=1
</Proxy>

ProxyPass /* balancer://spagobicluster/*
[OPTIONAL] we can give the below configuration.
ProxyPass /SpagoBI balancer://spagobicluster/SpagoBI
ProxyPass /SpagoBIAccessibilityEngine balancer://spagobicluster/SpagoBIAccessibilityEngine
ProxyPass /SpagoBIBirtReportEngine balancer://spagobicluster/SpagoBIBirtReportEngine
ProxyPass /SpagoBIChartEngine balancer://spagobicluster/SpagoBIChartEngine
ProxyPass /SpagoBICockpitEngine balancer://spagobicluster/SpagoBICockpitEngine
ProxyPass /SpagoBICommonJEngine balancer://spagobicluster/SpagoBICommonJEngine
ProxyPass /SpagoBIConsoleEngine balancer://spagobicluster/SpagoBIConsoleEngine
ProxyPass /SpagoBIDataMiningEngine balancer://spagobicluster/SpagoBIDataMiningEngine
ProxyPass /SpagoBIGeoEngine balancer://spagobicluster/SpagoBIGeoEngine
ProxyPass /SpagoBIGeoReportEngine balancer://spagobicluster/SpagoBIGeoReportEngine
ProxyPass /SpagoBIJasperReportEngine balancer://spagobicluster/SpagoBIJasperReportEngine
ProxyPass /SpagoBIJPivotEngine balancer://spagobicluster/SpagoBIJPivotEngine
ProxyPass /SpagoBIMobileEngine balancer://spagobicluster/SpagoBIMobileEngine
ProxyPass /SpagoBINetworkEngine balancer://spagobicluster/SpagoBINetworkEngine
ProxyPass /SpagoBIQbeEngine balancer://spagobicluster/SpagoBIQbeEngine
ProxyPass /SpagoBISocialAnalysis balancer://spagobicluster/SpagoBISocialAnalysis
ProxyPass /SpagoBITalendEngine balancer://spagobicluster/SpagoBITalendEngine
ProxyPass /SpagoBIWhatIfEngine balancer://spagobicluster/SpagoBIWhatIfEngine
To add a balancer-manager so that you can see the nodes add the below tag in the end of https.conf file.
<Location /balancer-manager>
  SetHandler balancer-manager
  AuthType Basic
  AuthName "Balancer Manager"
  AuthUserFile "/etc/httpd/conf/.htpasswd"
  Require valid-user
</Location>
Setting passwd for balancer-manager is simple. Execute below command to create a password for balancer-manager.
[ahmed@ahmed-server ~]# htpasswd -c /etc/httpd/conf/.htpasswd admin
Here is how httpd.conf looks like.

Starting httpd Deamon.

Restarting https using below command.
[ahmed@ahmed-server ~]# service httpd restart

Starting tomcat Instances.

We are start all the instance at once using the below script.
for item in 8009 8019 8029 8039 8049;
do
    /opt/apache-tomcat-7.0.59-${item}/bin/start.sh
    sleep 100
done;
Once we have all the instance started, we can check the balancer-manager on the url as http:/localhost/balancer-manager. Here is how it looks on current setup.
"Balancer Manager"

Comments

Popular posts from this blog

Zabbix History Table Clean Up

Zabbix history table gets really big, and if you are in a situation where you want to clean it up. Then we can do so, using the below steps. Stop zabbix server. Take table backup - just in case. Create a temporary table. Update the temporary table with data required, upto a specific date using epoch . Move old table to a different table name. Move updated (new temporary) table to original table which needs to be cleaned-up. Drop the old table. (Optional) Restart Zabbix Since this is not offical procedure, but it has worked for me so use it at your own risk. Here is another post which will help is reducing the size of history tables - http://zabbixzone.com/zabbix/history-and-trends/ Zabbix Version : Zabbix v2.4 Make sure MySql 5.1 is set with InnoDB as innodb_file_per_table=ON Step 1 Stop the Zabbix server sudo service zabbix-server stop Script. echo "------------------------------------------" echo " 1. Stopping Zabbix Server ...

Access Filter in SSSD `ldap_access_filter` [SSSD Access denied / Permission denied ]

Access Filter Setup with SSSD ldap_access_filter (string) If using access_provider = ldap , this option is mandatory. It specifies an LDAP search filter criteria that must be met for the user to be granted access on this host. If access_provider = ldap and this option is not set, it will result in all users being denied access. Use access_provider = allow to change this default behaviour. Example: access_provider = ldap ldap_access_filter = memberOf=cn=allowed_user_groups,ou=Groups,dc=example,dc=com Prerequisites yum install sssd Single LDAP Group Under domain/default in /etc/sssd/sssd.conf add: access_provider = ldap ldap_access_filter = memberOf=cn=Group Name,ou=Groups,dc=example,dc=com Multiple LDAP Groups Under domain/default in /etc/sssd/sssd.conf add: access_provider = ldap ldap_access_filter = (|(memberOf=cn=System Adminstrators,ou=Groups,dc=example,dc=com)(memberOf=cn=Database Users,ou=Groups,dc=example,dc=com)) ldap_access_filter accepts standa...

Installing Zabbix Version 2.4 Offline (Zabbix Server without Internet).

There might be situations where you have a remote/zabbix server which does not have internet connectivity, due to security or other reasons. So we create a custom repo on the remote/zabbix server so that we can install zabbix using rpms Here is how we are planning to do this. Download all the dependency rpms on a machine which has internet connection, using yum-downloadonly or repotrack . Transfer all the rpms to the remote server. Create a repo on the remote server. Update yum configuration. Install. NOTE: This method can be used to install any application, but here we have used zabbix as we had this requirement for a zabbix server. Download dependent rpms . On a machine which has internet connection install the package below. And download all the rpms . Make sure the system are similar (not required to be identical - At-least the OS should be of same version) mkdir /zabbix_rpms yum install yum-downloadonly Downloading all the rpms to location /zabbix_rpms/ ,...