BindTransportException when starting Elasticsearch server

I am trying to start my elasticsearch server by running bin/elasticsearch from my ES directory but I keep getting a bindtransport exception. What should I do?

[2016-08-11 04:57:45,143][INFO ][node                     ] [my-elk1] version[2.3.3], pid[30342], build[218bdf1/2016-05-17T15:40:04Z]
[2016-08-11 04:57:45,143][INFO ][node                     ] [my-elk1] initializing ...
[2016-08-11 04:57:45,683][INFO ][plugins                  ] [my-elk1] modules [lang-groovy, reindex, lang-expression], plugins [], sites []
[2016-08-11 04:57:45,707][INFO ][env                      ] [my-elk1] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [16.1gb], net total_space [49gb], spins? [no], types [ext4]
[2016-08-11 04:57:45,707][INFO ][env                      ] [my-elk1] heap size [990.7mb], compressed ordinary object pointers [true]
[2016-08-11 04:57:47,647][INFO ][node                     ] [my-elk1] initialized
[2016-08-11 04:57:47,648][INFO ][node                     ] [my-elk1] starting ...
Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /]; nested: BindException[Cannot assign requested address];
Likely root cause: Cannot assign requested address


# ---------------------------------- Cluster -----------------------------------
# Use a descriptive name for your cluster:
# name that es uses to find other clusters to join
# when you turn on a node, it will find other nodes on the network to talk to
# if found, it will cluster. name determines if node will join or not. elk1
# ------------------------------------ Node ------------------------------------
# Use a descriptive name for the node:
# everytime you turn on a node, it will choose a marvel comic character
# is just a name my-elk1
# Add custom attributes to the node:
# node.rack: r1
# ----------------------------------- Paths ------------------------------------
# Path to directory where to store the data (separate multiple locations by comma):
# /path/to/data
# Path to log files:
# path.logs: /path/to/logs
# ----------------------------------- Memory -----------------------------------
# Lock the memory on startup:
# allows jvm to lock memory on startup to avoid swapping
bootstrap.mlockall: true
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
# Elasticsearch performs poorly when the system is swapping the memory.
# ---------------------------------- Network -----------------------------------
# Set the bind address to a specific IP (IPv4 or IPv6):
# setting to control network traffic. only allows traffic from :<> so that
# external processes cannot access elasticsearch server
# Set a custom port for HTTP:
# http.port: 9200
# For more information, see the documentation at:
# <>
# --------------------------------- Discovery ----------------------------------
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["", "[::1]"]
# ["host1", "host2"]
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 \
+ 1):
# discovery.zen.minimum_master_nodes: 3
# For more information, see the documentation at:
# <>
...(everthing commenteed)

Have you checked to make sure another process isn't using that port? Or another ES server that may accidentally be running in the background?

I've checked

sudo lsof -iTCP -sTCP:LISTEN | grep elasticsearch

to see if elasticsearch is even running but nothing comes up.

I also tried

/etc/init.d/elasticsearch status

but it says elasticsearch daed but pid file exists.

however if I run curl 'localhost:9200/_cat/indices?v'

health status index               pri rep docs.count docs.deleted store.size 
yellow open   logstash-2015.05.19   5   1          0            0       795b           795b 
yellow open   logstash-2016.08.12   5   1          2            0     30.6kb         30.6kb 
yellow open   megacorp              5   1          3            0     12.7kb         12.7kb 
yellow open   logstash-2015.05.18   5   1          0            0       795b   

is returned.

It is worth mentioning that when I start elasticsearch it consistently crashes after a few minutes with

Caught exception while handling client http traffic, closing connection [id: 0x09f530e6, / :> /]
java.lang.IllegalArgumentException: empty text

Part of the problem may be that I am starting elasticsearch with

bin/elasticsearch -Des.insecure.allow.root=true

because starting it with just bin/elaticsearch throws errors about BindTransportException but I posted a question about that earlier both here and on SO and no one responded.

You'll likely need to grep for java in that lsof command (at least, that's the case on my Mac). Try: sudo lsof -iTCP -sTCP:LISTEN | grep java

Or, check the specific ports:

lsof -n -iTCP:9200
lsof -n -iTCP:9300

You can check to see if there are any general processes running with: ps aux | grep elasticsearch

The bad http traffic likely means you have some other server or service running which is trying to talk to ES. Are you running any docker containers, or any other services that may interact with ES?

Also, dont do this :stuck_out_tongue:

lsof -n -iTCP:9200

java    26962 root   41u  IPv4 3381397      0t0  TCP> (CLOSE_WAIT)

lsof -n -iTCP:9300 returns nothing

same with ps aux

ps aux | grep elasticsearch
root      4479  0.0  0.0 103360   816 pts/4    S+   11:00   0:00 grep elasticsearch

I still get a bindtransportexception "cannot assign requested address" when ES tries to access The only service trying to talk to ES currently is logstash

Well, that lsof shows a java process is sitting on 9200. Did you try killing that process before restarting Elasticsearch?

Is this a distro installation (e.g. using a deb or rpm)? I ask because I saw you try to use init.d, but are also starting it manually.

Can you shut down Logstash, then restart ES so that only ES is running to begin with? Are you using the HTTP output for Logstash (and not the java node client output)?

Sorry, I don't have a lot of specific advice :confused: I'm fairly sure the issue is that some process is squatting on the ports that ES needs, so you just need to find and remove that process (or change the ports that ES is using with transport.tcp.port and http.port, docs here:

You could also try configuring the manually to make sure it binds the right interface.