Persisting search index data to a Gluster file system
Learn how to use Kubernetes and GlusterFS to deploy HCL Commerce with a persistent volume for the search index.
Before you begin
- Ensure that you have HCL Commerce running on Kubernetes. This sample tutorial does not cover how to deploy HCL Commerce on Kubernetes. For more information, see Deploying HCL Commerce Version 9 on Kubernetes.
- Ensure that you are using a CentOS or RedHat Linux distribution. The procedure in this sample tutorial is based on CentOS Linux. Modify any code as needed to fit your distribution.
About this task
By default, when you build the search index in your HCL Commerce Version 9 runtime environment, the indexed files are stored in the Search server Docker container. This poses an issue. If the search container is removed, for example when you upgrade your environment, then all the existing data in the container is lost. You will need to rebuild the search index to restore your store’s full functionality. To avoid having to rebuild the index, you can persist the indexed files to a network file system. There are many different ways you can set up a network file system, but this sample tutorial will use the following tools:
A) GlusterFS: An open source scalable network filesystem. It can create various types of volumes, such as distributed, replicated, distributed replicated, dispersed, and distributed dispersed.
B) Heketi: a provisioning tool that you can use to manage the lifecycle of GlusterFS volumes through RESTful APIs.
C) Kubernetes: provides two API resources to manage storage for persisting data: PersistentVolume (PV) and PersistentVolumeClaim (PVC).
– PersistentVolume is a piece of storage in the cluster, which has a lifecycle independent of any individual pod.
– PersistentVolumeClaim is a request for storage, which consumes PV resources.
Kubernetes supports two methods for provisioning a PV: Static and dynamic. In the static method, the PersistentVolume will be created in advance. In the dynamic method, the PersistentVolume is created based on the PVC’s requirement. In this sample, you will learn how to integrate Gluster storage for Kubernetes with Heteki to deploy HCL Commerce with a persistent volume to a network file system.
Procedure
Update Kubernetes environment
Results
- Build the search index for your store. Perform these steps only when all containers are ready to use. For more information, see Deploying HCL Commerce Version 9 on Kubernetes.
- Visit the store to ensure that everything displays as expected.
- Delete the deployment.
helm delete --purge <chartName>
- Redeploy the HCL Commerce environment (without creating a persistent volume claim).
helm install <newChart>
- Visit the store again. Everything should display as expected without needing to rebuild the search index. If you do not see categories or products, then the search index was not persisted. Review the steps to ensure that you completed everything.