Contêiner do Docker Elasticsearch incapaz de enrolar fora do contêiner

1

Iniciando um contêiner usando docker run -it -p 9200:9200 -p 9300:9300 elasticsearch

/local/elasticsearch/bin/elasticsearch: line 184: hostname: command not found
[2018-01-31T07:13:47,062][INFO ][o.e.n.Node               ] [] initializing ...
[2018-01-31T07:13:47,190][INFO ][o.e.e.NodeEnvironment    ] [7l2eIAu] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [9.2gb], net total_space [9.9gb], spins? [unknown], types [rootfs]
[2018-01-31T07:13:47,190][INFO ][o.e.e.NodeEnvironment    ] [7l2eIAu] heap size [1.9gb], compressed ordinary object pointers [true]
[2018-01-31T07:13:47,192][INFO ][o.e.n.Node               ] node name [7l2eIAu] derived from node ID [7l2eIAucSYmZ6CCHrtOZkg]; set [node.name] to override
[2018-01-31T07:13:47,194][INFO ][o.e.n.Node               ] version[5.5.0], pid[1], build[260387d/2017-06-30T23:16:05.735Z], OS[Linux/3.10.0-693.11.6.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_161/25.161-b14]
[2018-01-31T07:13:47,194][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -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=/local/elasticsearch]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [aggs-matrix-stats]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [ingest-common]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-expression]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-groovy]
[2018-01-31T07:13:48,844][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-mustache]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [lang-painless]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [parent-join]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [percolator]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [reindex]
[2018-01-31T07:13:48,845][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [transport-netty3]
[2018-01-31T07:13:48,846][INFO ][o.e.p.PluginsService     ] [7l2eIAu] loaded module [transport-netty4]
[2018-01-31T07:13:48,846][INFO ][o.e.p.PluginsService     ] [7l2eIAu] no plugins loaded
[2018-01-31T07:13:51,816][INFO ][o.e.d.DiscoveryModule    ] [7l2eIAu] using discovery type [zen]
[2018-01-31T07:13:52,824][INFO ][o.e.n.Node               ] initialized
[2018-01-31T07:13:52,824][INFO ][o.e.n.Node               ] [7l2eIAu] starting ...
[2018-01-31T07:13:53,014][INFO ][o.e.t.TransportService   ] [7l2eIAu] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2018-01-31T07:13:53,027][WARN ][o.e.b.BootstrapChecks    ] [7l2eIAu] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-01-31T07:13:56,091][INFO ][o.e.c.s.ClusterService   ] [7l2eIAu] new_master {7l2eIAu}{7l2eIAucSYmZ6CCHrtOZkg}{N4Npv8ZCQZe8NSQ7yr1BgQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2018-01-31T07:13:56,144][INFO ][o.e.h.n.Netty4HttpServerTransport] [7l2eIAu] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2018-01-31T07:13:56,144][INFO ][o.e.n.Node               ] [7l2eIAu] started
[2018-01-31T07:13:56,160][INFO ][o.e.g.GatewayService     ] [7l2eIAu] recovered [0] indices into cluster_state
========================================================

Dentro do contêiner, consigo acessar o Elasticsearch usando o curl.

[elasticsearch@df69f59c016f /]$ curl localhost:9200

{
  "name" : "7l2eIAu",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "FEhCecNWRuOi7qCynVmTrw",
  "version" : {
    "number" : "5.5.0",
    "build_hash" : "260387d",
    "build_date" : "2017-06-30T23:16:05.735Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}
==========================================

Mas quando tento enrolar fora do contêiner, recebo o erro abaixo.

[root@ip-20-0-0-86 ~]# curl localhost:9200
curl: (56) Recv failure: Connection reset by peer
[root@ip-20-0-0-86 ~]# curl localhost:9300
curl: (56) Recv failure: Connection reset by peer
[root@ip-20-0-0-86 ~]# curl 127.0.0.1:9300
curl: (56) Recv failure: Connection reset by peer
    
por Shuaib Shaikh 31.01.2018 / 08:31

1 resposta

0

O publish_address está configurado para localhost com sua configuração: 127.0.0.1:9200 .

Você pode alterar a configuração correspondente assim ao iniciar o contêiner do Elasticsearch:

docker run -p 9200:9200 elasticsearch -Ehttp.host=0.0.0.0
    
por 17.02.2018 / 01:48