How to install a standalone Solr server in SAP Hybris?

In this post, you will learn how to install and configure a standalone Solr server in a way that can be used in SAP Hybris Commerce.

Prerequestion

  • solrserver extension should be there in your localextensions.xml file

Hybris OOTB Solr configuration background

The default configuration is as follows:
solrserver.instances.default.autostart=true
solrserver.instances.default.mode=standalone
solrserver.instances.default.hostname=localhost
solrserver.instances.default.port=8983
solrserver.instances.default.memory=512m
Here, you can see autostart=true which tell Solr server to start and stop together with the Hybris platform. In another word, we can say default configuration ensures that a standalone Solr server is configured, started and stopped together with the platform.

Setup external Standalone Server

As we have seen, OOTB (post hybris v5.5) solr server is already configured as standalone server mode=standalone. It means, solr setup is already present in Hybris suite which we can use or download and setup our own solr server. Now, the only thing we want is to start/stop it independently from Hybris instance. To do so we need disables the autostart for the default Solr instance using below properties.
solrserver.instances.default.autostart=false

solrserver.instances.standalone.autostart=true
solrserver.instances.standalone.mode=standalone
solrserver.instances.standalone.hostname=localhost
solrserver.instances.standalone.port=8983
solrserver.instances.standalone.memory=512m

How to start/stop solr server

If you want to use Hybris provided solr server setup, then you can simply use ant commands to start and stop solr server
ant startSolrServer
ant stopSolrServer
Hybris OOTB, you can find solr setup at hybris/bin/ext-commerce/solrserver/resources/solr/. You can also run solr script manually as mentioned below.
If you have your own solr server setup, then go to the bin directory
Make sure you have the executable right to the Solr file, In Linux system, you might need to give the executable right (chmod +x solr)
Start the solr server
./solr start -p 8983    #Linux systems
solr.cmd start -p 8983  #Window system
Stop the solr server
./solr stop -p 8983    #Linux systems
solr.cmd stop -p 8983  #Window system


Other Solr Server Ant Tasks


Task NameDescriptionParameters
createSolrInstanceCreates a Solr instance.allowed parameters:
  • -Dinstance.name
deleteSolrInstanceDeletes a Solr instance. This means deleting all the configuration, data and log files.allowed parameters:
  • -Dinstance.name
uploadSolrConfigUploads configuration to a ZooKeeper instance.allowed parameters:
  • -Dinstance.name
startSolrServerStarts the Solr server.allowed parameters:
  • -Dinstance.name
startSolrServersStarts all Solr servers that have autostart set to true.

stopSolrServerStops the Solr server.allowed parameters:
  • -Dinstance.name
stopSolrServersStops all Solr servers that have autostart set to true.

configureSolrServerApplies the SAP Commerce customizations on an official Solr release.allowed parameters:
  • -DsolrServerPath

Solr default credential

Author Image

Ankitkumar Patel

Sr. SAP Hybris consultant, having 15+ years experience in SAP Commerce Cloud (Hybris), SAP Spartacus. Extensive experience in SAP Hybris development, third-party integrations, project architecture and design... Read more

Comments

Post a Comment

Popular posts from this blog

Hybris flexible search query examples

How to Install temporary Hybris license?

How to remove or update all data records in Hybris?