0Pricing
Elasticsearch & Full Text Search Systems · レッスン

シャード割り当てとリバランシング

Elasticsearchがシャードの配置先を決める仕組み、allocation awarenessによってレプリカをハードウェア間に分散する方法、スケーリングやメンテナンス中のリバランシングを制御する方法を理解します。

「シャード割り当てとリバランシング」はCoddyKit上の無料Elasticsearch & Full Text Search Systemsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはElasticsearch & Full Text Search Systems学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Elasticsearch & Full Text Search Systemsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Where Do Shards Go?

When you create an index or add a node, Elasticsearch must decide which node holds each shard. This process is shard allocation, and keeping it balanced is key to a healthy, performant cluster.

The Allocation Process

The master node runs allocation deciders for every unassigned shard. They check disk space, shard count, awareness rules, and filters before placing a shard. Failing any decider keeps the shard UNASSIGNED.

Primary vs Replica Placement

A replica is never allocated to the same node as its primary. This guarantees that losing one node cannot take out both copies of the same data. With one replica you survive any single-node failure.

Watching Allocation

Use the _cat/shards API to see where each shard sits and its state. STARTED means active; RELOCATING means it is moving.

GET _cat/shards?v

Explaining a Stuck Shard

When a shard will not allocate, the _cluster/allocation/explain API tells you exactly which decider blocked it and why. This is the first stop for debugging a yellow or red cluster.

GET _cluster/allocation/explain
{
  "index": "my_index",
  "shard": 0,
  "primary": false
}

Allocation Awareness

Allocation awareness spreads copies across physical boundaries like racks or availability zones. You tag nodes with custom attributes and tell the cluster to be aware of them.

cluster.routing.allocation.awareness.attributes: zone

Forced Awareness

Forced awareness goes further: it refuses to over-allocate replicas to surviving zones if a zone goes down, preventing one zone from holding all copies. This protects capacity planning during outages.

cluster.routing.allocation.awareness.force.zone.values: zone1,zone2

Shard Filtering

You can pin or exclude an index from specific nodes using allocation filters. This is handy for hot/warm architectures where older indices migrate to cheaper hardware.

PUT my_index/_settings
{
  "index.routing.allocation.require.box_type": "warm"
}

Rebalancing

After nodes join or leave, the cluster rebalances to even out shard counts. This is automatic but generates network and disk I/O, so it should be controlled during sensitive operations.

Pausing Allocation

Before a rolling restart, disable allocation so the cluster does not waste effort relocating shards from a node you are about to bring back. Re-enable it afterward.

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": "primaries"
  }
}

Throttling

Limit concurrent recoveries with cluster.routing.allocation.node_concurrent_recoveries and bandwidth with indices.recovery.max_bytes_per_sec to keep rebalancing from starving live queries.

Quick Check

Test your understanding of shard allocation.

Recap

You learned how shards are placed and balanced:

  • Allocation deciders choose shard locations; replicas avoid their primary's node.
  • Debug stuck shards with allocation/explain.
  • Allocation awareness and forced awareness spread copies across zones.
  • Use allocation filters for hot/warm tiers and disable allocation during rolling restarts.

よくある質問

「シャード割り当てとリバランシング」レッスンは無料ですか?

はい。「シャード割り当てとリバランシング」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Elasticsearch & Full Text Search Systemsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Elasticsearch & Full Text Search Systemsコースには全4レッスンが含まれています。

「シャード割り当てとリバランシング」で何を学びますか?

Elasticsearchがシャードの配置先を決める仕組み、allocation awarenessによってレプリカをハードウェア間に分散する方法、スケーリングやメンテナンス中のリバランシングを制御する方法を理解します。 ブラウザで直接実行するハンズオンコードでElasticsearch & Full Text Search Systemsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Elasticsearch & Full Text Search Systemsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのElasticsearch & Full Text Search Systemsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「シャード割り当てとリバランシング」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このElasticsearch & Full Text Search Systemsレッスンでコードを書いて実行できますか?

はい。すべてのElasticsearch & Full Text Search Systemsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. シャードとレプリカの仕組み
  2. クラスターヘルスとモニタリング
  3. ノードの役割とアーキテクチャ
  4. シャード割り当てとリバランシング
← Elasticsearch & Full Text Search Systemsに戻る