{"id":5069,"date":"2016-09-16T13:48:16","date_gmt":"2016-09-16T13:48:16","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5069"},"modified":"2016-09-16T13:48:16","modified_gmt":"2016-09-16T13:48:16","slug":"url-unload-reload-solr-core-curl","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/url-unload-reload-solr-core-curl\/","title":{"rendered":"URLs to unload and reload Solr cores via curl"},"content":{"rendered":"<p>It&#8217;s useful to be able to unload and reload Solr cores via curl, so you can deploy new versions of the index through a build process. You can do this<sup><a href=\"#footnote_0_5069\" id=\"identifier_0_5069\" class=\"footnote-link footnote-identifier-link\" title=\"http:\/\/stackoverflow.com\/questions\/21619947\/create-new-cores-in-solr-via-http\">1<\/a><\/sup><sup><a href=\"#footnote_1_5069\" id=\"identifier_1_5069\" class=\"footnote-link footnote-identifier-link\" title=\"http:\/\/stackoverflow.com\/questions\/11540434\/reload-solr-core-with-curl\">2<\/a><\/sup><\/p>\n<pre lang=\"bash\">\ncurl \"http:\/\/localhost:8983\/solr\/admin\/cores?action=UNLOAD&core=talks\"\ncurl \"http:\/\/localhost:8983\/solr\/admin\/cores?action=CREATE&name=talks\"\n<\/pre>\n<p>There is also a &#8220;RELOAD&#8221;, although I&#8217;m not sure how this is useful.<\/p>\n<p>If you unload the core, it unlocks it (otherwise there is a file called index.lock that is left behind, preventing you loading the core).<\/p>\n<p>If you want to copy the core to another machine, you can tar the folder with the core:<\/p>\n<pre lang=\"bash\">\ntar cvf talks\/\n<\/pre>\n<p>If you move this to another machine, you will need to set the permissions to match what your machine was configured with. Solr needs write access to the core, even though you may not allow writes, because it creates the index.lock file when it loads back up.<\/p>\n<pre lang=\"bash\">\ntar xvf talks.tar\nchown -R solr:solr talks\n<\/pre>\n<ol class=\"footnotes\"><li id=\"footnote_0_5069\" class=\"footnote\">http:\/\/stackoverflow.com\/questions\/21619947\/create-new-cores-in-solr-via-http<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_0_5069\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><li id=\"footnote_1_5069\" class=\"footnote\">http:\/\/stackoverflow.com\/questions\/11540434\/reload-solr-core-with-curl<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_1_5069\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>How to unload \/ reload solr cores programmatically<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[517],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5069"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5069"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5069\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}