# Control shard placement

**URL:** <https://discuss.elastic.co/t/control-shard-placement/9742>\
**Category:** Elasticsearch\
**Created:** [November 16, 2012, 2:41pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742 "2012-11-16T14:41:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticuser\_2](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elasticuser\_2](https://discuss.elastic.co/u/elasticuser_2)\
**Post date:** [November 16, 2012, 2:41pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742/1 "2012-11-16T14:41:20Z")

</div>

It's possible to control shard placement on nodes. But how we can control  
primary shard and replica shard placement independently ?

Thanks.

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [November 16, 2012, 4:43pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742/2 "2012-11-16T16:43:39Z")

</div>

Hi,

What is the reason that you control the primary and replica shard  
placement independently?  
By default the primary shards's replicas aren't placed on the same node.

Martijn

On 16 November 2012 15:41, elasticuser [merik2004-elastic@yahoo.fr](mailto:merik2004-elastic@yahoo.fr) wrote:

> It's possible to control shard placement on nodes. But how we can control  
> primary shard and replica shard placement independently ?
> 
> Thanks.
> 
> --

--  
Met vriendelijke groet,

Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![elasticuser\_2](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elasticuser\_2](https://discuss.elastic.co/u/elasticuser_2)\
**Post date:** [November 16, 2012, 5:08pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742/3 "2012-11-16T17:08:48Z")

</div>

Hi Martijn,

Because I have 10 servers with each about 500Go of hard drive space. So,  
for my data, hard drive space is limited.  
I would like to control where the primary shard and the replica shard are  
stored in order to put my primary shard on the hdd and the replica shard on  
a SAN.

On Friday, November 16, 2012 5:44:05 PM UTC+1, Martijn v Groningen wrote:

> Hi,
> 
> What is the reason that you control the primary and replica shard  
> placement independently?  
> By default the primary shards's replicas aren't placed on the same node.
> 
> Martijn
> 
> On 16 November 2012 15:41, elasticuser \<[merik200...@yahoo.fr](mailto:merik200...@yahoo.fr) \<javascript:\>\>  
> wrote:
> 
> > It's possible to control shard placement on nodes. But how we can  
> > control  
> > primary shard and replica shard placement independently ?
> > 
> > Thanks.
> > 
> > --
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 16, 2012, 11:11pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742/4 "2012-11-16T23:11:15Z")

</div>

So, the problem here is that if you will even manage to place all primary  
shards to the right places, the moment one of the nodes with primary shards  
goes away all corresponding replicas will be promoted to primaries.

Could you talk a little bit about how you want to take advantage of having  
primaries on HDD and replicas on SAN. Is the idea to use nodes with HDD for  
requests and keep nodes that are using SAN as hot standby? What are you  
trying to achieve by such allocation?

On Friday, November 16, 2012 12:08:48 PM UTC-5, elasticuser wrote:

> Hi Martijn,
> 
> Because I have 10 servers with each about 500Go of hard drive space. So,  
> for my data, hard drive space is limited.  
> I would like to control where the primary shard and the replica shard are  
> stored in order to put my primary shard on the hdd and the replica shard on  
> a SAN.
> 
> On Friday, November 16, 2012 5:44:05 PM UTC+1, Martijn v Groningen wrote:
> 
> > Hi,
> > 
> > What is the reason that you control the primary and replica shard  
> > placement independently?  
> > By default the primary shards's replicas aren't placed on the same node.
> > 
> > Martijn
> > 
> > On 16 November 2012 15:41, elasticuser [merik200...@yahoo.fr](mailto:merik200...@yahoo.fr) wrote:
> > 
> > > It's possible to control shard placement on nodes. But how we can  
> > > control  
> > > primary shard and replica shard placement independently ?
> > > 
> > > Thanks.
> > > 
> > > --
> > 
> > --  
> > Met vriendelijke groet,
> > 
> > Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![elasticuser\_2](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elasticuser\_2](https://discuss.elastic.co/u/elasticuser_2)\
**Post date:** [November 17, 2012, 9:12am UTC](https://discuss.elastic.co/t/control-shard-placement/9742/5 "2012-11-17T09:12:31Z")

</div>

My goal is to save space on the HDD. In my case, I have 5 To on my cluster  
but with replica shards just 2.5 To. So, I would like to keep 5 To for my  
primary shards and store the replica shards on a SAN.  
I am aware that if a node with primary shards down all corresponding  
replicas will be promoted to primaries but just during the time to repair  
the node.  
Indeed, I would like to use nodes with HDD for requests and nodes with SAN  
just in case the nodes with primary shard has a problem.

On Saturday, November 17, 2012 12:11:15 AM UTC+1, Igor Motov wrote:

> So, the problem here is that if you will even manage to place all primary  
> shards to the right places, the moment one of the nodes with primary shards  
> goes away all corresponding replicas will be promoted to primaries.
> 
> Could you talk a little bit about how you want to take advantage of having  
> primaries on HDD and replicas on SAN. Is the idea to use nodes with HDD for  
> requests and keep nodes that are using SAN as hot standby? What are you  
> trying to achieve by such allocation?
> 
> On Friday, November 16, 2012 12:08:48 PM UTC-5, elasticuser wrote:
> 
> > Hi Martijn,
> > 
> > Because I have 10 servers with each about 500Go of hard drive space. So,  
> > for my data, hard drive space is limited.  
> > I would like to control where the primary shard and the replica shard are  
> > stored in order to put my primary shard on the hdd and the replica shard on  
> > a SAN.
> > 
> > On Friday, November 16, 2012 5:44:05 PM UTC+1, Martijn v Groningen wrote:
> > 
> > > Hi,
> > > 
> > > What is the reason that you control the primary and replica shard  
> > > placement independently?  
> > > By default the primary shards's replicas aren't placed on the same node.
> > > 
> > > Martijn
> > > 
> > > On 16 November 2012 15:41, elasticuser [merik200...@yahoo.fr](mailto:merik200...@yahoo.fr) wrote:
> > > 
> > > > It's possible to control shard placement on nodes. But how we can  
> > > > control  
> > > > primary shard and replica shard placement independently ?
> > > > 
> > > > Thanks.
> > > > 
> > > > --
> > > 
> > > --  
> > > Met vriendelijke groet,
> > > 
> > > Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 17, 2012, 1:23pm UTC](https://discuss.elastic.co/t/control-shard-placement/9742/6 "2012-11-17T13:23:49Z")

</div>

I see. That's an interesting idea. Unfortunately, I cannot think of a  
mechanism that would allow you to do something like this. You can configure  
a set of nodes to use HDD, and you can configure another set of nodes to  
use SAN. You can use Allocation Awareness[http://www.elasticsearch.org/guide/reference/modules/cluster.html](http://www.elasticsearch.org/guide/reference/modules/cluster.html)to make sure that if one shard is allocated on HDD node, its replica would  
be allocated on SAN and vis versa. You can start HDD nodes first to make  
sure they get all primaries shards. But that's it. There is really no way  
to reassign primaries back to HDD nodes if they will get moved to SAN  
nodes, or to limit searches only to HDD nodes when primaries are no longer  
there.

On Saturday, November 17, 2012 4:12:31 AM UTC-5, elasticuser wrote:

> My goal is to save space on the HDD. In my case, I have 5 To on my cluster  
> but with replica shards just 2.5 To. So, I would like to keep 5 To for my  
> primary shards and store the replica shards on a SAN.  
> I am aware that if a node with primary shards down all corresponding  
> replicas will be promoted to primaries but just during the time to repair  
> the node.  
> Indeed, I would like to use nodes with HDD for requests and nodes with SAN  
> just in case the nodes with primary shard has a problem.
> 
> On Saturday, November 17, 2012 12:11:15 AM UTC+1, Igor Motov wrote:
> 
> > So, the problem here is that if you will even manage to place all primary  
> > shards to the right places, the moment one of the nodes with primary shards  
> > goes away all corresponding replicas will be promoted to primaries.
> > 
> > Could you talk a little bit about how you want to take advantage of  
> > having primaries on HDD and replicas on SAN. Is the idea to use nodes with  
> > HDD for requests and keep nodes that are using SAN as hot standby? What are  
> > you trying to achieve by such allocation?
> > 
> > On Friday, November 16, 2012 12:08:48 PM UTC-5, elasticuser wrote:
> > 
> > > Hi Martijn,
> > > 
> > > Because I have 10 servers with each about 500Go of hard drive space. So,  
> > > for my data, hard drive space is limited.  
> > > I would like to control where the primary shard and the replica shard  
> > > are stored in order to put my primary shard on the hdd and the replica  
> > > shard on a SAN.
> > > 
> > > On Friday, November 16, 2012 5:44:05 PM UTC+1, Martijn v Groningen wrote:
> > > 
> > > > Hi,
> > > > 
> > > > What is the reason that you control the primary and replica shard  
> > > > placement independently?  
> > > > By default the primary shards's replicas aren't placed on the same  
> > > > node.
> > > > 
> > > > Martijn
> > > > 
> > > > On 16 November 2012 15:41, elasticuser [merik200...@yahoo.fr](mailto:merik200...@yahoo.fr) wrote:
> > > > 
> > > > > It's possible to control shard placement on nodes. But how we can  
> > > > > control  
> > > > > primary shard and replica shard placement independently ?
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > --
> > > > 
> > > > --  
> > > > Met vriendelijke groet,
> > > > 
> > > > Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![elasticuser\_2](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elasticuser\_2](https://discuss.elastic.co/u/elasticuser_2)\
**Post date:** [November 20, 2012, 8:12am UTC](https://discuss.elastic.co/t/control-shard-placement/9742/7 "2012-11-20T08:12:35Z")

</div>

Thanks for your help Igor.

On Saturday, November 17, 2012 2:23:49 PM UTC+1, Igor Motov wrote:

> I see. That's an interesting idea. Unfortunately, I cannot think of a  
> mechanism that would allow you to do something like this. You can configure  
> a set of nodes to use HDD, and you can configure another set of nodes to  
> use SAN. You can use Allocation Awareness[http://www.elasticsearch.org/guide/reference/modules/cluster.html](http://www.elasticsearch.org/guide/reference/modules/cluster.html)to make sure that if one shard is allocated on HDD node, its replica would  
> be allocated on SAN and vis versa. You can start HDD nodes first to make  
> sure they get all primaries shards. But that's it. There is really no way  
> to reassign primaries back to HDD nodes if they will get moved to SAN  
> nodes, or to limit searches only to HDD nodes when primaries are no longer  
> there.
> 
> On Saturday, November 17, 2012 4:12:31 AM UTC-5, elasticuser wrote:
> 
> > My goal is to save space on the HDD. In my case, I have 5 To on my  
> > cluster but with replica shards just 2.5 To. So, I would like to keep 5 To  
> > for my primary shards and store the replica shards on a SAN.  
> > I am aware that if a node with primary shards down all corresponding  
> > replicas will be promoted to primaries but just during the time to repair  
> > the node.  
> > Indeed, I would like to use nodes with HDD for requests and nodes with  
> > SAN just in case the nodes with primary shard has a problem.
> > 
> > On Saturday, November 17, 2012 12:11:15 AM UTC+1, Igor Motov wrote:
> > 
> > > So, the problem here is that if you will even manage to place all  
> > > primary shards to the right places, the moment one of the nodes with  
> > > primary shards goes away all corresponding replicas will be promoted to  
> > > primaries.
> > > 
> > > Could you talk a little bit about how you want to take advantage of  
> > > having primaries on HDD and replicas on SAN. Is the idea to use nodes with  
> > > HDD for requests and keep nodes that are using SAN as hot standby? What are  
> > > you trying to achieve by such allocation?
> > > 
> > > On Friday, November 16, 2012 12:08:48 PM UTC-5, elasticuser wrote:
> > > 
> > > > Hi Martijn,
> > > > 
> > > > Because I have 10 servers with each about 500Go of hard drive space.  
> > > > So, for my data, hard drive space is limited.  
> > > > I would like to control where the primary shard and the replica shard  
> > > > are stored in order to put my primary shard on the hdd and the replica  
> > > > shard on a SAN.
> > > > 
> > > > On Friday, November 16, 2012 5:44:05 PM UTC+1, Martijn v Groningen  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > What is the reason that you control the primary and replica shard  
> > > > > placement independently?  
> > > > > By default the primary shards's replicas aren't placed on the same  
> > > > > node.
> > > > > 
> > > > > Martijn
> > > > > 
> > > > > On 16 November 2012 15:41, elasticuser [merik200...@yahoo.fr](mailto:merik200...@yahoo.fr) wrote:
> > > > > 
> > > > > > It's possible to control shard placement on nodes. But how we can  
> > > > > > control  
> > > > > > primary shard and replica shard placement independently ?
> > > > > > 
> > > > > > Thanks.
> > > > > > 
> > > > > > --
> > > > > 
> > > > > --  
> > > > > Met vriendelijke groet,
> > > > > 
> > > > > Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:03am UTC](https://discuss.elastic.co/t/control-shard-placement/9742/8 "2017-07-06T03:03:37Z")

</div>


