# Solr Integration
Solr is an enterprise search platform with full-text search, real-time indexing, dynamic clustering, database integration, and rich document handling. Solr can be integrated into applications built on Entando and is required for multitenant architecture.
This tutorial describes the installation steps for Solr integration, including the generation of the core collection which consists of the index and configuration files. For multitenant applications, a core collection must be generated for the primary or first tenant, and each of the secondary tenants.
# Prerequisites
- A working instance of Entando based on the default Tomcat server image
- Verify dependencies with the Entando CLI:
ent check-env develop
- Helm (opens new window) to handle the Solr installation
# Install and Configure Solr
- Install Solr Helm charts:
helm repo add apache-solr https://solr.apache.org/charts
helm repo update
- Install the Solr and Zookeeper CRDs.
Note: Creating the CRDs and installing the operators are done at the cluster level and will require cluster-level permissions.
kubectl create -f https://solr.apache.org/operator/downloads/crds/v0.5.0/all-with-dependencies.yaml
- Install the Solr and Zookeeper operators:
helm install solr-operator apache-solr/solr-operator --version 0.5.0
- Download the template
entando-solrCloud.yaml
. Adjust the resource settings such as memory, CPU, storage, or replicas using this file.
curl -sLO "https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/samples/entando-solrCloud.yaml"
- Create the Solr application resources:
kubectl apply -f entando-solrCloud.yaml -n YOUR-NAMESPACE
- Check that the service started properly:
kubectl get solrclouds -w
You should see a response similar to this:
NAME VERSION TARGETVERSION DESIREDNODES NODES READYNODES UPTODATENODES AGE
solr 8 3 3 3 3 79m
# Generate the Core
- Set up port forwarding to the Solr common service:
kubectl port-forward service/solr-solrcloud-common 8983:80
Note: kubectl port-forward
should be left running.
- Open another terminal and call the Solr API to generate the Solr core collection.
Note: the first core (the primary tenant in a multitenant environment, or the only core in a single tenant environment) must useYOUR-TENANT-NAME
="entando" for the collection name below.
Placeholder | Description |
---|---|
YOUR-TENANT-NAME | The identifying name of the current tenant. In most cases, it will also be used to determine the base URL of the tenant. For example, yoursite results in yoursite.your-domain.com. |
curl "http://localhost:8983/solr/admin/collections?action=CREATE&name=YOUR-TENANT-NAME&numShards=1&replicationFactor=3&maxShardsPerNode=2"
The number of shards and shards per node should be adjusted for very large quantities of content, such as 50k or more. In such cases, adjustments to replicas and other resources may be needed.
# Configure the EntandoApp Deployment
- Scale down the EntandoApp deployment to 0:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=0 -n YOUR-NAMESPACE
- Edit the deployment and add the following environment variables:
spec:
containers:
- env:
- name: SOLR_ACTIVE
value: "true"
- name: SOLR_ADDRESS
value: http://solr-solrcloud-common/solr
- Scale the
entando-de-app
deployment back up to 1 or more deployments:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=1 -n YOUR-NAMESPACE
# Generate the Solr Schema
When a new core is added to Solr, its schema also needs to be generated. This is done automatically for the first or primary collection. But for secondary collections, it must be triggered manually by clicking
Refresh
next to each content type underApp Builder
→Content
→Solr Configuration
.Reindex the content using
App Builder
→Content
→Settings
→Reload the indexes
.Confirm Solr is configured and the index is working correctly by using the
Search Form
widget to confirm Content items can be found via search. This widget is automatically placed in the header of a page created via the Welcome Wizard. For example, searching forplatform
should return at least one result with the default content set.
# Options
# Direct Access to Solr Configuration
The Solr configuration page can be accessed directly from the Content
menu list in the App Builder. The configuration page allows you to monitor and update the schema and reload the indexes for each searchable type.
To enable this option, set the environment variable advancedSearch
specification to true
in the EntandoApp deployment YAML.
Resources
- Go to the Solr Operator (opens new window) resource page for additional information.
- See the Solr Getting Started page (opens new window) for more information.