You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Jonathan Tan <jt...@gmail.com> on 2021/12/22 14:36:34 UTC

How to update solr.xml in kubernetes stateful set?

Hi!

I'm using the bitnami SOLR helm chart (
https://github.com/bitnami/bitnami-docker-solr), and using it to deploy a
Solr Cloud cluster.

I'm trying to figure out how to update the solr.xml file.
I'm aware of the `bin/solr` utility that can be used to update the file,
but I'm not sure if that's a particularly "container"/IaC approach, as now
I'm manually modifying the state of the cluster, rather than let it be an
automated/pre-canned process.

The main thing that's come to mind is:
- have an initContainer with a custom script, and a solr image that has the
modified solr.xml file baked into it
- the custom script checks SOLR for when the existing solr.xml file was
last modified (I've got no idea how to do this)
- if the last modified of the solr.xml file in ZK is older than the one in
the initContainer's custom script, then run the `bin/solr zk cp` function,
otherwise, just proceed.

*however*
I'm wondering if there are other approaches, and was hoping for some
voices-of-experience.

Thank you!
Jonathan

Re: How to update solr.xml in kubernetes stateful set?

Posted by Jonathan Tan <jt...@gmail.com>.
Hi and thank you for the suggestion.

We did briefly look at it, but were not intending to do it *yet*. We might
now if this becomes the most straightforward way to do it.


On Thu, Dec 23, 2021 at 2:37 AM Timothy Potter <th...@gmail.com> wrote:

> I think it would be great if you could switch to using the Solr
> operator. It supports loading a custom solr.xml from a ConfigMap (and
> restarting Solr pods if the ConfigMap changes). The operator provides
> a common approach for running Solr on Kubernetes and is maintained by
> Solr committers. If you can't migrate, then I'd use an initContainer
> to prep the custom solr.xml for the main container.
>
> Cheers,
> Tim
>
> On Wed, Dec 22, 2021 at 7:37 AM Jonathan Tan <jt...@gmail.com> wrote:
> >
> > Hi!
> >
> > I'm using the bitnami SOLR helm chart (
> > https://github.com/bitnami/bitnami-docker-solr), and using it to deploy
> a
> > Solr Cloud cluster.
> >
> > I'm trying to figure out how to update the solr.xml file.
> > I'm aware of the `bin/solr` utility that can be used to update the file,
> > but I'm not sure if that's a particularly "container"/IaC approach, as
> now
> > I'm manually modifying the state of the cluster, rather than let it be an
> > automated/pre-canned process.
> >
> > The main thing that's come to mind is:
> > - have an initContainer with a custom script, and a solr image that has
> the
> > modified solr.xml file baked into it
> > - the custom script checks SOLR for when the existing solr.xml file was
> > last modified (I've got no idea how to do this)
> > - if the last modified of the solr.xml file in ZK is older than the one
> in
> > the initContainer's custom script, then run the `bin/solr zk cp`
> function,
> > otherwise, just proceed.
> >
> > *however*
> > I'm wondering if there are other approaches, and was hoping for some
> > voices-of-experience.
> >
> > Thank you!
> > Jonathan
>

Re: How to update solr.xml in kubernetes stateful set?

Posted by Timothy Potter <th...@gmail.com>.
I think it would be great if you could switch to using the Solr
operator. It supports loading a custom solr.xml from a ConfigMap (and
restarting Solr pods if the ConfigMap changes). The operator provides
a common approach for running Solr on Kubernetes and is maintained by
Solr committers. If you can't migrate, then I'd use an initContainer
to prep the custom solr.xml for the main container.

Cheers,
Tim

On Wed, Dec 22, 2021 at 7:37 AM Jonathan Tan <jt...@gmail.com> wrote:
>
> Hi!
>
> I'm using the bitnami SOLR helm chart (
> https://github.com/bitnami/bitnami-docker-solr), and using it to deploy a
> Solr Cloud cluster.
>
> I'm trying to figure out how to update the solr.xml file.
> I'm aware of the `bin/solr` utility that can be used to update the file,
> but I'm not sure if that's a particularly "container"/IaC approach, as now
> I'm manually modifying the state of the cluster, rather than let it be an
> automated/pre-canned process.
>
> The main thing that's come to mind is:
> - have an initContainer with a custom script, and a solr image that has the
> modified solr.xml file baked into it
> - the custom script checks SOLR for when the existing solr.xml file was
> last modified (I've got no idea how to do this)
> - if the last modified of the solr.xml file in ZK is older than the one in
> the initContainer's custom script, then run the `bin/solr zk cp` function,
> otherwise, just proceed.
>
> *however*
> I'm wondering if there are other approaches, and was hoping for some
> voices-of-experience.
>
> Thank you!
> Jonathan

Re: How to update solr.xml in kubernetes stateful set?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/22/2021 5:42 PM, Jonathan Tan wrote:
> That's what that `bin/solr zk cp` function does right? It copies the
> `solr.xml` file into the chroot so that all other solr nodes will get it?

Yes.  Copying solr.xml to zookeeper is described in the documentation:

https://solr.apache.org/guide/8_11/using-zookeeper-to-manage-configuration-files.html#preparing-zookeeper-before-first-cluster-start

Thanks,
Shawn

Re: How to update solr.xml in kubernetes stateful set?

Posted by Jonathan Tan <jt...@gmail.com>.
Hi Shawn!

That's what that `bin/solr zk cp` function does right? It copies the
`solr.xml` file into the chroot so that all other solr nodes will get it?

But yes, the main thing is that I want to add the trace
configuration setting to it, hence I would want it to be consistent
everywhere.



On Thu, Dec 23, 2021 at 3:45 AM Shawn Heisey <ap...@elyograg.org> wrote:

> On 12/22/21 7:36 AM, Jonathan Tan wrote:
> > I'm using the bitnami SOLR helm chart (
> > https://github.com/bitnami/bitnami-docker-solr), and using it to deploy
> a
> > Solr Cloud cluster.
> >
> > I'm trying to figure out how to update the solr.xml file.
>
> Is the solr.xml file identical on every server?  If it is, SolrCloud
> lets you put the solr.xml file at the root of your zookeeper chroot.  If
> that exists, any solr.xml file on the disk is completely ignored.  Note
> that using system properties in solr.xml is one way to have an identical
> file on each server, with differences placed into system properties
> defined in /etc/default/solr.in.sh.
>
> Thanks,
> Shawn
>
>

Re: How to update solr.xml in kubernetes stateful set?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/22/21 7:36 AM, Jonathan Tan wrote:
> I'm using the bitnami SOLR helm chart (
> https://github.com/bitnami/bitnami-docker-solr), and using it to deploy a
> Solr Cloud cluster.
>
> I'm trying to figure out how to update the solr.xml file.

Is the solr.xml file identical on every server?  If it is, SolrCloud 
lets you put the solr.xml file at the root of your zookeeper chroot.  If 
that exists, any solr.xml file on the disk is completely ignored.  Note 
that using system properties in solr.xml is one way to have an identical 
file on each server, with differences placed into system properties 
defined in /etc/default/solr.in.sh.

Thanks,
Shawn