Search code examples
solr4

how to swap solr core from shell


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.


Solution

  • Did you try with

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

    from shell?