Transport Client issue with ES cloud

Hi All,

I am unable to connect ES cloud with transport client version(5.6.8).Its showing error as None of the configured nodes are available.

Here is the my java Example which I have taken from github(https://github.com/elastic/found-shield-example/blob/master/src/main/java/org/elasticsearch/cloud/transport/example/TransportExample.java).

Also i have tried from public network and different port combination 9243,9343.

So my Question is it possible to connect ES cloud(5.7) version with Transport Client.

Can some Please help me to resolve this issue.

Regards
Chhavi

FWIW you should look at https://github.com/elastic/found-shield-example/blob/5.1.1/src/main/java/org/elasticsearch/cloud/transport/example/TransportExample.java which is probably closer to what to expect on a 5.x version.

May be share your code and the exact and full error message you are getting.

Please follow the formatting rules in this guideline: About the Elasticsearch category.

Hi Dadoonet,

I am using code exactly which you share in link with 9243,9343 port.Please find code and exception below.Also tried with public network.

Code :

public class TransportExample {

    public Logger logger = ESLoggerFactory.getLogger(getClass().getCanonicalName());
    // Note: If enabling IPv6, then you should ensure that your host and network can route it to the Cloud endpoint.
    // (eg Docker disables IPv6 routing by default) - see also the system property parsing code below.
    private boolean ip6Enabled = true;
    private boolean ip4Enabled = true;

    public static void main(String[] args)  {
        new TransportExample().run(args);
    }

    public void run(String[] args) {
         String host = "2160c0d4e57ff12912f8aaaaaaaaaaaa.us-east-1.aws.found.io";
        int port = Integer.parseInt(System.getProperty("port", "9343"));

        String hostBasedClusterName = host.split("\\.", 2)[0];
        String clusterName = System.getProperty("cluster", hostBasedClusterName);

        boolean enableSsl = Boolean.parseBoolean(System.getProperty("ssl", "true"));
        // Note: If enabling IPv6, then you should ensure that your host and network can route it to the Cloud endpoint.
        // (eg Docker disables IPv6 routing by default) - see also the initialization code at the top of this file.
        ip6Enabled = Boolean.parseBoolean(System.getProperty("ip6", "true"));
        ip4Enabled = Boolean.parseBoolean(System.getProperty("ip4", "true"));

        logger.info("Connecting to cluster: [{}] via [{}:{}] using ssl:[{}]", clusterName, host, port, enableSsl);

        // Build the settings for our client.
        Settings settings = Settings.builder()
            .put("client.transport.nodes_sampler_interval", "5s")
            .put("client.transport.sniff", false)
            .put("transport.tcp.compress", true)
            .put("cluster.name", clusterName)
            .put("xpack.security.transport.ssl.enabled", enableSsl)
            .put("request.headers.X-Found-Cluster", "${cluster.name}")
            .put("xpack.security.user", "username:password")
            .build();

        // Instantiate a TransportClient and add the cluster to the list of addresses to connect to.
        // Only port 9343 (SSL-encrypted) is currently supported. The use of X-Pack security features (formerly Shield) is required.
        TransportClient client = new PreBuiltXPackTransportClient(settings);
        try {
            for (InetAddress address : InetAddress.getAllByName(host)) {
                if ((ip6Enabled && address instanceof Inet6Address)
                        || (ip4Enabled && address instanceof Inet4Address)) {
                    client.addTransportAddress(new InetSocketTransportAddress(address, port));
                }
            }
        } catch (UnknownHostException e) {
            logger.error("Unable to get the host", e.getMessage());
        }

        while(true) {
            try {
                logger.info("Getting cluster health... ");
                ActionFuture<ClusterHealthResponse> healthFuture = client.admin().cluster().health(Requests.clusterHealthRequest());
                ClusterHealthResponse healthResponse = healthFuture.get(5, TimeUnit.SECONDS);
                logger.info("Got cluster health response: [{}]", healthResponse.getStatus());
            } catch(Throwable t) {
                logger.error("Unable to get cluster health response: [{}]", t.getMessage());
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ie) { ie.printStackTrace(); }
        }
    }
}

Exception:

08:25:01.339 [main] ERROR javaapplication21.TransportExample - Unable to get cluster health response: [None of the configured nodes are available: [{#transport#-1}{ZFOMH60GQgKMdxQMbzxY7Q}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{50.16.214.212:9343}, {#transport#-2}{HJi0ZrhvQuyxXbmmMS-fPg}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.204.11.42:9343}, {#transport#-3}{vKEGIwwJQ6uzUG55kfVvMA}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.197.233.100:9343}, {#transport#-4}{0qTkNoKORrW-AHcZVomvMQ}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.225.145.66:9343}, {#transport#-5}{NOHIVbq0Q--uPDF8jG-KYw}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.235.188.40:9343}, {#transport#-6}{KZ7bCyrbTh6N21z06fLPYg}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.243.142.98:9343}, {#transport#-7}{zSDlpeH1TDCdMmSRnIhKiA}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{50.17.198.49:9343}, {#transport#-8}{ZOY_xv1GRTua5pJRbkTpAQ}{2160c0d4e57ff12912f8c2798a4e7485.us-east-1.aws.found.io}{54.225.154.35:9343}]]

Regards,
Chhavi

Can you try with port 9300?

Strangely the port 9200 of your instance seems to answer.

Hi Dadoonet,

Thanks for reply,I tried for both the port but still facing same issue.

Regards,
Chhavi

May be contact your cloud support?
Please see https://www.elastic.co/cloud/as-a-service/support on how to raise a support ticket for Elastic Cloud :slight_smile:

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