Best Practice - Pentah BA fr High Availability
This page intentinally left blank.
Cntents Overview... 1 Pentah Server High Availability Intrductin... 2 Prerequisites... 3 Pint Each Server t Same Database Instance... 3 Clustering the BA Server Ndes... 4 Cnfigure Jackrabbit Jurnal... 4 Cnfigure Quartz... 4 Start and Test the Cluster... 4 Cnfiguring a Lad Balancer fr BA Server High Availability... 5 Tmcat Cnfiguratin... 5 Apache Cnfiguratin (Windws Envirnment)... 5 Apache Cnfiguratin (Linux Envirnment)... 6 Additinal Cnsideratins fr Apache Cnfiguratin... 8 High Availability fr the Backend Repsitry... 9 Related Infrmatin... 9 Knwn Issues and Slutins... 10 User Prmpted t Reauthenticate / PUC Image Lad Errr... 10 Failver Behavir... 10 Best Practice Check List... 11
Overview We have cllected a set f best practice recmmendatins and infrmatin fr yu t use when yu want t set up yur Pentah BA servers with a clustered High Availability slutin. Keep these Pentah Architecture principles in mind while yu are wrking thrugh this dcument: 1. Architecture is imprtant, abve all else. 2. Platfrms are always evlving: smetimes yu will have t think creatively. Sme f the things discussed here include clustering the BA server ndes, cnfiguring a lad balancer fr HA, and Tmcat and Apache cnfiguratin fr Windws and Linux. The intentin f this dcument is t speak abut tpics generally; hwever, these are the specific versins cvered here: Sftware Versin Pentah 5.4, 6.0, 6.1 Tmcat 6.0, 7.0, 8.0 Pentah BA in HA End-t-End Pentah 1
Pentah Server High Availability Intrductin Mst installatins f Pentah are single-server installatins. This slutin wrks well in small- and medium-sized rganizatins where users and develpers are limited t a handful f peple. In large scale deplyments, hwever, a clustered High Availability (HA) slutin is needed t address the increase in data prcessing and cncurrent user cnnectins. HA slutins fr Pentah servers fllw the typical lad balancing mdels, where a lad balancer (such as Apache HTTPD) sits in frnt f a cluster f Pentah servers and frwards traffic in either a rund-rbin fashin r by ther methds, such as wrker server qutas. Figure 1: Pentah BA in HA Diagram This mdel nt nly allws fr distributed prcessing, but als failver. S, in the event that ne Pentah server ges dwn, service is nt interrupted but is instead taken ver by a live server. A single pint f failure with this mdel wuld be with the lad balancer, s further cnsideratin t cluster the lad balancer wuld need t be taken. In this best practice guide, we will nly be cvering the cnfiguratin f a single lad balancer. Pentah BA in HA End-t-End Pentah 2
Prerequisites This guide assumes that a lad balancer is already installed and running. In this guide, we will be using Apache HTTPD. All cnfiguratins will be shwn in an Apache web server cntext. Yu will need t make sure that each Pentah server in yur cluster is already cnfigured t use the repsitry database f yur chice. Make sure each server is pinting t the same database instance. Pint Each Server t Same Database Instance Initialize yur database using the steps in the apprpriate article fr yur system. Cnfigure Yur Repsitry Database has sectins fr PstgreSQL, MySQL, MS SQL Server, and Oracle databases. After yu have initialized and cnfigured yur repsitry, yu shuld clean up these files by fllwing these steps. Lcate the...biserver-ee/tmcat directry and remve all files and flders frm the temp flder. Lcate the...biserver-ee/tmcat directry and remve all files and flders frm the wrk flder. Lcate the...biserver-ee/pentah-slutins/system/jackrabbit/repsitry directry and remve all files and flders frm the final repsitry flder. Lcate the...biserver-ee/pentah-slutins/system/jackrabbit/repsitry directry and remve all files and flders frm the wrkspaces flder. Yu nw have a cnfigured repsitry and are ready t mve t the next step fr clustering. Pentah BA in HA End-t-End Pentah 3
Clustering the BA Server Ndes The first step in develping a BA with HA slutin wuld be t cnfigure the cluster ndes t use the same backend repsitry. The fllwing instructins will walk yu thrugh this prcess. Cnfigure Jackrabbit Jurnal Pentah uses Apache Jackrabbit as its cntent repsitry. Yu will need t cnfigure the Jackrabbit Jurnal fr clustering by fllwing the fficial instructins fund in Pentah Dcumentatin: Cnfigure Jackrabbit Jurnal. Cnfigure Quartz Pentah uses Quartz fr scheduling. As with the Jackrabbit Jurnal, Quartz als needs t be cnfigured fr a cluster. The fficial instructins can be fund in Pentah Dcumentatin: Cnfigure Quartz. Start and Test the Cluster Fllw the belw instructins t start the cluster and verify that it is wrking prperly. Start the slutin database. Start the applicatin server n each nde. Make sure that the lad balancer is able t ping each nde. Access the lgin screen fr each server in yur cluster. Brwse directly t each nde instead f ging thrugh the lad balancer. Pentah BA in HA End-t-End Pentah 4
Cnfiguring a Lad Balancer fr BA Server High Availability Nw that each server in the Pentah cluster can be accessed individually, it is time t cnfigure the lad balancer t manage traffic t each nde. The first sectin will cver cnfiguring Apache as a lad balancer with the BA Server cluster ndes. We prvide instructins fr cnfiguring Apache fr bth Windws and Linux. There are als a few additinal cnsideratins t keep in mind while yu are wrking thrugh these prcedures. Sticky sessins are enabled using stickysessin=jsessionid PrxyPass and PrxyPassReverseCkiePath Directives Prxy balancer is part f the md_prxy_balancer mdule The abve listed sectins have infrmatin n each item. Tmcat Cnfiguratin 1. Shutdwn the Tmcat server n each nde in the cluster. 2. Open the tmcat/cnf/server.xml file in a text editr. 3. Lcate the fllwing line <Engine name="catalina" defaulthst="lcalhst">. 4. Add the jvmrute attribute like this: <Engine name="catalina" defaulthst="lcalhst" jvmrute= server1 > The jvmrute value will need t be unique fr each nde. This value will map t the BalancerMember setup in the fllwing sectin when cnfiguring Apache. 5. Edit the tmcat/webapps/pentah/web-inf/web.xml and change the fully-qualifiedserver-url param-value t the lad balancer s URL. 6. Start the Tmcat service back up after cnfiguring this file. 7. Repeat this prcess thrughut all ndes within the cluster. Apache Cnfiguratin (Windws Envirnment) Open the C:\Prgram Files (x86)\apache24\cnf\httpd.cnf file in a text editr. The fllwing mdules will need t be uncmmented if they aren t already: LadMdule prxy_mdule mdules/md_prxy.s LadMdule prxy_ajp_mdule mdules/md_prxy_ajp.s LadMdule prxy_http_mdule mdules/md_prxy_http.s LadMdule prxy_balancer_mdule mdules/md_prxy_balancer.s Pentah BA in HA End-t-End Pentah 5
At the bttm f the file, add the fllwing cde, making sure t reflect the BalancerMember hstname with yur Pentah cluster ndes: PrxyPass /pentah balancer://bacluster PrxyPassReverseCkiePath / /pentah PrxyPass /pentah-style balancer://bacluster-style PrxyPassReverseCkiePath / /pentah <Prxy balancer://bacluster> PrxySet stickysessin=jsessionid timeut=10 failnstatus=502,503 BalancerMember ajp://hstname1:8009/pentah ladfactr=10 rute=server1 BalancerMember ajp://hstname2:8009/pentah ladfactr=10 rute=server2 </Prxy> <Prxy balancer://bacluster-style> PrxySet stickysessin=jsessionid timeut=10 failnstatus=502,503 BalancerMember ajp://hstname1:8009/pentah-style ladfactr=10 rute=server1 BalancerMember ajp://hstname2:8009/pentah-style ladfactr=10 rute=server2 </Prxy> <Prxy balancer://dicluster> BalancerMember http://linuxvm1:9080/pentah-di retry=30 BalancerMember http://linuxvm2:9080/pentah-di status=+h retry=0 </Prxy> Each Prxy balancer has tw servers in the cluster. If yu have mre than tw servers in yur cluster, yu will need t add all f them accrdingly. After adding the abve cde, save the file and restart the Apache service. Yu shuld nw be able t brwse t yur lad balancer and see the Pentah User Cnsle, fr example: http://ladbalancerhstname/pentah Apache Cnfiguratin (Linux Envirnment) The fllwing mdules will need t be laded: prxy_ajp prxy_balancer prxy_http lbmethd_byrequests Yu will need t use the prper OS specific cmmands t lad these mdules. Fr example, with Debian-based distrs, run the cmmand t lad the required mdules: Pentah BA in HA End-t-End Pentah 6
sud a2enmd prxy prxy_ajp prxy_balancer prxy_http lbmethd_byrequests Fr RPM-based distrs, yu will need t enable these mdules in the httpd.cnf file by making sure they are uncmmented, similar t the Windws cnfiguratin abve. These may already be uncmmented by default. 2. Lcate and edit the Apache cnfiguratin file. Fr Debian-based distrs, this is lcated by default in /etc/apache2/sitesavailable/000-default.cnf. Fr RPM-based distrs, this is lcated by default in /etc/httpd/cnf/httpd.cnf. 3. Within this cnfiguratin file, yu will need t edit the existing (r add a new) VirtualHst directive. It will need t be set up like this. Make sure t reflect the BalancerMember hstname with yur Pentah cluster ndes: <VirtualHst *:80> ServerAdmin webmaster@lcalhst DcumentRt /var/www/html ErrrLg ${APACHE_LOG_DIR}/errr.lg CustmLg ${APACHE_LOG_DIR}/access.lg cmbined <Lcatin "/pentah"> PrxyPass balancer://bacluster PrxyPassReverseCkiePath / /pentah </Lcatin> <Lcatin "/pentah-style"> PrxyPass balancer://bacluster-style PrxyPassReverseCkiePath / /pentah </Lcatin> </VirtualHst> <Prxy balancer://bacluster> PrxySet stickysessin=jsessionid timeut=10 failnstatus=502,503 BalancerMember ajp://hstname1:8009/pentah ladfactr=10 rute=server1 BalancerMember ajp://hstname2:8009/pentah ladfactr=10 rute=server2 </Prxy> <Prxy balancer://bacluster-style> PrxySet stickysessin=jsessionid timeut=10 failnstatus=502,503 BalancerMember ajp://hstname1:8009/pentah-style ladfactr=10 rute=server1 BalancerMember ajp://hstname2:8009/pentah-style ladfactr=10 rute=server2 </Prxy> Pentah BA in HA End-t-End Pentah 7
In the abve cde, each Prxy balancer has tw servers in the cluster. If yu have mre than tw servers in yur cluster, yu will need t add all f them accrdingly. 4. After adding the cde, save the file and restart the Apache service. 5. Yu shuld nw be able t brwse t yur lad balancer and see the Pentah User Cnsle, fr example: http://ladbalancerhstname/pentah Additinal Cnsideratins fr Apache Cnfiguratin There are als a few additinal cnsideratins yu may want t keep in mind while yu are wrking thrugh the abve prcedures. Sticky sessins are enabled using stickysessin=jsessionid This is imprtant s yur sessin is tied t a single nde. By default, Tmcat uses JSESSIONID as the name f its sessin ckie. PrxyPass and PrxyPassReverseCkiePath Directives Bth PrxyPass and PrxyPassReverseCkiePath are directives f the md_prxy mdule. This allws Apache t map remte servers t the lcal server URL-space. In this instance, the remve servers are referencing clusters rather than a single server. Yu will als ntice that tw instances f these directives are required fr prper BA Server mapping. The first set f directives needs t pint t a cluster that uses the address: ajp://{hstname}:8009/pentah, which is the main pentah webapp. The secnd set f directives needs t pint t a cluster that uses the address: ajp://{hstname}:8009/pentah-style, which is the webapp used fr images, stylesheets, and the verall lk and feel f the User Cnsle. Prxy balancer is part f the md_prxy_balancer mdule This is where yu cnfigure the actual cluster ndes. The example f Prxy balancer has been cnfigured in such a way that traffic is laded evenly acrss all ndes within the cluster. This is dne with the ladfactr and rute parameters. Rute has been cnfigured with the same jvmrute id that was cnfigured in the previus sectin n Tmcat Cnfiguratin. This is hw Apache knws which nde in the Prxy balancer maps t which Tmcat instance. Other parameters can be used t specify certain cunting algrithms that will distribute traffic based n server quta, as well as ther parameters that can cntrl ther aspects f the lad balancer. Apache s dcumentatin has the list f parameters that can be used and descriptins f cunting algrithms. Due t better ptimizatin and speed, the AJP prtcl and crrespnding Tmcat prt have been used in the cluster nde URLs. Alternatively, HTTP culd be used, hwever the cluster nde s URL will nt be masked when traffic is frwarded frm Apache. AJP will mask the cluster nde URL with the lad balancer s URL s that the redirect is hidden frm the user. Other differences between the tw prtcls are dcumented n Apache s site in their FAQ n cnnectrs. Pentah BA in HA End-t-End Pentah 8
High Availability fr the Backend Repsitry At this pint, we ve cvered high availability fr the BA server. Even if yu have clustered the lad balancers, yu may still ntice that a single pint f failure still exists: the backend repsitry database. Slutin: Cluster the database used t hld the repsitry. Ding this requires n special cnfiguratin n the Pentah-side, since each f the servers will see a clustered database as a single entity. Yu will just need t fllw the dcumentatin frm the prper vendr t cluster the database accrding t yur envirnment and needs. Once yu have dne this, the same instructins fr initializing yur database in the prerequisites f this guide can be fllwed with n changes. Related Infrmatin The fllwing vendr links can help yu get started n clustering the supprted databases: Oracle: Clustering a. https://dcs.racle.cm/database/121/nav/prtal_16.htm MySQL: Cluster Reference Guides a. http://dev.mysql.cm/dc/index-cluster.html PstgreSQL: Creating a Database Cluster a. http://www.pstgresql.rg/dcs/9.4/static/creating-cluster.html Pentah BA in HA End-t-End Pentah 9
Knwn Issues and Slutins Here are a few knwn issues that yu shuld be aware f, alng with best practices and slutins fr each issue. User Prmpted t Reauthenticate / PUC Image Lad Errr A cmmn issue may happen where a user is redirected by the lad balancer t the PUC lgin screen where they will enter their credentials. After selecting Lg in, anther authenticatin bx will pp up asking fr credentials again. Upn reauthenticating, PUC des nt lad all images fr the hmescreen crrectly. Slutin: This culd be due t the fact that the pentah-style webapp is nt cnfigured prperly fr the PrxyPassReverseCkiePath directive. Rather than use the exact examples abve, yu may need t change it frm this: <Lcatin "/pentah-style"> PrxyPass balancer://bacluster-style PrxyPassReverseCkiePath / /pentah </Lcatin> T this: <Lcatin "/pentah-style"> PrxyPass balancer://bacluster-style PrxyPassReverseCkiePath / /pentah-style </Lcatin> Failver Behavir The BA Server des nt supprt sessin fail-ver. The net result f this is that while yu can cluster BA Servers fr lad-balancing, if any nde in the cluster ges dwn, all users n that nde will end up withut a valid server sessin, and their next request will be sent t anther nde in the cluster where they wuld have t re-lgin (as if they timed ut). Fr reference, failver is handled by the failnstatus parameter. In the abve example, server failver will happen when a request receives HTTP errr cdes 502 and 503. Pentah BA in HA End-t-End Pentah 10
Best Practice Check List This checklist is designed t be added t any implemented prject that uses this cllectin f best practices, t verify that all items have been cnsidered and reviews have been perfrmed. Name f the Prject: Date f the Review: Name f the Reviewer: Item Respnse Cmments Did yu cluster the BA Server ndes? cnfigure Jackrabbit? cnfigure Quartz? start and test the cluster? Have yu cnfigured a lad balancer fr HA? Did yu set up HA fr yur backend repsitry? YES YES YES YES YES YES NO NO NO NO NO NO If yu are using this best practices dcument, we wuld be happy if yu wuld leave us a cmment r suggestin t let us knw what yu think! This will help us learn abut wh is using ur best practices, and als give us sme insight as t what yu find helpful abut them. As always, if yu have a mre infrmatin r a slutin that wuld enhance this dcument, we wuld lve t hear abut that, t. Pentah BA in HA End-t-End Pentah 11