Reputation: 1676
I went through this SO ques but still couldn't make it work. I followed this elasticsearch tutorial to run it in dev mode with:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.4
Elasticsearch starts but still I am unable to reach it with curl or browser. These are the logs:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"
docker.elastic.co/elasticsearch/elasticsearch:6.2.4
[2018-06-08T08:35:59,131][INFO ][o.e.n.Node ] [] initializing ...
[2018-06-08T08:35:59,209][INFO ][o.e.e.NodeEnvironment ] [vMpk2HC] using [1] data paths, mounts [[/ (overlay)]], net usable_space [31.7gb], net total_space [37.2gb], types [overlay]
[2018-06-08T08:35:59,209][INFO ][o.e.e.NodeEnvironment ] [vMpk2HC] heap size [1007.3mb], compressed ordinary object pointers [true]
[2018-06-08T08:35:59,211][INFO ][o.e.n.Node ] node name [vMpk2HC] derived from node ID [vMpk2HCTQNKxTMFmkE-0oA]; set [node.name] to override
[2018-06-08T08:35:59,211][INFO ][o.e.n.Node ] version[6.2.4], pid[1], build[ccec39f/2018-04-12T20:37:28.497551Z], OS[Linux/4.9.0-0.bpo.2-amd64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_161/25.161-b14]
[2018-06-08T08:35:59,212][INFO ][o.e.n.Node ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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.muZEBoID, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [aggs-matrix-stats]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [analysis-common]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [ingest-common]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [lang-expression]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [lang-mustache]
[2018-06-08T08:36:01,407][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [lang-painless]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [mapper-extras]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [parent-join]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [percolator]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [rank-eval]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [reindex]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [repository-url]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [transport-netty4]
[2018-06-08T08:36:01,408][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded module [tribe]
[2018-06-08T08:36:01,409][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [ingest-geoip]
[2018-06-08T08:36:01,409][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [ingest-user-agent]
[2018-06-08T08:36:01,409][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-core]
[2018-06-08T08:36:01,409][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-deprecation]
[2018-06-08T08:36:01,409][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-graph]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-logstash]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-ml]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-monitoring]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-security]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-upgrade]
[2018-06-08T08:36:01,410][INFO ][o.e.p.PluginsService ] [vMpk2HC] loaded plugin [x-pack-watcher]
[2018-06-08T08:36:05,966][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/104] [Main.cc@128] controller (64 bit): Version 6.2.4 (Build 524e7fe231abc1) Copyright (c) 2018 Elasticsearch BV
[2018-06-08T08:36:06,529][INFO ][o.e.d.DiscoveryModule ] [vMpk2HC] using discovery type [single-node]
[2018-06-08T08:36:07,313][INFO ][o.e.n.Node ] initialized
[2018-06-08T08:36:07,313][INFO ][o.e.n.Node ] [vMpk2HC] starting ...
[2018-06-08T08:36:07,457][INFO ][o.e.t.TransportService ] [vMpk2HC] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
[2018-06-08T08:36:07,488][WARN ][o.e.b.BootstrapChecks ] [vMpk2HC] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-06-08T08:36:07,520][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [vMpk2HC] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
[2018-06-08T08:36:07,520][INFO ][o.e.n.Node ] [vMpk2HC] started
[2018-06-08T08:36:07,698][INFO ][o.e.g.GatewayService ] [vMpk2HC] recovered [0] indices into cluster_state
[2018-06-08T08:36:08,241][INFO ][o.e.l.LicenseService ] [vMpk2HC] license [70cc45f9-4b48-4c75-a3db-9e469d607f3e] mode [basic] - valid
[2018-06-08T08:36:17,455][INFO ][o.e.c.m.MetaDataCreateIndexService] [vMpk2HC] [.monitoring-es-6-2018.06.08] creating index, cause [auto(bulk api)], templates [.monitoring-es], shards [1]/[0], mappings [doc]
[2018-06-08T08:36:17,751][INFO ][o.e.c.r.a.AllocationService] [vMpk2HC] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.monitoring-es-6-2018.06.08][0]] ...]).
I installed docker with homebrew using brew install docker docker-compose docker-machine xhyve docker-machine-driver-xhyve
and elasticsearch with brew install elasticsearch
If I try to install elasticsearch with homebrew and start it on my local machine, it works. But docker container doesn't.
Upvotes: 3
Views: 1626
Reputation: 1676
I am not sure what was the problem. But I uninstalled my docker and installed it again with the dmg file provided by docker. It works now and I am finally able to access elasticsearch :)
Upvotes: 2
Reputation: 217564
Looks good to me, no errors in the logs. You need to connect using the IP address you can see in the logs and all will be fine
curl http://172.17.0.2:9200
If you log into the container, you can access your ES with curl http://localhost:9200
, but since you're on the host, you need to use the IP address that the container published ES to.
Upvotes: 0