# Explicit cluster configuration

**URL:** https://discuss.elastic.co/t/explicit-cluster-configuration/4635
**Category:** Elasticsearch
**Created:** [June 16, 2011, 2:09am UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635 "2011-06-16T02:09:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![tsuraan](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@tsuraan](https://discuss.elastic.co/u/tsuraan)
#### Post date: [June 16, 2011, 2:09am UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/1 "2011-06-16T02:09:35Z")

</div>

I'm looking for docs on how to explicitly define my cluster. What I  
want is something like zookeeper's config file (a sample is pasted in  
at the bottom of this email), I don't want elasticsearch doing  
automatic node discovery, and I especially want it to report to me  
that nodes are missing when it can't contact them. As it's running  
right now, every zookeeper node that I start on my network (regardless  
of what I specify in -Des.cluster.name) joins the existing  
elasticsearch cluster, which always has a green status. I thought I  
had figured out how to disable the automatic discovery in the  
elasticsearch.json, but it seems to have not worked. My attempt is  
below; I'm hoping somebody can show me what I did wrong, and point me  
in the correct direction.

my attempt at explicitly configuring a cluster:  
{  
"discovery": {  
"zen": {  
"ping": {  
"unicast": {  
"hosts": [  
"kvm-alpha",  
"kvm-beta"  
]  
}  
}  
}  
}  
}

sample zookeeper.config:

tickTime=2000  
dataDir=/var/zookeeper  
clientPort=2181  
initLimit=5  
syncLimit=2  
server.1=zoo1:2888:3888  
server.2=zoo2:2888:3888  
server.3=zoo3:2888:3888

---

<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: [June 16, 2011, 11:08am UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/2 "2011-06-16T11:08:14Z")

</div>

The master config file comes with (commented out) example of how to do unicast discovery (and disabling multicast): [https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml](https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml).

On Thursday, June 16, 2011 at 5:09 AM, tsuraan wrote:

> I'm looking for docs on how to explicitly define my cluster. What I  
> want is something like zookeeper's config file (a sample is pasted in  
> at the bottom of this email), I don't want elasticsearch doing  
> automatic node discovery, and I especially want it to report to me  
> that nodes are missing when it can't contact them. As it's running  
> right now, every zookeeper node that I start on my network (regardless  
> of what I specify in -Des.cluster.name (http://-Des.cluster.name)) joins the existing  
> elasticsearch cluster, which always has a green status. I thought I  
> had figured out how to disable the automatic discovery in the  
> elasticsearch.json, but it seems to have not worked. My attempt is  
> below; I'm hoping somebody can show me what I did wrong, and point me  
> in the correct direction.
> 
> my attempt at explicitly configuring a cluster:  
> {  
> "discovery": {  
> "zen": {  
> "ping": {  
> "unicast": {  
> "hosts": [  
> "kvm-alpha",  
> "kvm-beta"  
> ]  
> }  
> }  
> }  
> }  
> }
> 
> sample zookeeper.config:
> 
> tickTime=2000  
> dataDir=/var/zookeeper  
> clientPort=2181  
> initLimit=5  
> syncLimit=2  
> server.1=zoo1:2888:3888  
> server.2=zoo2:2888:3888  
> server.3=zoo3:2888:3888

---

<div class="post-metadata">

### Author: ![tsuraan](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@tsuraan](https://discuss.elastic.co/u/tsuraan)
#### Post date: [June 16, 2011, 3:53pm UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/3 "2011-06-16T15:53:56Z")

</div>

> The master config file comes with (commented out) example of how to do  
> unicast discovery (and disabling  
> multicast): [https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml](https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml).

Ok, I'm trying that with the ping.unicast.hosts set to  
["kvm-alpha:9300", "kvm-beta:9300", "kvm-gamma:9300"] and  
elasticsearch running at version 0.16.2. Only kvm-alpha and kvm-gamma  
are running, so those are the only two machines where Elasticsearch  
is currently running. It's behaving differently now, anyhow.  
/\_cluster/state for each machine lists only the elasticsearch running  
on that machine. netstat shows that both machine's elasticsearch's  
have connections to port 9300 of the other machine, so they are in  
contact, but the don't seem to quite be meshing. A pretty dump of  
/\_cluster/state is at the bottom of this email. /\_cluster/health now  
shows red; I'm not sure what to make of the rest of its values though.  
I definitely have no idea if it's red because it realizes that nodes  
are missing, or for some other reason. I'm guessing that the only  
reason ES was working at all before was due to the multicast cluster  
configuration taking over, so now I have something just plain wrong.

For basic diagnostics, each machine can ping each other by short name.  
/var/log/elasticsearch/blah.log has a lot of  
java.net.NoRouteToHostExceptions; I'm assuming these are due to the  
kvm-beta host of my unicast hosts, but the traceback doesn't actually  
say which host has no route, so I can't be sure. Other than that,  
I've wiped out /var/lib/elasticsearch/data/\* and  
/var/lib/elasticsearch/work/\*; not sure what else I can do.

/\_cluster/state on kvm-gamma:

{  
"cluster\_name" : "blah",  
"master\_node" : "Isx1p9MgS3OKxfrt\_OPKcg",  
"blocks" : {  
"global" : {  
"1" : {  
"description" : "state not recovered / initialized",  
"retryable" : true,  
"disable\_state\_persistence" : true,  
"levels" : ["read", "write", "metadata"]  
}  
}  
},  
"nodes" : {  
"Isx1p9MgS3OKxfrt\_OPKcg" : {  
"name" : "American Dream",  
"transport\_address" : "inet[/10.77.97.31:9300]",  
"attributes" : {  
}  
}  
},  
"metadata" : {  
"templates" : {  
},  
"indices" : {  
}  
},  
"routing\_table" : {  
"indices" : {  
}  
},  
"routing\_nodes" : {  
"unassigned" : ,  
"nodes" : {  
}  
},  
"allocations" :   
}

/\_cluster/info on kvm-gamma

{  
"cluster\_name" : "blah",  
"status" : "red",  
"timed\_out" : false,  
"number\_of\_nodes" : 1,  
"number\_of\_data\_nodes" : 1,  
"active\_primary\_shards" : 0,  
"active\_shards" : 0,  
"relocating\_shards" : 0,  
"initializing\_shards" : 0,  
"unassigned\_shards" : 0  
}

and my elasticsearch.yml:

# Cluster Settings

cluster:  
name: blah

# Path Settings

path:  
conf: /usr/share/elasticsearch/conf  
data: /var/lib/elasticsearch/data  
work: /var/lib/elasticsearch/work  
logs: /var/log/elasticsearch

# Gateway Settings

gateway:  
recover\_after\_nodes: 1  
recover\_after\_time: 5m  
expected\_nodes: 2

# Force all memory to be locked, forcing JVM to never swap

# (make sure to set MIN and MAX mem to the same value)

#bootstrap:

# mlockall: true

# Unicast Discovery (disable multicast)

discovery:  
zen:  
multicast.enabled: false  
ping.unicast.hosts: ["kvm-alpha:9300", "kvm-beta:9300", "kvm-gamma:9300"]

---

<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: [June 16, 2011, 4:02pm UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/4 "2011-06-16T16:02:23Z")

</div>

First, make sure to disable multicast as well (as shown in the example).

The no route to host means that the host names can't be resolved. Try first with IPs, see if it gets solved.

On Thursday, June 16, 2011 at 6:53 PM, tsuraan wrote:

> > The master config file comes with (commented out) example of how to do  
> > unicast discovery (and disabling  
> > multicast): [https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml](https://github.com/elasticsearch/elasticsearch/blob/master/config/elasticsearch.yml).
> 
> Ok, I'm trying that with the ping.unicast.hosts set to  
> ["kvm-alpha:9300", "kvm-beta:9300", "kvm-gamma:9300"] and  
> elasticsearch running at version 0.16.2. Only kvm-alpha and kvm-gamma  
> are running, so those are the only two machines where Elasticsearch  
> is currently running. It's behaving differently now, anyhow.  
> /\_cluster/state for each machine lists only the elasticsearch running  
> on that machine. netstat shows that both machine's elasticsearch's  
> have connections to port 9300 of the other machine, so they are in  
> contact, but the don't seem to quite be meshing. A pretty dump of  
> /\_cluster/state is at the bottom of this email. /\_cluster/health now  
> shows red; I'm not sure what to make of the rest of its values though.  
> I definitely have no idea if it's red because it realizes that nodes  
> are missing, or for some other reason. I'm guessing that the only  
> reason ES was working at all before was due to the multicast cluster  
> configuration taking over, so now I have something just plain wrong.
> 
> For basic diagnostics, each machine can ping each other by short name.  
> /var/log/elasticsearch/blah.log has a lot of  
> java.net.NoRouteToHostExceptions; I'm assuming these are due to the  
> kvm-beta host of my unicast hosts, but the traceback doesn't actually  
> say which host has no route, so I can't be sure. Other than that,  
> I've wiped out /var/lib/elasticsearch/data/\* and  
> /var/lib/elasticsearch/work/\*; not sure what else I can do.
> 
> /\_cluster/state on kvm-gamma:
> 
> {  
> "cluster\_name" : "blah",  
> "master\_node" : "Isx1p9MgS3OKxfrt\_OPKcg",  
> "blocks" : {  
> "global" : {  
> "1" : {  
> "description" : "state not recovered / initialized",  
> "retryable" : true,  
> "disable\_state\_persistence" : true,  
> "levels" : ["read", "write", "metadata"]  
> }  
> }  
> },  
> "nodes" : {  
> "Isx1p9MgS3OKxfrt\_OPKcg" : {  
> "name" : "American Dream",  
> "transport\_address" : "inet[/10.77.97.31:9300]",  
> "attributes" : {  
> }  
> }  
> },  
> "metadata" : {  
> "templates" : {  
> },  
> "indices" : {  
> }  
> },  
> "routing\_table" : {  
> "indices" : {  
> }  
> },  
> "routing\_nodes" : {  
> "unassigned" : ,  
> "nodes" : {  
> }  
> },  
> "allocations" :   
> }
> 
> /\_cluster/info on kvm-gamma
> 
> {  
> "cluster\_name" : "blah",  
> "status" : "red",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 1,  
> "number\_of\_data\_nodes" : 1,  
> "active\_primary\_shards" : 0,  
> "active\_shards" : 0,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 0  
> }
> 
> and my elasticsearch.yml:
> 
> # Cluster Settings
> 
> cluster:  
> name: blah
> 
> # Path Settings
> 
> path:  
> conf: /usr/share/elasticsearch/conf  
> data: /var/lib/elasticsearch/data  
> work: /var/lib/elasticsearch/work  
> logs: /var/log/elasticsearch
> 
> # Gateway Settings
> 
> gateway:  
> recover\_after\_nodes: 1  
> recover\_after\_time: 5m  
> expected\_nodes: 2
> 
> # Force all memory to be locked, forcing JVM to never swap
> 
> # (make sure to set MIN and MAX mem to the same value)
> 
> #bootstrap:
> 
> # mlockall: true
> 
> # Unicast Discovery (disable multicast)
> 
> discovery:  
> zen:  
> multicast.enabled: false  
> ping.unicast.hosts: ["kvm-alpha:9300", "kvm-beta:9300", "kvm-gamma:9300"]

---

<div class="post-metadata">

### Author: ![ysavit](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@ysavit](https://discuss.elastic.co/u/ysavit)
#### Post date: [November 15, 2011, 7:24pm UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/5 "2011-11-15T19:24:11Z")

</div>

I have the similar problem.  
There is the part of my master config file(elasticsearch.yml):

discovery.zen.ping.multicast.enabled: false  
discovery.zen.ping.unicast.hosts: ["xxx.xx.168.10:9300", "xxx.xx.12.85:9300"]  
discovery.zen.ping.timeout: 10s  
discovery.zen.minimum\_master\_nodes: 2

The problem is that xxx.xx. **12.85** :9300 is found but "xxx.xx. **168.10** :9300" is not.  
Master IP xxx.xx. **12.128**.

Any ideas?

Thanks.

---

<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:48am UTC](https://discuss.elastic.co/t/explicit-cluster-configuration/4635/6 "2017-07-06T03:48:30Z")

</div>


