Liferay is a prominent
Content Management System that is adopted by enterprises across the world to build portals and corporate sites.
Search is a very important and widely used feature of Liferay development. Elasticsearch goes well with Liferay. Liferay architectures either use embedded Elasticsearch or use the Remote Elasticsearch. The experts of the Liferay development services recommend using the Remote Elasticsearch option as it enhances the search performance of the system. Embedded is not recommended for production environments as it might slow down the performance.
In this blog, we have provided the steps to be performed to integrate remote Elasticsearch with Liferay DXP 7.2.
1) Check the Liferay compatibility matrix for the Elastic search version.
https://www.liferay.com/documents/10182/246659966/Liferay+DXP+7.2+Compatibility+Matrix.pdf/ed234765-db47-c4ad-7c82-2acb4c73b0f9
2) For instance we are using ElasticSearch Version 7.6.2 which can be downloaded from the link below.
https://www.elastic.co/downloads/past-releases/elasticsearch-7-6-2
3) Elasticsearch services basically require the permission of a user named elasticsearch user only you can create elasticsearch user with the below command.
sudo useradd -m elasticsearch
4) Upgrade Liferay elastic search from 6. x to 7. x by downloading Liferay Connector ElasticSearch 7 lpkg plugin from the Liferay marketplace.
5) To install pkg, copy the pkg file to Liferay’s deploy folder and let the file get started.
6) Once the pkg is started shut down the server.
7) Blacklist the 6.x elastic search by creating com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config file in server osgi config.
8) In com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config file put the following content.
blacklistBundleSymbolicNames=[ \
“com.liferay.portal.search.elasticsearch6.api”, \
“com.liferay.portal.search.elasticsearch6.impl”, \
“com.liferay.portal.search.elasticsearch6.spi”, \
“com.liferay.portal.search.elasticsearch6.xpack.security.impl”, \
“Liferay Connector to X-Pack Security [Elastic Stack 6.x] – Impl” \
]
9) Now clear servers temp, work, osgi/state folders and restart the server (A best practise step,not documented anywhere).
10) Start the server and reindex all searches.
11) create a directory named elasticsearch in /var/lib/ & /var/log/ folder and assign elasticsearch user permission to those directories.
12) Go to /home/elasticsearch/elasticsearch7.6.2/config/elasticsearch.yml file and enter following details.
node.name-anyname,host-127.0.0.1,port-9200
13) Go to /home/elasticsearch/elasticsearch7.6.2/bin and install following plugins using command sudo ./elasticsearch-plugin install <>.
analysis-icu,analysis-kuromoji,analysis-smartcn,analysis-stempel
14) Kill all java processes, if running.
15) Start elasticsearch by going to /home/elasticsearch/elasticsearch7.6.2/bin and using command ./elasticsearch -d
16) Go to Liferay server osgi/config folder create a file named com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
Enter the following details in this file.
additionalConfigurations=””
additionalIndexConfigurations=””
additionalTypeMappings=””
bootstrapMlockAll=”false”
clientTransportIgnoreClusterName=”false”
clientTransportNodesSamplerInterval=””
clientTransportPingTimeout=””
clientTransportSniff=”true”
clusterName=”LiferayElasticsearchCluster”
discoveryZenPingUnicastHostsPort=”9300-9400″
httpCORSAllowOrigin=”/https?://localhost(:[0-9]+)?/”
httpCORSConfigurations=””
httpCORSEnabled=”true”
httpEnabled=”true”
indexNamePrefix=”liferay-”
indexNumberOfReplicas=””
indexNumberOfShards=””
logExceptionsOnly=”true”
networkBindHost=””
networkHost=””
networkPublishHost=””
operationMode=”REMOTE”
overrideTypeMappings=””
retryOnConflict=”5″
transportAddresses = [ \
“localhost:9300″, \
]
transportTcpPort=””
17) Restart the server and go to search and do reindex all, reindex spell.
That will ensure that the Liferay DXP is running with remote Elasticsearch.
Tridhya Tech is a prominent Liferay development company. We provide customized, robust, and cost-effective content management solutions using the Liferay DXP version to our enterprise clients. Apart from Liferay DXP portal development services and upgrades, we also offer consultancy, support, and maintenance services.
#CTA-1#