# Failed to connect to node \[{}{}{localhost}{127.0.0.1:9300}\], removed from nodes list

**URL:** <https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [April 6, 2020, 7:49am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640 "2020-04-06T07:49:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishnu\_Vardhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_vardhan/32/43927_2.png) [@Vishnu\_Vardhan](https://discuss.elastic.co/u/Vishnu_Vardhan)\
**Post date:** [April 6, 2020, 7:49am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/1 "2020-04-06T07:49:00Z")

</div>

```
geoportal_1 | 2020-04-05 06:46:38,400 INFO [org.elasticsearch.client.transport.TransportClientNodesService] - failed to connect to node [{#transport#-1}{DTai1v8zS96dztCUpGku4w}{localhost}{127.0.0.1:9300}], removed from nodes list
geoportal_1 | org.elasticsearch.transport.ConnectTransportException: [][127.0.0.1:9300] connect_timeout[30s]
geoportal_1 | at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannelsLight(Netty4Transport.java:340) ~[transport-netty4-client-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:410) ~[elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.transport.TcpTransport.connectToNodeLight(TcpTransport.java:382) ~[elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.transport.TransportService.connectToNodeLight(TransportService.java:303) ~[elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:392) [elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:338) [elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:371) [elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:458) [elasticsearch-5.1.1.jar:5.1.1]
geoportal_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_242]
geoportal_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_242]
geoportal_1 | at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
geoportal_1 | Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:9300
geoportal_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_242]
geoportal_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:714) ~[?:1.8.0_242]
geoportal_1 | at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:346) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:639) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:574) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:488) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:450) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) ~[netty-common-4.1.6.Final.jar:4.1.6.Final]
geoportal_1 | ... 1 more
```

---

<div class="post-metadata">

**Author:** ![Vishnu\_Vardhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_vardhan/32/43927_2.png) [@Vishnu\_Vardhan](https://discuss.elastic.co/u/Vishnu_Vardhan)\
**Post date:** [April 6, 2020, 8:01am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/2 "2020-04-06T08:01:06Z")

</div>

I'm running elasticsearch in docker desktop(container) and try to connect with web application. Above log showing under web application logs. Below is my docker compose file.

```
version: '3.6'
services:
  geoportal:
      build: geoportal
      ports: 
        - "8080:8080"
      hostname: geoportal
      environment:
        - es_cluster=elasticsearch
        - es_node=elasticsearch
      # volumes:
      # - "./local/harvester:/root"
      links: 
        - elasticsearch:elasticsearch
      networks:
        - default
  elasticsearch:
    image: elasticsearch:5.6
    container_name: elasticsearch
    hostname: elasticsearch
    ports:
      - "9200:9200"
      - "9300:9300"
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    environment:
      - "ES_JAVA_OPTS=-Xms750m -Xmx750m"
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - cluster.name=elasticsearch
      # - network.host=127.0.0.1
      # - transport.host=0.0.0.0
      - xpack.security.enabled=false
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - default

networks:
  default:
    external:
      name: geoportal
volumes:
  esdata1:
    driver: local
```

---

<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:** [April 6, 2020, 3:33pm UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/3 "2020-04-06T15:33:09Z")

</div>

Welcome!

Not sure what the problem is here. But anyway, do not use the TransportClient. It will be removed in the next major version. Just use the REST Client.

---

<div class="post-metadata">

**Author:** ![Vishnu\_Vardhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishnu_vardhan/32/43927_2.png) [@Vishnu\_Vardhan](https://discuss.elastic.co/u/Vishnu_Vardhan)\
**Post date:** [May 4, 2020, 10:21am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/4 "2020-05-04T10:21:00Z")

</div>

Sure, Thanks for your comments. But I don't have any control to change TransportClient. Also I've tried many methods to make a connection and found Elasticsearch is not connected to the private or generated network in Docker. If I ran the same out of Docker working fine.

---

<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:** [May 4, 2020, 10:47am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/5 "2020-05-04T10:47:25Z")

</div>

Does it mean that you are not writing the Java code?

---

<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:** [June 1, 2020, 10:47am UTC](https://discuss.elastic.co/t/failed-to-connect-to-node-localhost-127-0-0-1-9300-removed-from-nodes-list/226640/6 "2020-06-01T10:47:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
