Tuesday, July 27, 2021

Configure Remote Elasticsearch Cluster in Liferay Cluster

Liferay 7.x is using Elasticsearch and it’s embedded in the bundle. When we start Liferay then embedded elastic instance also will start.



Development environments, this embedded search is ok but for production environments we must need external Elasticsearch cluster.

 


If we are building Liferay cluster then all instances should connect with same Elasticsearch cluster. So, we must have some external/remote Elasticsearch.

 


This Article Demonstrate configure the remote Elasticsearch in Liferay.

 


From Liferay DXP 7.3 and CE 7.3 GA4+ Elasticsearch connector is included in the bundle and previous versions are required Elasticsearch Connector which is available in Liferay Market Place.

 


This Demonstration is using Liferay 7.4 GA2, So Elastic connector already included in the latest Liferay portal bundle.

 


Software Stack



 

Elasticsearch-7.13.3

Liferay-ce-portal-7.4.1-ga2

 

 

 


 

Following are the steps to configure the External/Remote Elasticsearch for Liferay.

 


  • Install Elastic Cluster
  • Install Liferay Cluster.
  • Configure Elasticsearch in Liferay

 


 

Install Elastic Cluster

 


Follow the below article to install Elasticsearch Cluster

 


http://www.liferaysavvy.com/2021/07/install-elastic-search-cluster.html

 



Install Liferay Cluster

 


Follow the below article to install Liferay Cluster

 


http://www.liferaysavvy.com/2021/07/liferay-portal-apache-webserver.html



 

Configure Elasticsearch in Liferay

 


There is two ways we can configure Elasticsearch in Liferay.

 


  • From Control Panel
  • Using OSGi config file

 


From Control Panel



Login to Liferay Portal as Administrator. Access Liferay Cluster or Any one the node in the cluster.


 

Access direct Liferay node using Host and Port


Example:


 

http://localhost:8090/

 

 


Global Menu --> Control Panel --> Configuration --> System Settings

 




 



 

 

 

 

System Setting --> Click on Search


 



 

 

Provide ElasticSearch7 Configuration as follows.



Step:1

 


Click on Elasticsearch Connections and Provide Connection Id and Cluster Host names. Click + Button to add multiple Elasticsearch hosts in the cluster.

 


 

http://localhost:9200

 

http://localhost:9201

 

http://localhost:9202

 

 

 


 







 

Save the configuration Elasticsearch connection Id will be created. There are many configuration properties available and based on requirement provide required properties.

 

 



 


 

Step: 2



Click on Elasticsearch7 Settings and Enable Production mode and Select Elasticsearch Connection ID that we already created in the previous step. Save the configuration.

 

 




 


Default search index is liferay-* so we can see in the Elasticsearch that the indexes will be created.


Use below URL to confirm that indexes are created.



 

http://localhost:9200/_cat/indices?v

 

 






Elasticsearch connector configuration is stored in Database So these settings available for all Liferay Nodes in the cluster.

 


Just restart all Liferay Nodes in the cluster so that all Liferay Nodes will be connecting to Remote Elasticsearch cluster and indexes will be created in the Elasticsearch cluster. We can also use Reindex control panel feature to index all search values in Elasticsearch cluster.

 


 

Using OSGi config file

 



We can also use OSGi configuration file option to connect Liferay cluster with Remote Elasticsearch.


Create following configuration files and place in “osgi/config” directory in each Liferay instance.

 

 

Create “com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConnectionConfiguration.config” file and add following properties

 


 

 

active="true"

authenticationEnabled="false"

connectionId="RemoteElasticSearchCluster"

httpSSLEnabled="false"

networkHostAddresses=[ \

  "http://localhost:9200", \

  "http://localhost:9201", \

  "http://localhost:9202", \

  ]

proxyHost=""

proxyPort="0"

proxyUserName=""

truststorePath="/path/to/localhost.p12"

truststoreType="pkcs12"

username="elastic"

 

 

 

 






 


Create “com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config” file and add following properties.


 

additionalConfigurations=""

additionalIndexConfigurations=""

additionalTypeMappings=""

authenticationEnabled="false"

bootstrapMlockAll="false"

clusterName="LiferayElasticsearchCluster"

discoveryZenPingUnicastHostsPort="9300-9400"

embeddedHttpPort="9201"

httpCORSAllowOrigin="/https?:\\/\\/localhost(:[0-9]+)?/"

httpCORSConfigurations=""

httpCORSEnabled="true"

httpSSLEnabled="false"

indexNamePrefix="liferay-"

indexNumberOfReplicas=""

indexNumberOfShards=""

logExceptionsOnly="true"

networkBindHost=""

networkHost=""

networkHostAddresses=[ \

  "", \

  ]

networkPublishHost=""

nodeName=""

operationMode="REMOTE"

overrideTypeMappings=""

productionModeEnabled="true"

proxyHost=""

proxyPort="0"

proxyUserName=""

remoteClusterConnectionId="RemoteElasticSearchCluster"

restClientLoggerLevel="ERROR"

sidecarDebug="false"

sidecarDebugSettings="-agentlib:jdwp\=transport\=dt_socket,address\=8001,server\=y,suspend\=y,quiet\=y"

sidecarHeartbeatInterval="10000"

sidecarHome="elasticsearch7"

sidecarHttpPort=""

sidecarJVMOptions=[ \

  "-Xms1g", \

  "-Xmx1g", \

  "-XX:+AlwaysPreTouch", \

  ]

sidecarShutdownTimeout="10000"

trackTotalHits="true"

transportTcpPort=""

truststorePath="/path/to/localhost.p12"

truststoreType="pkcs12"

username="elastic"

 

 

 


 



 

 


Liferay Node1


 



 

Liferay Node2

 




 

 

 

Once place the configuration files in all Liferay Nodes osgi/config location, Restart all Liferay instances.

 

 

 

 

Author

 

 

12 comments :

  1. If the state police you have an interest in have an immediate search program readily available you will get your records polk county mugshots really rapidly, nevertheless instantaneous search is not readily available in all states. The benefit of using a site that utilizes the postponed search method to acquiring records is that they typically offer you more info.

    ReplyDelete
  2. Amazing, I really appreciate this sharing. https://fcbroofing.com/remodeling-baton-rouge/

    ReplyDelete
  3. Tutoring services offer personalized academic support to help students understand difficult subjects and improve their performance. These tutoring services can be provided in person or online, catering to learners of all ages and levels. By focusing on individual learning styles and needs, tutoring helps build confidence and enhances educational outcomes.

    ReplyDelete
  4. Gutter installation is essential for directing rainwater away from a home’s foundation and preventing water damage. Properly installed gutters help protect roofs, walls, and landscaping from erosion and leaks. Professional gutter installation ensures the system is fitted correctly for maximum efficiency. With the right materials and setup, gutters can extend the lifespan of a home while reducing maintenance issues.

    ReplyDelete
  5. Arm Championship Belts are specially crafted belts designed to symbolize victory, achievement, and recognition in sports, competitions, or even fantasy leagues. They are made with durable materials like leather straps and detailed metal plates, giving them a premium and authentic look. Many athletes, fans, and collectors value these belts for their craftsmanship and customization options. Whether used as tournament prizes or display pieces, Arm Championship Belts represent pride, honor, and the spirit of competition.

    ReplyDelete
  6. Setting up a home entertainment system becomes much easier with professional TV installation in Frankfort. Skilled technicians ensure televisions are mounted securely, aligned properly, and positioned for the best viewing angles. Many homeowners appreciate that TV installation in Frankfort also includes neat cable management, giving living spaces a clean and organized look. Technicians can connect additional devices such as sound systems, gaming consoles, or streaming equipment for a seamless setup. By relying on experts, residents avoid the hassle of handling tools and complex wiring on their own. Families and businesses alike benefit from TV installation in Frankfort, whether it’s for a cozy living room or a large conference area. The service not only saves time but also guarantees that the television operates at its full potential. Choosing reliable TV installation in Frankfort provides both convenience and peace of mind for anyone upgrading their entertainment experience.

    ReplyDelete
  7. Visiting cities in Morocco is a journey through diverse landscapes, cultures, and histories. From the bustling energy of Marrakech to the spiritual atmosphere of Fez, each city has its own unique character. Travelers can enjoy the coastal charm of Essaouira, the modern vibe of Casablanca, and the breathtaking blue streets of Chefchaouen. Visiting cities in Morocco also means discovering local traditions, flavorful cuisine, and centuries-old architecture. Every stop offers a new perspective, making the country an unforgettable destination for explorers.

    ReplyDelete
  8. Soft and inviting in appearance, creamy kitchen cabinets create a warm and welcoming atmosphere. Their neutral tone blends seamlessly with a wide range of colors, making them a versatile choice for different design styles. These cabinets brighten up the kitchen while still offering a subtle elegance that feels timeless. They pair beautifully with natural wood accents, stone countertops, or metallic finishes. Creamy kitchen cabinets are perfect for achieving a cozy yet sophisticated look. Their classic appeal ensures they remain stylish through changing design trends.

    ReplyDelete
  9. Baitcasting reels are popular among anglers who want precision and control when fishing. They are especially effective for casting heavier lures and targeting larger fish species. Many fishermen prefer baitcasting reels because they offer longer casts and stronger drag systems. With practice, baitcasting reels can significantly improve accuracy and overall performance. These reels are durable, versatile, and a reliable choice for both freshwater and saltwater fishing.

    ReplyDelete

Recent Posts

Recent Posts Widget

Popular Posts