# Manually switching / picking Primary node for a particular cluster

**URL:** https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639
**Category:** Elasticsearch
**Created:** [May 10, 2012, 3:31pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639 "2012-05-10T15:31:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Andrew\_at\_DataFeedFi](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@Andrew\_at\_DataFeedFi](https://discuss.elastic.co/u/Andrew_at_DataFeedFi)
#### Post date: [May 10, 2012, 3:31pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/1 "2012-05-10T15:31:35Z")

</div>

Sometime we have nodes inside cluster with different hardware specs.  
From my experience Primary nodes usually require more resources as it  
does a little bit more work.  
It may be advantageous to be able to pick the most powerful server for  
its Primary.

Is there a way to perhaps update cluster setting via cluster update  
setting API to switch / pick  
the Primary node?

Maybe there is a good reason why this is not avail? maybe it is bad  
idea somehow?

Thanks

--Andrew

---

<div class="post-metadata">

### Author: ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)
#### Post date: [May 10, 2012, 11:12pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/2 "2012-05-10T23:12:21Z")

</div>

Andrew[.:at:.][DataFeedFile.com](http://DataFeedFile.com) wrote:

> Sometime we have nodes inside cluster with different hardware  
> specs. From my experience Primary nodes usually require more  
> resources as it does a little bit more work. It may be  
> advantageous to be able to pick the most powerful server for its  
> Primary.
> 
> Is there a way to perhaps update cluster setting via cluster update  
> setting API to switch / pick the Primary node?
> 
> Maybe there is a good reason why this is not avail? maybe it is bad  
> idea somehow?

You can do some interesting things with shard allocation, but getting  
down to the replica level doesn't seem to be currently possible.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

-Drew

---

<div class="post-metadata">

### Author: ![Andrew\_at\_DataFeedFi](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@Andrew\_at\_DataFeedFi](https://discuss.elastic.co/u/Andrew_at_DataFeedFi)
#### Post date: [May 11, 2012, 4:18pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/3 "2012-05-11T16:18:40Z")

</div>

Hi Drew,

Hmm... thanks for your reply, however I am not trying to change shard  
allocation.

I am just trying to change / select via API which node is the Primary node.

Thanks

--Andrew

On Thursday, May 10, 2012 6:12:21 PM UTC-5, Drew Raines wrote:

> Andrew[.:at:.][DataFeedFile.com](http://DataFeedFile.com) wrote:
> 
> > Sometime we have nodes inside cluster with different hardware  
> > specs. From my experience Primary nodes usually require more  
> > resources as it does a little bit more work. It may be  
> > advantageous to be able to pick the most powerful server for its  
> > Primary.
> > 
> > Is there a way to perhaps update cluster setting via cluster update  
> > setting API to switch / pick the Primary node?
> > 
> > Maybe there is a good reason why this is not avail? maybe it is bad  
> > idea somehow?
> 
> You can do some interesting things with shard allocation, but getting  
> down to the replica level doesn't seem to be currently possible.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/allocation.html)
> 
> -Drew

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [May 15, 2012, 7:56pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/4 "2012-05-15T19:56:34Z")

</div>

There isn't really a difference between a primary shard and a replica. When  
you index a document, it is indexed on the primary and then indexed on the  
replica as well. Well, to be honest, thats up to async replication. It  
shouldn't be a problem with adding an API to "change" the state, there is  
already a feature request I discussed on IRC to be able to move shards from  
one node to the other using an API, we can have as part of the "operations"  
allowed there to also "change" state of a shard.

On Thu, May 10, 2012 at 6:31 PM, Andrew[.:at:.][DataFeedFile.com](http://DataFeedFile.com) \<  
[andrew@datafeedfile.com](mailto:andrew@datafeedfile.com)\> wrote:

> Sometime we have nodes inside cluster with different hardware specs.  
> From my experience Primary nodes usually require more resources as it  
> does a little bit more work.  
> It may be advantageous to be able to pick the most powerful server for  
> its Primary.
> 
> Is there a way to perhaps update cluster setting via cluster update  
> setting API to switch / pick  
> the Primary node?
> 
> Maybe there is a good reason why this is not avail? maybe it is bad  
> idea somehow?
> 
> Thanks
> 
> --Andrew

---

<div class="post-metadata">

### Author: ![Andrew\_at\_DataFeedFi](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@Andrew\_at\_DataFeedFi](https://discuss.elastic.co/u/Andrew_at_DataFeedFi)
#### Post date: [August 19, 2012, 4:37pm UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/5 "2012-08-19T16:37:02Z")

</div>

Shay,

Apologize for the really late reply,

I see your answer and API that was proposed is dealing with shards,  
I am more speaking about "Primary Node" instead of "Primary Shard".

To be more clear, I would like to have to capability to select which node  
in the cluster to be primary.

However if you know that which node is primary really does not matter (it  
does not use more resource than other nodes).

Then I would just appreciate that fact confirmation from you and would not  
worry about this "switching primary node" anymore.

Thanks

--Andrew

On Thursday, May 10, 2012 10:31:35 AM UTC-5, Andrew[.:at:.][DataFeedFile.com](http://DataFeedFile.com)  
wrote:

> Sometime we have nodes inside cluster with different hardware specs.  
> From my experience Primary nodes usually require more resources as it  
> does a little bit more work.  
> It may be advantageous to be able to pick the most powerful server for  
> its Primary.
> 
> Is there a way to perhaps update cluster setting via cluster update  
> setting API to switch / pick  
> the Primary node?
> 
> Maybe there is a good reason why this is not avail? maybe it is bad  
> idea somehow?
> 
> Thanks
> 
> --Andrew

--

---

<div class="post-metadata">

### Author: ![rohancs](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@rohancs](https://discuss.elastic.co/u/rohancs)
#### Post date: [April 24, 2015, 7:22am UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/6 "2015-04-24T07:22:14Z")

</div>

Shay,  
Is this available in the current/future version of ES?

The fact that primary gets indexed first is very useful for high volume bulk indexing scenario. when re building an index from a secondary data source in bulk I'd like to chose the nearest node to host all primary shards to get high n/w throughput. Later I may choose to distribute primaries to get distributed system benefits...

I ran a benchmark by reducing replicas to 0 and using allocation to keep all shards on a single node and saw significant benefits (for my deployment topology).

Additionally if I can specify index only and read only nodes (read from replicas) in my cluster... It may help offer very high throughput on simultaneous reads/writes and address such use cases (as long as eventual consistency is acceptable)....any idea if this feature is available now or in future?

Thanks !  
Rohan

---

<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, 12:17am UTC](https://discuss.elastic.co/t/manually-switching-picking-primary-node-for-a-particular-cluster/7639/7 "2017-07-06T00:17:56Z")

</div>


