W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
ConfigSets API使您可以創(chuàng)建、刪除和以其他方式管理ConfigSets。
要將使用此API創(chuàng)建的ConfigSet用作集合的配置,請(qǐng)使用Collections API。
此API只能與在SolrCloud模式下運(yùn)行的Solr一起使用。如果您沒(méi)有在SolrCloud模式下運(yùn)行Solr,但仍希望使用共享配置,請(qǐng)參閱配置集。
所有API調(diào)用的基本URL是http://<hostname>:<port>/solr。
/admin/configs?action=CREATE&name=name&baseConfigSet=baseConfigSet
根據(jù)現(xiàn)有的ConfigSet創(chuàng)建一個(gè)ConfigSet。
創(chuàng)建ConfigSet時(shí)支持以下參數(shù)。
要?jiǎng)?chuàng)建的ConfigSet。該參數(shù)是必需的。
將ConfigSet復(fù)制為基礎(chǔ)。該參數(shù)是必需的。
從基地的任何ConfigSet屬性覆蓋。
ConfigSet響應(yīng)將包括請(qǐng)求的狀態(tài)。如果狀態(tài)不是“success”,則會(huì)顯示錯(cuò)誤消息,說(shuō)明請(qǐng)求失敗的原因。
配置集示例的輸入
創(chuàng)建一個(gè)名為'myConfigSet'的ConfigSet,它基于'predefinedTemplate'ConfigSet,將不可變屬性重寫(xiě)為false。
http://localhost:8983/solr/admin/configs?action=CREATE&name=myConfigSet&baseConfigSet=predefinedTemplate&configSetProp.immutable=false
該配置集的輸出
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">323</int>
</lst>
</response>
/admin/configs?action=DELETE&name=name
刪除配置集
要?jiǎng)h除的ConfigSet。該參數(shù)是必需的。
輸出將包含請(qǐng)求的狀態(tài)。如果狀態(tài)不是“success”,則會(huì)顯示錯(cuò)誤消息,說(shuō)明請(qǐng)求失敗的原因。
輸入如下:
刪除配置集'myConfigSet'
http://localhost:8983/solr/admin/configs?action=DELETE&name=myConfigSet
輸出如下:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">170</int>
</lst>
</response>
/admin/configs?action=LIST
獲取群集中ConfigSet的名稱(chēng)。
輸入如下:
http://localhost:8983/solr/admin/configs?action=LIST
得到輸出:
{
"responseHeader":{
"status":0,
"QTime":203},
"configSets":["myConfigSet1",
"myConfig2"]}
/admin/configs?action=UPLOAD&name=name
上傳一個(gè)ConfigSet,作為一個(gè)壓縮文件發(fā)送。請(qǐng)注意,如果啟用了身份驗(yàn)證,并且該上傳操作作為已驗(yàn)證的請(qǐng)求執(zhí)行,則會(huì)以“trusted”模式上傳ConfigSet。沒(méi)有身份驗(yàn)證,ConfigSet以“untrusted”模式上傳。使用“untrusted”的ConfigSet創(chuàng)建集合時(shí),以下功能將不起作用:
上傳完成后要?jiǎng)?chuàng)建的ConfigSet。該參數(shù)是必需的。
請(qǐng)求的主體應(yīng)該包含一個(gè)壓縮配置集。
輸出將包含請(qǐng)求的狀態(tài)。如果狀態(tài)不是“success”,則會(huì)顯示錯(cuò)誤消息,說(shuō)明請(qǐng)求失敗的原因。
從壓縮文件myconfigset.zip創(chuàng)建一個(gè)名為“myConfigSet”的配置集。該壓縮文件必須從conf目錄中創(chuàng)建(即solrconfig.xml必須是zip文件中的頂層條目)。這里是一個(gè)關(guān)于如何創(chuàng)建zip文件并上傳的例子。
$ (cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip
$ curl -X POST --header "Content-Type:application/octet-stream" --data-binary @myconfigset.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet"
使用unix管道可以實(shí)現(xiàn)同樣的效果,不需要?jiǎng)?chuàng)建一個(gè)中間的zip文件,如下所示:
$ (cd server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) | curl -X POST --header "Content-Type:application/octet-stream" --data-binary @- "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet"
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: