# Max hostname length?

**URL:** <https://discuss.elastic.co/t/max-hostname-length/28062>\
**Category:** Elasticsearch\
**Created:** [August 26, 2015, 4:12am UTC](https://discuss.elastic.co/t/max-hostname-length/28062 "2015-08-26T04:12:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrispomeroy](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@chrispomeroy](https://discuss.elastic.co/u/chrispomeroy)\
**Post date:** [August 26, 2015, 4:12am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/1 "2015-08-26T04:12:56Z")

</div>

Hi,

I found a possible bug whereby Elasticsearch won't start (results in "Failed!" when starting the daemon using Debian) if the hostname is greater than approximately 26 letters.

Does this seem possible?

I'm creating 3-node clusters of the following hostname combinations, and below I've listed where the server will start or won't.

(#=single digit node number e.g. 1,2,3)

elasticsearch-#-vm works  
elasticsearch-2-elasticsearch-#-vm fails  
elasticsearch-3-elasticsearch-#-vm fails  
e2lasticsearch-#-vm works  
elasticsearchelasticsearch-#-vm fails  
elasti-#-vm works

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 26, 2015, 4:43am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/2 "2015-08-26T04:43:08Z")

</div>

Hey Chris!

Do you get any error message or stacktrace?

---

<div class="post-metadata">

**Author:** ![chrispomeroy](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@chrispomeroy](https://discuss.elastic.co/u/chrispomeroy)\
**Post date:** [August 26, 2015, 5:10am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/3 "2015-08-26T05:10:24Z")

</div>

Hi David!

I get the elusive "Failed!" message when `service elasticsearch start` is run on any instance in the cluster if the yml file includes 3 "long" hostnames in the zen.hosts string.

Just to make sure I'm using zen.hosts correctly, using the example `elasticsearch1-elasticsearch-#-vm`, I would put the following in the yml file:

discovery.zen.ping.unicast.hosts: ["elasticsearch1-elasticsearch-1-vm", "elasticsearch1-elasticsearch-2-vm", "elasticsearch1-elasticsearch-3-vm"]

I am NOT listing port numbers. I didn't before and never had an issue.

I have no problems starting elasticsearch when the hostname is short and /\_cluster/health shows 3 data nodes with a green status.

I do not get any error logs entries in the log files in /var/log/elasticsearch/\*

To give you some more background, I'm updating the click to deploy feature on the Google Console and we now support multiple deployments per project. As a result we ask the user for a deployment name and autopopulate the name elasticsearch`n`. We insert the deployment name as a prefix to the instance name to avoid instance name conflicts. Therefore the deployment name elasticsearch1 will create the following instances:

elasticsearch1-elasticsearch-1-vm  
elasticsearch1-elasticsearch-2-vm  
elasticsearch1-elasticsearch-3-vm.

This has never been an issue with the current click to deploy version because we capped instance names to about ~20 characters and there was no prefix. this is what's leading me to think the hostname needs to be shorter.

Let me know if I can help clarify further.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 26, 2015, 5:37am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/4 "2015-08-26T05:37:40Z")

</div>

I don't think this is an ES problem, I was able to start a node with the name `elasticsearch1-elasticsearch-1-vm` without problems.

Is there anything in /var/log/syslog or /var/log/daemon or /var/log/upstart?

---

<div class="post-metadata">

**Author:** ![chrispomeroy](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@chrispomeroy](https://discuss.elastic.co/u/chrispomeroy)\
**Post date:** [August 26, 2015, 6:38am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/5 "2015-08-26T06:38:25Z")

</div>

syslog:

Aug 26 06:29:06 elasticsearchelasticsearch-1-vm rsyslogd-2177: imuxsock begins to drop messages from pid 2554 due to rate-limiting  
Aug 26 06:29:06 elasticsearchelasticsearch-1-vm safe\_format\_and\_mount: Running: mount -o discard,defaults /dev/disk/by-id/google-elasticsearchelasticsearch-1-vm-data /elasticsearch  
Aug 26 06:29:06 elasticsearchelasticsearch-1-vm kernel: [24.347134] EXT4-fs (sdb): mounted filesystem with ordered data mode. Opts: discard  
Aug 26 06:30:03 elasticsearchelasticsearch-1-vm dbus[2057]: [system] Activating service name='org.freedesktop.ConsoleKit' (using servicehelper)  
Aug 26 06:30:04 elasticsearchelasticsearch-1-vm dbus[2057]: [system] Activating service name='org.freedesktop.PolicyKit1' (using servicehelper)  
Aug 26 06:30:04 elasticsearchelasticsearch-1-vm polkitd[3104]: started daemon version 0.105 using authority implementation `local' version`0.105'  
Aug 26 06:30:04 elasticsearchelasticsearch-1-vm dbus[2057]: [system] Successfully activated service 'org.freedesktop.PolicyKit1'  
Aug 26 06:30:04 elasticsearchelasticsearch-1-vm dbus[2057]: [system] Successfully activated service 'org.freedesktop.ConsoleKit'

cpomeroy@elasticsearchelasticsearch-1-vm:~$ cat /var/log/daemon  
cat: /var/log/daemon: No such file or directory

cpomeroy@elasticsearchelasticsearch-1-vm:~$ cat /var/log/upstart  
cat: /var/log/upstart: No such file or directory

---

<div class="post-metadata">

**Author:** ![chrispomeroy](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@chrispomeroy](https://discuss.elastic.co/u/chrispomeroy)\
**Post date:** [August 26, 2015, 6:45am UTC](https://discuss.elastic.co/t/max-hostname-length/28062/6 "2015-08-26T06:45:35Z")

</div>

I added some functionality to convert the hostnames into internal IPs for the yml config file.

Funny thing is the original problem still continues...

If I use short instance names like:  
elasti-1-vm, elasti-2-vm, elasti-3-vm

or

ela-1-vm, ela-2-vm, ela-3-vm

it works fine,

but if I try

elasticsearchelasticsearch-1-vm, elasticsearchelasticsearch-2-vm, elasticsearchelasticsearch-3-vm

elasticsearch doesn't start up and the deployment fails.

Might need to think if there's anything else going on in my environment that might cause this.

---

<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 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/max-hostname-length/28062/7 "2017-07-05T23:53:54Z")

</div>


