Install Apache webserver
Enable mod_jk apache module
Install Liferay
Modify Liferay tomcat server configuration
Configure mod_jk and worker properties
Verify Integration
Objective of this article to demonstrate integration of
Apache webserver and Liferay Portal server. It will provide complete
information on enable load balance among Liferay portal servers from apache
webserver. We will use mod_jk apache tomcat connector to enable
communication and load balance between apache webserver and Liferay portal tomcat
server.
To replicate environment in single machine, I will run
two Liferay portal instances on two different http and AJP ports. AJP ports
will be used for communicate with apache webserver.
Software’s and Tools
Apache 2.4
Windows 10
Liferay 7.4
Install Apache webserver
Download latest Apache webserver from Apache Haus website
and install in machine.
Follow below article to install Apache webserver in
windows 10 machine.
http://www.liferaysavvy.com/2021/07/install-apache-webserver-in-windows.html
Enable mod_jk apache module
We will use mod_jk module to communicate between
apache webserver and application server through AJP protocol.
Follow below article to enable mod_jk module in Apache
webserver.
http://www.liferaysavvy.com/2021/07/enable-modjk-module-in-apache-webserver.html
Install Liferay
Download latest Liferay portal community edition from
following Liferay website.
Liferay and tomcat server comes with bundle so we can
download Liferay tomcat portal bundle from below link.
https://www.liferay.com/downloads-community
Download Liferay 7.4 CE tomcat bundle from above download page.
We are going start two instances, so we have to
extract the bundle two different directories.
Extract the 7z file rename directory name to “liferay-ce-portal-7.4.1-ga2-node1”
Extract one more time and rename directory to “liferay-ce-portal-7.4.1-ga2-node2”
Modify Liferay tomcat server configuration
It’s required to change http connector port, Server
port, Redirect ports and AJP connector port in tomcat server.xml
file as we are running both instances in same machine. In the real-world case,
we run only portal server instance per machine most of the times.
Liferay Node1 Configuration
Server.xml
Open Liferay portal node1 server.xml file and
update ports.
Server port
<Server
port="8006" shutdown="SHUTDOWN"> |
Http connector
<Connector
port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" /> |
AJP Connector
<!-- Define
an AJP 1.3 Connector on port 8009 --> <Connector
protocol="AJP/1.3" address="0.0.0.0" port="8009" redirectPort="8443"
URIEncoding="UTF-8" secretRequired="false"/> |
Update “jvmRoute” value in server.xml and it
should be unique value.
Context.xml
Update Node1 conext.xml file and add “sessionCookieName”
for context. This will distinguish node values when you access in browser. We can
identify which node request is serving. Default value is JSESSIONID but I have
changed to LRSESSIONID.
liferay-ce-portal-7.4.1-ga2-node1
AJP port: 8009 HTTP Port: 8090 Server Port:
8006 Redirect Port: 8443 jvmRoute: liferay-node1 sessionCookieName:
LRSESSIONID |
Liferay Node2 Configuration
Server.xml
Open Liferay portal node2 server.xml file and
update ports.
Server port
<Server
port="8005" shutdown="SHUTDOWN"> |
Http connector
<Connector
port="8091" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="7443" URIEncoding="UTF-8" /> |
AJP Connector
<!-- Define
an AJP 1.3 Connector on port 7009 --> <Connector
protocol="AJP/1.3" address="0.0.0.0" port="7009" redirectPort="7443"
URIEncoding="UTF-8" secretRequired="false"/> |
Update “jvmRoute” value in Node2 server.xml and it
should be unique value.
Context.xml
Update Node2 conext.xml file and add “sessionCookieName”
for context. This will distinguish node values when you access in browser. We can
identify which node request is serving. Default value is JSESSIONID but I have
changed to LRSESSIONID.
liferay-ce-portal-7.4.1-ga2-node2
AJP port: 7009 HTTP Port: 8091 Server Port: 8005 Redirect Port: 7443 jvmRoute: liferay-node2 sessionCookieName:
LRSESSIONID |
Configure mod_jk and worker properties
Apache used the mod_jk module to connect with tomcat
server through AJP ports.
Its required to create worker.properties file
in the apache configuration and need to defined two workers. We are running two
tomcat servers so its required two worker properties. We use the mod_jk load balancer
to traffic requests between two tomcat servers.
Create worker.properties file in Apache conf
directory.
Add following worker properties in worker.properties
file.
#Define the list
of workers you have worker.list=jkstatus,loadbalancer # Set
LOADBALANCER worker.loadbalancer.type=lb worker.jkstatus.type=status # List Liferay
Tomcat Server's in the cluster worker.loadbalancer.balance_workers=liferay-node1,liferay-node2 worker.loadbalancer.sticky_session=1 # Set Worker # Liferay Portal
Server Node1 worker.liferay-node1.port=8009 worker.liferay-node1.host=localhost worker.liferay-node1.type=ajp13 worker.liferay-node1.lbfactor=1 # Liferay Portal
Server Node2 worker.liferay-node2.port=7009 worker.liferay-node2.host=localhost worker.liferay-node2.type=ajp13 worker.liferay-node2.lbfactor=1 |
We have defined two workers “liferay-node1 and liferay-node2”
and these names should match with “jvmroute” attribute value in tomcat
server.xml file.
Ports should match with AJP port value in tomcat
server.xml and host name are server host names in our case its localhost
sticky_session value 1
make sure its always go to same node when application need session management.
Update mod_jk configuration in Apache. We
already enabled mod_jk module and open mod_jk.conf and update with below
configuration.
Mod_jk.conf configuration
Its required to load worker.properites and JkMount
/* value should match with “worker.list” value “loadbalancer”
in worker.properties.
LoadModule
jk_module "${SRVROOT}/modules/mod_jk.so" <IfModule
jk_module> JkWorkersFile
${SRVROOT}/conf/workers.properties JkLogFile
"${SRVROOT}/logs/mod_jk.log JkLogStampFormat "[%b %d %Y -
%H:%M:%S] " JkRequestLogFormat "%w %V %T" JkLogLevel info JkOptions +ForwardKeySize
+ForwardURICompat -ForwardDirectories JkMount /* loadbalancer </IfModule> |
Verify Integration
Start Apache Server
Open window command prompt locates to Apache24
bin directory and run httpd.exe
Start Liferay Portal Servers
Open command prompt locates the Liferay Portal tomcat
bin directory and run startup.bat and it will launch server console.
Liferay Node1 Startup
C:\Liferay\Liferay74\liferay-ce-portal-7.4.1-ga2-node1\tomcat-9.0.43\bin>startup.bat |
Liferay Node2 Startup
C:\Liferay\Liferay74\liferay-ce-portal-7.4.1-ga2-node2\tomcat-9.0.43\bin>startup.bat |
Access below URL and make sure Liferay Portal Node1
started successfully.
Access below URL and make sure Liferay Portal Node2
started successfully.
Access Liferay portal with below URLs in browser and
LRSESSIONID specify the node name. Browser inspect element can see the LRSESSIONID.
If we observer the URL does not have port number so it confirms that configuration is working as expected.
http://localhost/;LRSESSIONID=abc.liferay-node1
http://localhost/;LRSESSIONID=abc.liferay-node2
References
https://tomcat.apache.org/connectors-doc-archive/jk2/jk/workershowto.html
Notes
When you access portal first time it will ask you to
complete basic configuration and follow the steps.
Objective of this article showing mod_jk connecting to
Liferay portal servers and each instance start with default HSQL database.
Ideally all instances should connect with same database.
We are running two Liferay Portal instances same machine
so we may see embedded elastic server port issue in one of the instance logs. Ideally,
we will use remote elastic search instead of embedded elastic search.
Static content is still serving from Portal Tomcat
server but real work application all static content is serving from Apache
webserver.
There are many mod_jk properties existed and refer
apache or tomcat documentations for more information.
To carry out trustworthy immediate criminal orange county mugshots records inspect, you require to be able to do 2 things - you initially require to have access to a great deal of reputable public records, and you likewise require to be able to have the capability to rapidly browse these records to assemble a total report on someone's background.
ReplyDeletehttps://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
M2WFMÄ°