forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Zheng, Xiu <zhengxiu@huawei.com> Co-committed-by: Zheng, Xiu <zhengxiu@huawei.com>
24 lines
4.9 KiB
HTML
24 lines
4.9 KiB
HTML
<a name="css_02_0042"></a><a name="css_02_0042"></a>
|
|
|
|
<h1 class="topictitle1">Why All New Index Shards Are Allocated to the Same Node?</h1>
|
|
<div id="body0000001334522305"><div class="section" id="css_02_0042__en-us_topic_0000001309220781_section537618596183"><h4 class="sectiontitle">Possible Cause</h4><p id="css_02_0042__en-us_topic_0000001309220781_p135231885413">The possible causes are as follows:</p>
|
|
<ul id="css_02_0042__en-us_topic_0000001309220781_ul145017314611"><li id="css_02_0042__en-us_topic_0000001309220781_li178351452114018">Shards were unevenly distributed in previous index allocations, and the predominate parameter in the latest indexed shard allocation was <strong id="css_02_0042__b18852150201116">balance.shard</strong>. To balance the shard distribution across nodes, the new shards were allocated to the node with only a small number of shards.</li><li id="css_02_0042__en-us_topic_0000001309220781_li154541431679">After a new node was added to a cluster and before the automatic cluster rebalancing completes, the predominate parameter was <strong id="css_02_0042__b893825682810">balance.shard</strong>. The shards of a new index are allocated to the new node, where there are no shards yet.</li></ul>
|
|
<p id="css_02_0042__en-us_topic_0000001309220781_p152131543133017">The following two parameters are used to balance the shard allocation in a cluster:</p>
|
|
<p id="css_02_0042__en-us_topic_0000001309220781_p1121394333018">cluster.routing.allocation.balance.index (default value: <strong id="css_02_0042__b7211946142212">0.45f</strong>)</p>
|
|
<p id="css_02_0042__en-us_topic_0000001309220781_p821364363011">cluster.routing.allocation.balance.shard (default value: <strong id="css_02_0042__b2843145615223">0.55f</strong>)</p>
|
|
<div class="note" id="css_02_0042__en-us_topic_0000001309220781_note112971351183011"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="css_02_0042__en-us_topic_0000001309220781_ul1166265513012"><li id="css_02_0042__en-us_topic_0000001309220781_li126141519133116"><strong id="css_02_0042__b2023918823518">balance.index</strong>: A larger value indicates that all the shards of an index are more evenly distributed across nodes. For example, if an index has six shards and there are three data nodes, two shards will be distributed on each node.</li><li id="css_02_0042__en-us_topic_0000001309220781_li1066325513015"><strong id="css_02_0042__b83681426133511">balance.shard</strong>: A larger value indicates that all the shards of all the indexes are more evenly distributed across nodes. For example, if index <strong id="css_02_0042__b014503419312">a</strong> has two shards, index <strong id="css_02_0042__b79281437123111">b</strong> has four, and there are three data nodes, two shards will be distributed on each node.</li><li id="css_02_0042__en-us_topic_0000001309220781_li19521427163116">You can specify both <strong id="css_02_0042__b7291113416358">balance.index</strong> and <strong id="css_02_0042__b68311336143512">balance.shard</strong> to balance the shard allocation.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="css_02_0042__en-us_topic_0000001309220781_section13523178643"><h4 class="sectiontitle">Solution</h4><p id="css_02_0042__en-us_topic_0000001309220781_p1867515413325">To prevent the all the shards of an index from being allocated to a single node, use either of the following methods:</p>
|
|
<ol id="css_02_0042__en-us_topic_0000001309220781_ol1474444613448"><li id="css_02_0042__en-us_topic_0000001309220781_li47441946134420">To create an index during cluster scale-out, configure the following parameter:<pre class="screen" id="css_02_0042__screen14985171018461">"index.routing.allocation.total_shards_per_node": <em id="css_02_0042__i119851610144619">2</em></pre>
|
|
<p id="css_02_0042__p1486511114617">That is, allow no more than two shards of an index to be allocated on each node. Determine the maximum number of shards allocated to each node based on the number of data nodes in your cluster and the number of index shards (both primary and secondary).</p>
|
|
</li></ol><ol start="2" id="css_02_0042__en-us_topic_0000001309220781_ol146919904514"><li id="css_02_0042__en-us_topic_0000001309220781_li76913934512">If too many shards are distributed on only a few nodes, you can move some of the shards to other nodes to balance the distribution. Run the <strong id="css_02_0042__b1282315309377">move</strong> command of <strong id="css_02_0042__b8645173433716">POST _cluster/reroute</strong>. The rebalance module will automatically exchange the shard with a shard on the destination node. Determine the values of <strong id="css_02_0042__b143363131793">balance.index</strong> and <strong id="css_02_0042__b1968051713920">balance.shard</strong> as needed.</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_02_0055.html">Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|