Pergunta

I have a solr setup with two cores. I want to schedule a core(core1, backend) for full import frequently(e.g. after every 5 mins), then swap with the live(core0, serving) core from shell command through a shceduler.

For full-import command, I am using following shell command

wget -o - -q -t 1 http://localhost:8080/solr/core1/dataimport?command=full-import

Which works fine. If I do a core swap from browser by hitting
http://localhost:8080/solr/admin/cores?action=SWAP&core=core1&other=core0, I get latest update instantly on search. But if I schedule this URL as shell command similar to dataimport, it doesn't do that swap.

Foi útil?

Solução

Did you try with

curl "http://'localhost':8080/solr/admin/cores?action=SWAP&core=core1&other=core0"

from shell?

Outras dicas

There is catch with the SWAPs

Apache Solr allows to swap two cores around for non-Cloud configurations. They take each other’s name, so it is a good way to push an updated core into a production without downtime.

But an interesting question is how this is achieved. Normally, core name is it’s directory name too. So, does Solr rename the directory on the filesystem too?

Not really! Instead name property in the core.properties file is updated to use the name of the other core. Usually that property is used to give an alternave name of the core for when the directory naming conventions are not suitable.

The gotcha is - of course - that you still have two directories with right looking names for the cores you see in the Admin UI. So, it is very easy to forget that extra redirection/rename step when troubleshooting somebody else’s - or even your own old - setup.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top