Using Elasticsearch in java through TransportClient -
i trying use elasticsearch in java through transportclient. have used logstash integrate mysql elasticsearch. how have initialized , used transport client
transportclient client = new prebuilttransportclient(settings.empty).addtransportaddress(new inetsockettransportaddress(inetaddress.getbyname("localhost"),9200));
i unable connect node , handshake timeout. following error:
transportclientnodesservice - failed connect node [{#transport#-1}{vrvvu4mgtac7_5ncoibseg}{localhost}{127.0.0.1:9200}], ignoring... org.elasticsearch.transport.connecttransportexception: [][127.0.0.1:9200] handshake_timeout[30s] @ org.elasticsearch.transport.tcptransport.executehandshake(tcptransport.java:1614) ~[elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.transport.tcptransport.openconnection(tcptransport.java:555) ~[elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.transport.tcptransport.openconnection(tcptransport.java:116) ~[elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.transport.transportservice.openconnection(transportservice.java:351) ~[elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.client.transport.transportclientnodesservice$simplenodesampler.dosample(transportclientnodesservice.java:407) [elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.client.transport.transportclientnodesservice$nodesampler.sample(transportclientnodesservice.java:357) [elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.client.transport.transportclientnodesservice$schedulednodesampler.run(transportclientnodesservice.java:390) [elasticsearch-5.5.2.jar:5.5.2] @ org.elasticsearch.common.util.concurrent.threadcontext$contextpreservingrunnable.run(threadcontext.java:569) [elasticsearch-5.5.2.jar:5.5.2] @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) [?:1.8.0_131] @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) [?:1.8.0_131] @ java.lang.thread.run(thread.java:748) [?:1.8.0_131]
elasticsearch transport port 9300
change client creation line replacing 9200 9300
shown below:
transportclient client = new prebuilttransportclient(settings.empty).addtransportaddress(new inetsockettransportaddress(inetaddress.getbyname("localhost"),9300));
find related documentation here.
if using different cluster.name
other default(elasticsearch
) must set while creating transportclient shown below:
settings settings = settings.builder() .put("cluster.name", "myclustername").build(); transportclient client = new prebuilttransportclient(settings); //add transport addresses , client...
Comments
Post a Comment