Search code examples
solrkubernetessolrcloud

Run Solr Control Script in Kubernetes


I have a Kubernetes installation with Zookeeper and Solr 6.0 services correctly installed. We can call solr-node-x any Solr instance. In order to check Solr Health I would like to use the Solr Control Script for HealthChek that normally would be called locally using for instance:

$ bin/solr healthcheck -c gettingstarted -z localhost:9865

How can I run that command against Solr within a Kubernetes deployment?


Solution

  • To avoid having a local instance of bin/solr, you can use the one inside one of your containers.

    Depending on the image you're using, you can call any script in your container by using kubectl exec.

    Usually it's a good idea to start by exploring the layout inside your container by getting a shell:

    kubectl exec -it <name of container> -- /bin/bash
    

    When you have the location of the bin/solr script inside your container you can call it directly:

    kubectl exec -it <name of container> -- /path/to/bin/solr healthcheck -c gettingstarted -z localhost:9865