Transfer SOLR ConfigSet to new cluster

11/15/2018

I am currently running a cloud SOLR6 service in Kubernetes 3 Zookeeper servers and 6 nodes

I recently deployed a new cloud SOLR6 service for dev purposes, but it requires the same schema structures as the current running environment, the data isn't important as I will repopulate that manually

How can i replicate only the structure/schema of the collections running in the current setup

-- Illegal Operator
apache-zookeeper
google-kubernetes-engine
solr6

1 Answer

11/20/2018

This is how ended up doing this, I am sure there is a more efficient way to do it , but this worked.

  1. Log into the source solr pod

    kubectl -it exec {{ sourcePodName }} -c {{ containerName }} bash

    eg: kubectl -it exec solr-staging-0 -c solr bash

  2. Create a dump of the configSet

    /opt/solr/bin/solr zk -n {{ configSetName }} -d /tmp/{{ configSetName }}/ -z {{ sourceZookeeperAddress }}:{{ zookeeperPort }}

    eg: /opt/solr/bin/solr zk -n connectors -d /tmp/connectors/ -z solr-dev.solr-staging-cluster:2181

  3. Retrieve the dump from the kubernetes pod by copying it to your local

    kubectl cp {{ sourcePodName }}:/tmp/{{ configSetName }}/* /tmp/{{ configSetName }}

    eg: kubectl cp solr-staging-0:/tmp/connectors/* /tmp/connectors

  4. Create a zip file of the conf content

    zip -r /tmp/{{ configSetName }}/con/conf/* /tmp/{{ configSetName }}.zip

    eg: zip -r /tmp/connectors/con/conf/* /tmp/connectors.zip

  5. Port forward to your destination kubernetes server

    gcloud container clusters get-credentials {{ clusterName }} --zone {{ zone }} --project {{ projectName }} && kubectl port-forward {{ podName }} 8983:8983

    eg: gcloud container clusters get-credentials workflows --zone europe-west1-d --project bidvest-alice && kubectl port-forward solr-dev-0 8983:8983

  6. Import your dataset on your destination solr cluster

    NOTE: This is actually the SOLR 7.7 import statement, but the SOLR6.6 command didn't work

    curl -X POST --header "Content-Type:application/octet-stream" --data-binary @/tmp/{{ configSetName }}.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name={{ configSetName }}"

    eg: cmd: curl -X POST --header "Content-Type:application/octet-stream" --data-binary @/tmp/connectors.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=connectors"

-- Illegal Operator
Source: StackOverflow