Display server name or node in the cluster configuration
In Cluster configuration if we want to know which cluster server we have accessed it simple.
Liferay has provided a property by which we can know which cluster server we have accessed.
Add the following property in the portal-ext.properties
#
# Set this to true to display the server name at the bottom of every page.
# This is useful when testing clustering configurations so that you can know
# which node you are accessing.
#
web.server.display.node=true
If we see the internally liferay is using to get the computerName.
PortalUtil.getComputerName();
Look into the portalImpl class of constructor how liferay is using to get server node name.
_computerName = System.getProperty("env.COMPUTERNAME");
if (Validator.isNull(_computerName)) {
_computerName = System.getProperty("env.HOST");
}
if (Validator.isNull(_computerName)) {
_computerName = System.getProperty("env.HOSTNAME");
}
After restarting the server we can see the node name/ server Name at the bottom of the page.
As below screenshot
Liferay has provided a property by which we can know which cluster server we have accessed.
Add the following property in the portal-ext.properties
#
# Set this to true to display the server name at the bottom of every page.
# This is useful when testing clustering configurations so that you can know
# which node you are accessing.
#
web.server.display.node=true
If we see the internally liferay is using to get the computerName.
PortalUtil.getComputerName();
Look into the portalImpl class of constructor how liferay is using to get server node name.
_computerName = System.getProperty("env.COMPUTERNAME");
if (Validator.isNull(_computerName)) {
_computerName = System.getProperty("env.HOST");
}
if (Validator.isNull(_computerName)) {
_computerName = System.getProperty("env.HOSTNAME");
}
After restarting the server we can see the node name/ server Name at the bottom of the page.
As below screenshot
I recently came across your blog and have been following it. I'm very impressed. Liferay training curriculum and demo registrations @ Liferay Developer Portal Online Training
ReplyDeleteMastering Liferay Fundamentals Online Training