Some background
Im using TCP client on Scala to connect to my elasticsearch container on docker but im having issues with the client not finding the configured nodes. Im used kitematic to setup the official docker image but have modified the elasticsearch.yml to see if any changes there could fix my problem
val logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)
val settings = Settings
.builder()
.put("cluster.name", "elasticsearch")
.put("client.transport.sniff", false)
.build()
lazy val client = TcpClient.transport(settings, ElasticsearchClientUri("localhost", 9300))
client.execute {
indexInto("bank" / "account") fields
(
"account_number" -> 1001,
"balance" -> 400,
"firstName" -> "Lorenzo",
"lastName" -> "Prinsloo",
"age" -> 23,
"gender" -> "M",
"address" -> "4 Durmonte Durbanville",
"employer" -> "Full Facing",
"email" -> "cmlprinsloo@gmail.com",
"city" -> "Cape Town",
"state" -> "Western Province"
) refresh RefreshPolicy.IMMEDIATE
}.await
val resp = client.execute {
search("bank" / "account") query "Lorenzo"
}.await
println(resp)
client.close()
Using netcat i could query and see my port was indeed open to connections
localhost [127.0.0.1] 9300 (vrace) open
But when i run my service i run into this exception
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available:
[{#transport#-1}{JJcLvuDWR5aJMHUjl6LsOw}{localhost}{127.0.0.1:9300}]]
my container logs show that the service is booting up properly
[2018-06-14T13:07:10,271][INFO ][o.e.n.Node ] [] initializing ...
[2018-06-14T13:07:10,518][INFO ][o.e.e.NodeEnvironment ] [YI3y6fJ] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [52.6gb], net total_space [58.4gb], spins? [possibly], types [ext4]
[2018-06-14T13:07:10,518][INFO ][o.e.e.NodeEnvironment ] [YI3y6fJ] heap size [1.9gb], compressed ordinary object pointers [true]
[2018-06-14T13:07:10,521][INFO ][o.e.n.Node ] node name [YI3y6fJ] derived from node ID [YI3y6fJyRqm452oGIgWWlA]; set [node.name] to override
[2018-06-14T13:07:10,521][INFO ][o.e.n.Node ] version[5.6.9], pid[1], build[877a590/2018-04-12T16:25:14.838Z], OS[Linux/4.9.87-linuxkit-aufs/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_171/25.171-b11]
[2018-06-14T13:07:10,522][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/elasticsearch]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [aggs-matrix-stats]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [ingest-common]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [lang-expression]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [lang-groovy]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [lang-mustache]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [lang-painless]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [parent-join]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [percolator]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [reindex]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [transport-netty3]
[2018-06-14T13:07:13,426][INFO ][o.e.p.PluginsService ] [YI3y6fJ] loaded module [transport-netty4]
[2018-06-14T13:07:13,427][INFO ][o.e.p.PluginsService ] [YI3y6fJ] no plugins loaded
[2018-06-14T13:07:15,420][INFO ][o.e.d.DiscoveryModule ] [YI3y6fJ] using discovery type [zen]
[2018-06-14T13:07:16,526][INFO ][o.e.n.Node ] initialized
[2018-06-14T13:07:16,526][INFO ][o.e.n.Node ] [YI3y6fJ] starting ...
[2018-06-14T13:07:16,739][INFO ][o.e.t.TransportService ] [YI3y6fJ] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2018-06-14T13:07:19,843][INFO ][o.e.c.s.ClusterService ] [YI3y6fJ] new_master {YI3y6fJ}{YI3y6fJyRqm452oGIgWWlA}{CcSm0unAQmiB1UjgQO2Itw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)[, ]
[2018-06-14T13:07:19,868][INFO ][o.e.h.n.Netty4HttpServerTransport] [YI3y6fJ] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
[2018-06-14T13:07:19,869][INFO ][o.e.n.Node ] [YI3y6fJ] started
[2018-06-14T13:07:19,891][INFO ][o.e.g.GatewayService ] [YI3y6fJ] recovered [0] indices into cluster_state
my elasticsearch.yml
http.host: 0.0.0.0
cluster.name: "elasticsearch"
client.transport.sniff: true
Any help would be appreciated