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

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

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

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.

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.

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

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