W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
/admin/collections?action=SPLITSHARD&collection=name&shard=shardID
分割碎片將使用現(xiàn)有的碎片并將其拆分成兩個碎片,這些碎片作為兩個(新的)碎片寫入磁盤。原始碎片將繼續(xù)包含相同的數(shù)據(jù),但是會啟動將請求重新路由到新的碎片。新的碎片將具有與原始碎片一樣多的副本。分割碎片后自動發(fā)出軟提交,以便文檔在子分片上可見。在分割操作之后,顯式提交(hard 或者 soft)不是必需的,因為索引在分割操作期間會自動保留到磁盤。
這個命令允許無縫拆分,不需要停機。被拆分的碎片將繼續(xù)接受查詢和索引請求,并且一旦完成該操作,將自動開始將請求路由到新的碎片。此命令只能用于使用numShards參數(shù)創(chuàng)建的SolrCloud集合,這意味著依賴于Solr的基于哈希的路由機制的集合。
分割是通過將原始分片的哈希范圍劃分為兩個相等的分區(qū),并根據(jù)新的子分區(qū)來劃分原始碎片中的文檔。下面討論的兩個參數(shù):ranges和split.key提供對分割的方式的進一步控制。
碎片分割可能是一個漫長的過程。為了避免超時,你應該將其作為異步調(diào)用運行。
包含要分割的碎片的集合的名稱。該參數(shù)是必需的。
要分割的碎片的名稱。未指定split.key
時需要此參數(shù)。
用十六進制表示哈希范圍的逗號分隔列表,如ranges=0-1f4,1f5-3e8,3e9-5dc
。
此參數(shù)可用于將原始分片的哈希范圍劃分為以十六進制指定的任意哈希范圍區(qū)間。例如,如果原始哈希范圍0-1500
然后添加參數(shù):ranges=0-1f4,1f5-3e8,3e9-5dc
將原始碎片分成三個碎片,分別為哈希范圍0-500
,501-1000
和1001-1500
。
用于分割索引的關鍵。
此參數(shù)可用于使用路由密鑰分割碎片,以使指定的路由密鑰的所有文檔都在一個專用的子分片中結束。在這種情況下不需要提供shard
參數(shù),因為路由密鑰足以找出正確的分片。不支持跨越多個分片的路由密鑰。
例如,假設split.key=A!
哈希到該范圍,12-15
并且屬于帶范圍0-20
的分片“shard1”。分割經(jīng)此路由密鑰將產(chǎn)生三個子碎片與范圍0-11
,12-15
以及16-20
。請注意,具有路由密鑰哈希范圍的子分片也可能包含哈希范圍重疊的其他路由密鑰的文檔。
將核心屬性name設置為value。有關受支持的屬性和值的詳細信息,請參閱定義core.properties一節(jié)。
輸出將包括請求的狀態(tài)和新的分片名稱,它們將使用原始碎片作為基礎,添加一個下劃線和一個數(shù)字。例如,“shard1”將變成“shard1_0”和“shard1_1”。如果狀態(tài)不是“success”,則會顯示錯誤消息,說明請求失敗的原因。
輸入:
拆分“anotherCollection”集合的shard1。
http://localhost:8983/solr/admin/collections?action=SPLITSHARD&collection=anotherCollection&shard=shard1
輸出:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">6120</int>
</lst>
<lst name="success">
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3673</int>
</lst>
<str name="core">anotherCollection_shard1_1_replica1</str>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3681</int>
</lst>
<str name="core">anotherCollection_shard1_0_replica1</str>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">6008</int>
</lst>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">6007</int>
</lst>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">71</int>
</lst>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<str name="core">anotherCollection_shard1_1_replica1</str>
<str name="status">EMPTY_BUFFER</str>
</lst>
<lst>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<str name="core">anotherCollection_shard1_0_replica1</str>
<str name="status">EMPTY_BUFFER</str>
</lst>
</lst>
</response>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: