What's the logic or algorithm for allocation of primary shard or replica when node joins cluster?

Hi all,
I have googled a lot but found nothing about the logic for
allocation of shard and replica when node joins the cluster.
If it's not evenly distributed shards and replicas, can I controll
allocation of shards and replicas?
What I mean manually controll the allocation of shards and replicas
in order to making a balance.
any pointer is a great help, thanks.

SuoNayi

--

I believe the main algorithm is defined in EvenShardsCountAllocator:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/EvenShardsCountAllocator.java

You can create your own Allocator, but there is nothing to manual assign
shards. I think there is something new in 0.20

--
Ivan

On Mon, Oct 22, 2012 at 7:53 PM, SuoNayi suonayi@gmail.com wrote:

Hi all,
I have googled a lot but found nothing about the logic for
allocation of shard and replica when node joins the cluster.
If it's not evenly distributed shards and replicas, can I controll
allocation of shards and replicas?
What I mean manually controll the allocation of shards and replicas
in order to making a balance.
any pointer is a great help, thanks.

SuoNayi

--

--

As Ivan mentioned, the default algorithm is in EvenShardsCountAllocator. As
you can see from the name, it tries to allocate shards evenly across all
nodes in the cluster. In other words it tries to allocate the same number
of shards on each node.

You can control shards allocation explicitly by using Cluster Reroute APIhttp://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.htmland declaratively by using index
routing allocationhttp://www.elasticsearch.org/guide/reference/index-modules/allocation.htmlsettings.

On Monday, October 22, 2012 11:27:27 PM UTC-4, Ivan Brusic wrote:

I believe the main algorithm is defined in EvenShardsCountAllocator:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/EvenShardsCountAllocator.java

You can create your own Allocator, but there is nothing to manual assign
shards. I think there is something new in 0.20

--
Ivan

On Mon, Oct 22, 2012 at 7:53 PM, SuoNayi <suo...@gmail.com <javascript:>>wrote:

Hi all,
I have googled a lot but found nothing about the logic for
allocation of shard and replica when node joins the cluster.
If it's not evenly distributed shards and replicas, can I controll
allocation of shards and replicas?
What I mean manually controll the allocation of shards and replicas
in order to making a balance.
any pointer is a great help, thanks.

SuoNayi

--

--

thanks all.

在 2012年10月23日星期二UTC+8下午6时32分57秒,Igor Motov写道:

As Ivan mentioned, the default algorithm is in EvenShardsCountAllocator.
As you can see from the name, it tries to allocate shards evenly across all
nodes in the cluster. In other words it tries to allocate the same number
of shards on each node.

You can control shards allocation explicitly by using Cluster Reroute APIhttp://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.htmland declaratively by using index
routing allocationhttp://www.elasticsearch.org/guide/reference/index-modules/allocation.htmlsettings.

On Monday, October 22, 2012 11:27:27 PM UTC-4, Ivan Brusic wrote:

I believe the main algorithm is defined in EvenShardsCountAllocator:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/EvenShardsCountAllocator.java

You can create your own Allocator, but there is nothing to manual assign
shards. I think there is something new in 0.20

--
Ivan

On Mon, Oct 22, 2012 at 7:53 PM, SuoNayi suo...@gmail.com wrote:

Hi all,
I have googled a lot but found nothing about the logic for
allocation of shard and replica when node joins the cluster.
If it's not evenly distributed shards and replicas, can I
controll allocation of shards and replicas?
What I mean manually controll the allocation of shards and
replicas in order to making a balance.
any pointer is a great help, thanks.

SuoNayi

--

--