问题
New to docker and ELK stack.
I referred to this doc, for running elastic search in docker.
Docker container command says, elastic search is up in 9200 and 9300.,
CONTAINER ID : ef87e2bccee9
IMAGE: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
CREATED: 18 minutes ago
STATUS: Up 18 minutes
PORTS: 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp
NAMES: dreamy_roentgen
And elastic search logs says
C:\Windows\system32>docker run -p 9200:9200 -p 9300:9300 -e
"discovery.type=single-node"
docker.elastic.co/elasticsearch/elasticsearch:6.6.1
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=0
[2019-02-23T04:18:00,510][INFO ][o.e.e.NodeEnvironment ] [GKy7sPe] using [1] data paths, mounts [[/ (overlay)]], net usable_space [52.3gb], net total_space [58.8gb], types [overlay]
[2019-02-23T04:18:00,542][INFO ][o.e.e.NodeEnvironment ] [GKy7sPe] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-02-23T04:18:00,561][INFO ][o.e.n.Node ] [GKy7sPe] node name derived from node ID [GKy7sPeERPaWgzMLoxWQFg]; set [node.name] to override
[2019-02-23T04:18:00,589][INFO ][o.e.n.Node ] [GKy7sPe] version[6.6.1], pid[1], build[default/tar/1fd8f69/2019-02-13T17:10:04.160291Z], OS[Linux/4.9.125-linuxkit/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13]
[2019-02-23T04:18:00,592][INFO ][o.e.n.Node ] [GKy7sPe] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-10308254911807837384, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-02-23T04:18:15,059][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [aggs-matrix-stats]
[2019-02-23T04:18:15,059][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [analysis-common]
[2019-02-23T04:18:15,061][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [ingest-common]
[2019-02-23T04:18:15,063][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [lang-expression]
[2019-02-23T04:18:15,064][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [lang-mustache]
[2019-02-23T04:18:15,068][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [lang-painless]
[2019-02-23T04:18:15,068][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [mapper-extras]
[2019-02-23T04:18:15,070][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [parent-join]
[2019-02-23T04:18:15,071][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [percolator]
[2019-02-23T04:18:15,071][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [rank-eval]
[2019-02-23T04:18:15,072][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [reindex]
[2019-02-23T04:18:15,072][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [repository-url]
[2019-02-23T04:18:15,072][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [transport-netty4]
[2019-02-23T04:18:15,074][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [tribe]
[2019-02-23T04:18:15,087][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-ccr]
[2019-02-23T04:18:15,088][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-core]
[2019-02-23T04:18:15,089][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-deprecation]
[2019-02-23T04:18:15,091][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-graph]
[2019-02-23T04:18:15,094][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-ilm]
[2019-02-23T04:18:15,096][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-logstash]
[2019-02-23T04:18:15,097][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-ml]
[2019-02-23T04:18:15,098][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-monitoring]
[2019-02-23T04:18:15,099][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-rollup]
[2019-02-23T04:18:15,100][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-security]
[2019-02-23T04:18:15,102][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-sql]
[2019-02-23T04:18:15,102][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-upgrade]
[2019-02-23T04:18:15,102][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded module [x-pack-watcher]
[2019-02-23T04:18:15,105][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded plugin [ingest-geoip]
[2019-02-23T04:18:15,105][INFO ][o.e.p.PluginsService ] [GKy7sPe] loaded plugin [ingest-user-agent]
[2019-02-23T04:18:44,704][INFO ][o.e.x.s.a.s.FileRolesStore] [GKy7sPe] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
[2019-02-23T04:18:48,619][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [GKy7sPe] [controller/87] [Main.cc@109] controller (64 bit): Version 6.6.1 (Build a033f1b9679cab) Copyright (c) 2019 Elasticsearch BV
[2019-02-23T04:18:53,554][INFO ][o.e.d.DiscoveryModule ] [GKy7sPe] using discovery type [single-node] and host providers [settings]
[2019-02-23T04:18:57,834][INFO ][o.e.n.Node ] [GKy7sPe] initialized
[2019-02-23T04:18:57,836][INFO ][o.e.n.Node ] [GKy7sPe] starting ...
[2019-02-23T04:18:59,060][INFO ][o.e.t.TransportService ] [GKy7sPe] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
[2019-02-23T04:18:59,423][INFO ][o.e.h.n.Netty4HttpServerTransport] [GKy7sPe] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
[2019-02-23T04:18:59,431][INFO ][o.e.n.Node ] [GKy7sPe] started
[2019-02-23T04:19:00,187][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [GKy7sPe] Failed to clear cache for realms [[]]
[2019-02-23T04:19:00,657][INFO ][o.e.g.GatewayService ] [GKy7sPe] recovered [0] indices into cluster_state
[2019-02-23T04:19:02,610][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2019-02-23T04:19:02,960][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.watches] for index patterns [.watches*]
[2019-02-23T04:19:03,406][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2019-02-23T04:19:03,798][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2019-02-23T04:19:04,277][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2019-02-23T04:19:04,568][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2019-02-23T04:19:04,944][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2019-02-23T04:19:05,265][INFO ][o.e.c.m.MetaDataIndexTemplateService] [GKy7sPe] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2019-02-23T04:19:06,992][INFO ][o.e.l.LicenseService ] [GKy7sPe] license [c7497c27-896c-441b-82c5-c33bc011f901] mode [basic] - valid
When I tried localhost:9200 in my browser, it keeps on waiting for response but elastic search is not responding.
Could someone share some inputs here?
回答1:
Elevating @val 's comment to an answer because I was facing the same issue and the problem is indeed that docker binds to the external IP address and doesn't bind to localhost at all. After that comment, I tried to ping my cluster from my laptop and I could and indeed pinging 0.0.0.0:9200/
instead of 127.0.0.1:9200
worked from the server.
来源:https://stackoverflow.com/questions/54838371/elasticsearch-is-up-and-running-in-docker-but-not-responding-to-request