"failed to connect node" Transport Client

Hello !

For my studies, I need to use ElasticSearch in Java, creating a project with Maven.
I've got a problem with my Transport Client. I don't know if my installation is correct, so tell me if there's something wrong. I tried to follow the different instructions.

This is my Application.java code :

package com.mycompany.app;
import org.elasticsearch.transport.client.*;


import java.util.*;
import java.io.IOException;
import java.net.InetAddress;

import org.elasticsearch.client.transport.*;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import java.net.UnknownHostException;


public class Application {

    public static void main(String[] args) {
        
        System.out.println("Hello World !");

        
        try{
        TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
        client.close();
        }catch(UnknownHostException ex){
            ex.printStackTrace();
        }

    }

}

This is my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-app</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.elasticsearch.client</groupId>
      <artifactId>transport</artifactId>
      <version>5.3.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.8.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.8.2</version>
    </dependency>
  </dependencies>
</project>

My log4j2.properties :

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout

rootLogger.level = info
rootLogger.appenderRef.console.ref = console

Thank you for all your answers ! :wink:

Finally, this is my error in Eclipse !

    Hello World !
    no modules loaded
    loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
    loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
    loaded plugin [org.elasticsearch.script.mustache.MustachePlugin]
    loaded plugin [org.elasticsearch.transport.Netty3Plugin]
    loaded plugin [org.elasticsearch.transport.Netty4Plugin]
    failed to connect to node [{#transport#-1}{u8hPj1NFSpmx9o6g20NJRw}{localhost}{127.0.0.1:9300}], removed from nodes list
    org.elasticsearch.transport.ConnectTransportException: [][127.0.0.1:9300] connect_timeout[30s]
        at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:359) ~[transport-netty4-client-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:495) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:460) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:314) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:408) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:354) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddresses(TransportClientNodesService.java:195) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:322) [elasticsearch-5.3.2.jar:5.3.2]
        at com.mycompany.app.Application.main(Application.java:37) [classes/:?]
    Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connexion refusée: localhost/127.0.0.1:9300
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_121]
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_121]
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:346) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:630) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:527) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:481) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[netty-common-4.1.7.Final.jar:4.1.7.Final]
        at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_121]
    failed to connect to node [{#transport#-1}{u8hPj1NFSpmx9o6g20NJRw}{localhost}{127.0.0.1:9300}], removed from nodes list
    org.elasticsearch.transport.ConnectTransportException: [][127.0.0.1:9300] connect_timeout[30s]
        at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:359) ~[transport-netty4-client-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:495) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:460) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:314) ~[elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:408) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:354) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:387) [elasticsearch-5.3.2.jar:5.3.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-5.3.2.jar:5.3.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
    Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connexion refusée: localhost/127.0.0.1:9300
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_121]
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_121]
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:346) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:630) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:527) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:481) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441) ~[netty-transport-4.1.7.Final.jar:4.1.7.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[netty-common-4.1.7.Final.jar:4.1.7.Final]
        ... 1 more

What are the elasticsearch logs looking like? Can you share them?

What are the elastic search logs ? Indeed, i think that I forgot to download something. How can I find them ?

You are connecting your client to a server, don't you?

I mean that did you start elasticsearch at all?

Sorry, i'm newbie ! That's all my logs in my ElasticSearch 5.2.2 folder :wink:
elasticsearch.log
elasticsearch-2017-03-02.log
elasticsearch-2017-03-04.log
elastic_deprecation.log
elastic_index_indexing_slowlog.log
elasticsearch_index_search_slowlog.log

elasticsearch.log

[2017-03-05T19:15:13,496][INFO ][o.e.n.Node               ] [] initializing ...
[2017-03-05T19:15:17,950][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [10.8gb], net total_space [18.1gb], spins? [possibly], types [ext4]
[2017-03-05T19:15:17,951][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] heap size [1.9gb], compressed ordinary object pointers [unknown]
[2017-03-05T19:15:19,151][INFO ][o.e.n.Node               ] node name [T4iFnvH] derived from node ID [T4iFnvHzTeKu4URTqOjdOg]; set [node.name] to override
[2017-03-05T19:15:19,330][INFO ][o.e.n.Node               ] version[5.2.2], pid[2106], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/3.13.0-49-generic/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]
[2017-03-05T19:15:26,468][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [aggs-matrix-stats]
[2017-03-05T19:15:26,471][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [ingest-common]
[2017-03-05T19:15:26,471][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-expression]
[2017-03-05T19:15:26,471][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-groovy]
[2017-03-05T19:15:26,471][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-mustache]
[2017-03-05T19:15:26,471][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-painless]
[2017-03-05T19:15:26,472][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [percolator]
[2017-03-05T19:15:26,477][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [reindex]
[2017-03-05T19:15:26,477][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty3]
[2017-03-05T19:15:26,478][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty4]
[2017-03-05T19:15:26,478][INFO ][o.e.p.PluginsService     ] [T4iFnvH] no plugins loaded
[2017-03-05T19:15:39,844][INFO ][o.e.n.Node               ] initialized
[2017-03-05T19:15:39,845][INFO ][o.e.n.Node               ] [T4iFnvH] starting ...
[2017-03-05T19:15:40,603][INFO ][o.e.t.TransportService   ] [T4iFnvH] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-03-05T19:15:40,618][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2017-03-05T19:15:40,619][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-03-05T19:15:43,767][INFO ][o.e.c.s.ClusterService   ] [T4iFnvH] new_master {T4iFnvH}{T4iFnvHzTeKu4URTqOjdOg}{eKZ7TKegRqKUSyQDg7CVWg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-05T19:15:45,774][INFO ][o.e.h.HttpServer         ] [T4iFnvH] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-03-05T19:15:45,776][INFO ][o.e.n.Node               ] [T4iFnvH] started
[2017-03-05T19:15:48,023][INFO ][o.e.g.GatewayService     ] [T4iFnvH] recovered [2] indices into cluster_state
[2017-03-05T19:15:49,675][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][young][9][10] duration [1.4s], collections [1]/[1.7s], total [1.4s]/[3.3s], memory [73.2mb]->[57.3mb]/[1.9gb], all_pools {[young] [48.5mb]->[111.1kb]/[51.2mb]}{[survivor] [4.3mb]->[3.4mb]/[6.3mb]}{[old] [20.2mb]->[53.9mb]/[1.9gb]}
[2017-03-05T19:15:49,675][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][9] overhead, spent [1.4s] collecting in the last [1.7s]
[2017-03-05T19:15:50,689][INFO ][o.e.c.r.a.AllocationService] [T4iFnvH] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[magasin][3], [magasin][4], [magasin][1]] ...]).

Do you want the different contents of all the files ?

elasticsearch-2017-03-04 :

[2017-03-04T12:15:57,317][INFO ][o.e.n.Node               ] [] initializing ...
[2017-03-04T12:15:58,682][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [10.8gb], net total_space [18.1gb], spins? [possibly], types [ext4]
[2017-03-04T12:15:58,683][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] heap size [1.9gb], compressed ordinary object pointers [unknown]
[2017-03-04T12:15:58,685][INFO ][o.e.n.Node               ] node name [T4iFnvH] derived from node ID [T4iFnvHzTeKu4URTqOjdOg]; set [node.name] to override
[2017-03-04T12:15:58,924][INFO ][o.e.n.Node               ] version[5.2.2], pid[2113], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/3.13.0-49-generic/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]
[2017-03-04T12:16:04,668][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [aggs-matrix-stats]
[2017-03-04T12:16:04,668][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [ingest-common]
[2017-03-04T12:16:04,669][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-expression]
[2017-03-04T12:16:04,669][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-groovy]
[2017-03-04T12:16:04,669][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-mustache]
[2017-03-04T12:16:04,669][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-painless]
[2017-03-04T12:16:04,670][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [percolator]
[2017-03-04T12:16:04,670][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [reindex]
[2017-03-04T12:16:04,671][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty3]
[2017-03-04T12:16:04,671][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty4]
[2017-03-04T12:16:04,671][INFO ][o.e.p.PluginsService     ] [T4iFnvH] no plugins loaded
[2017-03-04T12:16:18,868][INFO ][o.e.n.Node               ] initialized
[2017-03-04T12:16:18,868][INFO ][o.e.n.Node               ] [T4iFnvH] starting ...
[2017-03-04T12:16:20,221][INFO ][o.e.t.TransportService   ] [T4iFnvH] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-03-04T12:16:20,267][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2017-03-04T12:16:20,271][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-03-04T12:16:23,631][INFO ][o.e.c.s.ClusterService   ] [T4iFnvH] new_master {T4iFnvH}{T4iFnvHzTeKu4URTqOjdOg}{EL5jE33CSimnJsVvDtzrJg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-04T12:16:23,835][INFO ][o.e.h.HttpServer         ] [T4iFnvH] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-03-04T12:16:23,836][INFO ][o.e.n.Node               ] [T4iFnvH] started
[2017-03-04T12:16:23,939][INFO ][o.e.g.GatewayService     ] [T4iFnvH] recovered [0] indices into cluster_state
[2017-03-04T12:27:55,376][INFO ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][696] overhead, spent [400ms] collecting in the last [1s]
[2017-03-04T12:27:55,514][INFO ][o.e.c.m.MetaDataCreateIndexService] [T4iFnvH] [magasin] creating index, cause [auto(index api)], templates [], shards [5]/[1], mappings []
[2017-03-04T13:14:44,073][INFO ][o.e.n.Node               ] [] initializing ...
[2017-03-04T13:14:45,326][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [10.8gb], net total_space [18.1gb], spins? [possibly], types [ext4]
[2017-03-04T13:14:45,327][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] heap size [1.9gb], compressed ordinary object pointers [unknown]
[2017-03-04T13:14:45,852][INFO ][o.e.n.Node               ] node name [T4iFnvH] derived from node ID [T4iFnvHzTeKu4URTqOjdOg]; set [node.name] to override
[2017-03-04T13:14:45,927][INFO ][o.e.n.Node               ] version[5.2.2], pid[2150], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/3.13.0-49-generic/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]
[2017-03-04T13:14:52,488][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [aggs-matrix-stats]
[2017-03-04T13:14:52,489][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [ingest-common]
[2017-03-04T13:14:52,489][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-expression]
[2017-03-04T13:14:52,490][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-groovy]
[2017-03-04T13:14:52,490][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-mustache]
[2017-03-04T13:14:52,490][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-painless]
[2017-03-04T13:14:52,490][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [percolator]
[2017-03-04T13:14:52,490][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [reindex]
[2017-03-04T13:14:52,491][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty3]
[2017-03-04T13:14:52,491][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty4]
[2017-03-04T13:14:52,493][INFO ][o.e.p.PluginsService     ] [T4iFnvH] no plugins loaded
[2017-03-04T13:15:01,407][INFO ][o.e.n.Node               ] initialized
[2017-03-04T13:15:01,407][INFO ][o.e.n.Node               ] [T4iFnvH] starting ...
[2017-03-04T13:15:02,354][INFO ][o.e.t.TransportService   ] [T4iFnvH] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-03-04T13:15:02,384][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2017-03-04T13:15:02,384][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-03-04T13:15:03,478][INFO ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][2] overhead, spent [288ms] collecting in the last [1s]
[2017-03-04T13:15:05,562][INFO ][o.e.c.s.ClusterService   ] [T4iFnvH] new_master {T4iFnvH}{T4iFnvHzTeKu4URTqOjdOg}{R4q6gmHAQ5qTT3lfRSezSQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-04T13:15:05,725][INFO ][o.e.h.HttpServer         ] [T4iFnvH] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}

The rest of the file :

    [2017-03-04T13:15:05,726][INFO ][o.e.n.Node               ] [T4iFnvH] started
    [2017-03-04T13:15:06,082][INFO ][o.e.g.GatewayService     ] [T4iFnvH] recovered [1] indices into cluster_state
    [2017-03-04T13:15:07,311][INFO ][o.e.c.r.a.AllocationService] [T4iFnvH] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[magasin][0]] ...]).
    [2017-03-04T13:15:07,482][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][6] overhead, spent [535ms] collecting in the last [1s]
    [2017-03-04T13:17:23,992][INFO ][o.e.c.m.MetaDataCreateIndexService] [T4iFnvH] [movies] creating index, cause [auto(index api)], templates [], shards [5]/[1], mappings []
    [2017-03-04T13:17:25,026][INFO ][o.e.c.m.MetaDataMappingService] [T4iFnvH] [movies/d4ehju63RKOXRtogL9ZE5A] create_mapping [movie]

Can you try with:

InetAddress.getByName("127.0.0.1")

BTW what process created the movies index?

It's the same with your proposition about the "127.0.0.1".
The movies index was created when I wanted to try ElasticSearch with Linux Terminal. I took an example on the web, and I pasted it in my terminal to understand how works ElasticSearch.

Knowing that I installed ElasticSearch and Maven for my project, should I try to install this softwares again ?
I think that it's a problem about configuration.
I tried to foolow some tutorials on the web. And I copied-pasted !

What is your elasticsearch.yml file?

My elasticsearch.yml :

   # ======================== Elasticsearch Configuration =========================
    #
    # NOTE: Elasticsearch comes with reasonable defaults for most settings.
    #       Before you set out to tweak and tune the configuration, make sure you
    #       understand what are you trying to accomplish and the consequences.
    #
    # The primary way of configuring a node is via this file. This template lists
    # the most important settings you may want to configure for a production cluster.
    #
    # Please consult the documentation for further information on configuration options:
    # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
    #
    # ---------------------------------- Cluster -----------------------------------
    #
    # Use a descriptive name for your cluster:
    #
    #cluster.name: my-application
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    #
    #node.name: node-1
    #
    # Add custom attributes to the node:
    #
    #node.attr.rack: r1
    #
    # ----------------------------------- Paths ------------------------------------
    #
    # Path to directory where to store the data (separate multiple locations by comma):
    #
    #path.data: /path/to/data
    #
    # Path to log files:
    #
    #path.logs: /path/to/logs
    #
    # ----------------------------------- Memory -----------------------------------
    #
    # Lock the memory on startup:
    #
    #bootstrap.memory_lock: true
    #
    # Make sure that the heap size 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):
    #
    #network.host: 192.168.0.1
    #
    # Set a custom port for HTTP:
    #
    #http.port: 9200
    #
    # For more information, consult the network module documentation.
    #
    # --------------------------------- Discovery ----------------------------------
    #
    # Pass an initial list of hosts to perform discovery when new node is started:
    # The default list of hosts is ["127.0.0.1", "[::1]"]
    #
    #discovery.zen.ping.unicast.hosts: ["host1", "host2"]
    #
    # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
    #
    #discovery.zen.minimum_master_nodes: 3
    #
    # For more information, consult the zen discovery module documentation.
    #
    # ---------------------------------- Gateway -----------------------------------
    #
    # Block initial recovery after a full cluster restart until N nodes are started:
    #
    #gateway.recover_after_nodes: 3
    #
    # For more information, consult the gateway module documentation.
    #
    # ---------------------------------- Various -----------------------------------
    #
    # Require explicit names when deleting indices:
    #
    #action.destructive_requires_name: true

How do you launch elasticsearch?
Is it actually running? I mean can you run a curl 127.0.0.1:9200

Can you paste the result?

Which OS?

When I run bin/elasticsearch

   [2017-05-17T07:03:48,750][INFO ][o.e.n.Node               ] [] initializing ...
    [2017-05-17T07:03:52,208][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [9.1gb], net total_space [18.1gb], spins? [possibly], types [ext4]
    [2017-05-17T07:03:52,215][INFO ][o.e.e.NodeEnvironment    ] [T4iFnvH] heap size [1.9gb], compressed ordinary object pointers [unknown]
    [2017-05-17T07:03:52,956][INFO ][o.e.n.Node               ] node name [T4iFnvH] derived from node ID [T4iFnvHzTeKu4URTqOjdOg]; set [node.name] to override
    [2017-05-17T07:03:53,206][INFO ][o.e.n.Node               ] version[5.2.2], pid[2697], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/3.13.0-49-generic/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]
    [2017-05-17T07:04:21,322][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [aggs-matrix-stats]
    [2017-05-17T07:04:21,341][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [ingest-common]
    [2017-05-17T07:04:21,347][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-expression]
    [2017-05-17T07:04:21,364][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-groovy]
    [2017-05-17T07:04:21,365][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-mustache]
    [2017-05-17T07:04:21,365][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [lang-painless]
    [2017-05-17T07:04:21,366][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [percolator]
    [2017-05-17T07:04:21,371][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [reindex]
    [2017-05-17T07:04:21,382][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty3]
    [2017-05-17T07:04:21,394][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded module [transport-netty4]
    [2017-05-17T07:04:21,417][INFO ][o.e.p.PluginsService     ] [T4iFnvH] loaded plugin [ingest-attachment]
    [2017-05-17T07:05:47,874][INFO ][o.e.n.Node               ] initialized
    [2017-05-17T07:05:47,881][INFO ][o.e.n.Node               ] [T4iFnvH] starting ...
    [2017-05-17T07:05:52,427][INFO ][o.e.t.TransportService   ] [T4iFnvH] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
    [2017-05-17T07:05:52,738][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
    [2017-05-17T07:05:52,741][WARN ][o.e.b.BootstrapChecks    ] [T4iFnvH] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    [2017-05-17T07:05:58,135][INFO ][o.e.c.s.ClusterService   ] [T4iFnvH] new_master {T4iFnvH}{T4iFnvHzTeKu4URTqOjdOg}{D-0qgfsTRWStTjH-CbmBnw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
    [2017-05-17T07:06:00,885][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][young][11][10] duration [1.9s], collections [1]/[2.5s], total [1.9s]/[12.4s], memory [68mb]->[54.2mb]/[1.9gb], all_pools {[young] [46.9mb]->[16.8mb]/[51.2mb]}{[survivor] [6.3mb]->[4.9mb]/[6.3mb]}{[old] [14.7mb]->[32.6mb]/[1.9gb]}
    [2017-05-17T07:06:00,890][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][11] overhead, spent [1.9s] collecting in the last [2.5s]
    [2017-05-17T07:06:01,342][INFO ][o.e.h.HttpServer         ] [T4iFnvH] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
    [2017-05-17T07:06:01,345][INFO ][o.e.n.Node               ] [T4iFnvH] started
    [2017-05-17T07:06:08,035][INFO ][o.e.g.GatewayService     ] [T4iFnvH] recovered [2] indices into cluster_state
    [2017-05-17T07:06:18,710][INFO ][o.e.c.r.a.AllocationService] [T4iFnvH] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[magasin][1]] ...]).
    [2017-05-17T07:14:55,942][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][young][539][11] duration [3.7s], collections [1]/[4.5s], total [3.7s]/[16.2s], memory [88.5mb]->[54.6mb]/[1.9gb], all_pools {[young] [50.9mb]->[126.7kb]/[51.2mb]}{[survivor] [4.9mb]->[4.5mb]/[6.3mb]}{[old] [32.6mb]->[50mb]/[1.9gb]}
    [2017-05-17T07:14:55,989][WARN ][o.e.m.j.JvmGcMonitorService] [T4iFnvH] [gc][539] overhead, spent [3.7s] collecting in the last [4.5s]

About the localhost

{
  "name" : "T4iFnvH",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "b_Ua59QCTw-O8vMqMGHhIA",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

It should work but please update your client to the same server version.
And test again.

Thanks.

How can I do this ? Thanks.

Change your pom.xml.

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