java - Can not connect to elasticsearch container in docker -


i'm trying use official elasticsearch image docker , followed this guide when i'm trying connect elasticsearch cluster had exception nonodeavailableexception[none of configured nodes available

my code

transportclient client = new prebuilttransportclient(settings.builder().put("cluster.name", "docker-cluster")                 .build())                 .addtransportaddress(new inetsockettransportaddress(inetaddress.getbyname("127.0.0.1"), 9300)); 

to run elasticsearch container used command

docker run -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.2.2 

and when open browser on localhost:9200 browser shows text

{   "name" : "j5oojco",   "cluster_name" : "docker-cluster",   "cluster_uuid" : "sfkgajmat_sb3erfyul7sq",   "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, search" } 

docker logs

[2017-03-28t23:57:47,804][info ][o.e.n.node               ] [] initializing ... [2017-03-28t23:57:48,214][info ][o.e.e.nodeenvironment    ] [s5iaw08] using [1] data paths, mounts [[/ (overlay)]], net usable_space [54.8gb], net total_space [62.7gb], spins? [possibly], types [overlay] [2017-03-28t23:57:48,216][info ][o.e.e.nodeenvironment    ] [s5iaw08] heap size [1.9gb], compressed ordinary object pointers [true] [2017-03-28t23:57:48,224][info ][o.e.n.node               ] node name [s5iaw08] derived node id [s5iaw08lqvupw8s_e8btaq]; set [node.name] override [2017-03-28t23:57:48,233][info ][o.e.n.node               ] version[5.2.2], pid[1], build[f9d9b74/2017-02-24t17:26:45.835z], os[linux/4.9.12-moby/amd64], jvm[oracle corporation/openjdk 64-bit server vm/1.8.0_92-internal/25.92-b14] [2017-03-28t23:57:52,719][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [aggs-matrix-stats] [2017-03-28t23:57:52,719][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [ingest-common] [2017-03-28t23:57:52,720][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [lang-expression] [2017-03-28t23:57:52,721][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [lang-groovy] [2017-03-28t23:57:52,721][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [lang-mustache] [2017-03-28t23:57:52,722][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [lang-painless] [2017-03-28t23:57:52,722][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [percolator] [2017-03-28t23:57:52,723][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [reindex] [2017-03-28t23:57:52,723][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [transport-netty3] [2017-03-28t23:57:52,724][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded module [transport-netty4] [2017-03-28t23:57:52,727][info ][o.e.p.pluginsservice     ] [s5iaw08] loaded plugin [x-pack] [2017-03-28t23:57:54,117][warn ][o.e.d.s.g.groovyscriptengineservice] [groovy] scripts deprecated, use [painless] scripts instead [2017-03-28t23:58:00,388][info ][o.e.n.node               ] initialized [2017-03-28t23:58:00,389][info ][o.e.n.node               ] [s5iaw08] starting ... [2017-03-28t23:58:00,920][warn ][i.n.u.i.macaddressutil   ] failed find usable hardware address network interfaces; using random bytes: 53:a4:67:2d:77:c8:57:b6 [2017-03-28t23:58:01,073][info ][o.e.t.transportservice   ] [s5iaw08] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300} [2017-03-28t23:58:04,224][info ][o.e.c.s.clusterservice   ] [s5iaw08] new_master {s5iaw08}{s5iaw08lqvupw8s_e8btaq}{4xwceyrxtmi7-brwyxhbya}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-03-28t23:58:04,293][info ][o.e.h.httpserver         ] [s5iaw08] publish_address {172.17.0.2:9200}, bound_addresses {[::]:9200} [2017-03-28t23:58:04,295][info ][o.e.n.node               ] [s5iaw08] started [2017-03-28t23:58:04,444][info ][o.e.g.gatewayservice     ] [s5iaw08] recovered [0] indices cluster_state [2017-03-28t23:58:05,622][info ][o.e.l.licenseservice     ] [s5iaw08] license [c0268fbc-15ce-418c-aacc-5b9d7c3cbaf7] mode [trial] - valid [2017-03-28t23:58:10,747][info ][o.e.c.m.metadatacreateindexservice] [s5iaw08] [.monitoring-data-2] creating index, cause [auto(bulk api)], templates [.monitoring-data-2], shards [1]/[1], mappings [node, _default_, logstash, cluster_info, kibana] [2017-03-28t23:58:11,017][info ][o.e.c.m.metadatacreateindexservice] [s5iaw08] [.monitoring-es-2-2017.03.28] creating index, cause [auto(bulk api)], templates [.monitoring-es-2], shards [1]/[1], mappings [shards, _default_, node, index_stats, index_recovery, cluster_state, cluster_stats, indices_stats, node_stats] [2017-03-28t23:58:11,598][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.28/kmxirx3-r-g_ngo8rficza] update_mapping [cluster_stats] [2017-03-28t23:58:11,852][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.28/kmxirx3-r-g_ngo8rficza] update_mapping [node_stats] [2017-03-28t23:58:22,105][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.28/kmxirx3-r-g_ngo8rficza] update_mapping [cluster_stats] [2017-03-28t23:58:22,192][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.28/kmxirx3-r-g_ngo8rficza] update_mapping [indices_stats] [2017-03-28t23:58:22,264][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.28/kmxirx3-r-g_ngo8rficza] update_mapping [index_stats] [2017-03-28t23:58:44,237][info ][o.e.m.j.jvmgcmonitorservice] [s5iaw08] [gc][43] overhead, spent [668ms] collecting in last [1.5s] [2017-03-28t23:59:14,284][info ][o.e.m.j.jvmgcmonitorservice] [s5iaw08] [gc][73] overhead, spent [306ms] collecting in last [1s] [2017-03-29t00:00:03,456][info ][o.e.c.m.metadatacreateindexservice] [s5iaw08] [.monitoring-es-2-2017.03.29] creating index, cause [auto(bulk api)], templates [.monitoring-es-2], shards [1]/[1], mappings [shards, _default_, node, index_stats, index_recovery, cluster_state, cluster_stats, indices_stats, node_stats] [2017-03-29t00:00:03,685][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.29/fulovogfthmvcpl0rs99hg] update_mapping [cluster_stats] [2017-03-29t00:00:03,774][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.29/fulovogfthmvcpl0rs99hg] update_mapping [node_stats] [2017-03-29t00:00:03,856][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.29/fulovogfthmvcpl0rs99hg] update_mapping [indices_stats] [2017-03-29t00:00:03,909][info ][o.e.c.m.metadatamappingservice] [s5iaw08] [.monitoring-es-2-2017.03.29/fulovogfthmvcpl0rs99hg] update_mapping [index_stats] 

health link

1490745899 00:04:59 docker-cluster yellow 1 1 3 3 0 0 3 0 - 50.0% 

thanks in advance.

update

the official guide says image built x-pack, tried disable xpack security, , succeeded connect elastic seacrh container using 127.0.0.1:9300

thanks.

i don't know why docs instruct that, when pass 127.0.0.1 transport host binding made address, , therefore not accessible outside container.

try define transport.host 0.0.0.0 too, binds container ip.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -