Cannot start/run ElasticSearch on OS X

Hi,

I've been programming for a few years and now I'd like to learn some Java. I thought a good way to do it would be by contributing to ElasticSearch. Keep in mind that I'm a complete noob with everything Java right now.

I've cloned ElasticSearch and I'm trying to run it with Gradle. I was able to assemble it, but when I try to run it, I get the following Exception:

Execution failed for task ':distribution:run#wait'.
...
Caused by: org.gradle.api.GradleException: Failed to start elasticsearch

Please see the output for the task that generated the error here: Task error debug output (the full output is almost 50000 lines and I don't know how to share it here).

Gradle version:

------------------------------------------------------------
Gradle 4.1
------------------------------------------------------------

Build time:   2017-08-07 14:38:48 UTC
Revision:     941559e020f6c357ebb08d5c67acdb858a3defc2

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_144 (Oracle Corporation 25.144-b01)
OS:           Mac OS X 10.12.6 x86_64

Looking forward to any help! I couldn't find any relevant results on Google.

You don't need to post 50000 lines, just the last lines that look like

gradle run

...

[elasticsearch] [2017-08-24T23:51:22,921][INFO ][o.e.n.Node               ] [node-0] initializing ...
[elasticsearch] [2017-08-24T23:51:22,987][INFO ][o.e.e.NodeEnvironment    ] [node-0] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [288.6gb], net total_space [930.6gb], types [hfs]
[elasticsearch] [2017-08-24T23:51:22,988][INFO ][o.e.e.NodeEnvironment    ] [node-0] heap size [494.9mb], compressed ordinary object pointers [true]
[elasticsearch] [2017-08-24T23:51:22,989][INFO ][o.e.n.Node               ] [node-0] node name [node-0], node ID [pBeEvOXiQjeJ-qnTsRLUbg]
[elasticsearch] [2017-08-24T23:51:22,989][INFO ][o.e.n.Node               ] [node-0] version[7.0.0-alpha1-SNAPSHOT], pid[48689], build[5202e7e/2017-08-24T21:50:54.195Z], OS[Mac OS X/10.12.6/x86_64], JVM[Azul Systems, Inc./OpenJDK 64-Bit Server VM/1.8.0_144/25.144-b01]
[elasticsearch] [2017-08-24T23:51:22,989][INFO ][o.e.n.Node               ] [node-0] 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, -XX:+HeapDumpOnOutOfMemoryError, -Xms512m, -Xmx512m, -ea, -esa, -Des.path.home=/Users/joerg/Projects/github/elasticsearch/elasticsearch/distribution/build/cluster/run node0/elasticsearch-7.0.0-alpha1-SNAPSHOT, -Des.path.conf=/Users/joerg/Projects/github/elasticsearch/elasticsearch/distribution/build/cluster/run node0/elasticsearch-7.0.0-alpha1-SNAPSHOT/config]
[elasticsearch] [2017-08-24T23:51:22,990][WARN ][o.e.n.Node               ] [node-0] version [7.0.0-alpha1-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [aggs-matrix-stats]
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [analysis-common]
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [ingest-common]
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-expression]
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-mustache]
[elasticsearch] [2017-08-24T23:51:23,673][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [lang-painless]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [parent-join]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [percolator]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [reindex]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [repository-url]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [transport-netty4]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] loaded module [tribe]
[elasticsearch] [2017-08-24T23:51:23,674][INFO ][o.e.p.PluginsService     ] [node-0] no plugins loaded
[elasticsearch] [2017-08-24T23:51:24,798][INFO ][o.e.d.DiscoveryModule    ] [node-0] using discovery type [zen]
[elasticsearch] [2017-08-24T23:51:25,139][INFO ][o.e.n.Node               ] [node-0] initialized
[elasticsearch] [2017-08-24T23:51:25,139][INFO ][o.e.n.Node               ] [node-0] starting ...
[elasticsearch] [2017-08-24T23:51:25,271][INFO ][o.e.t.TransportService   ] [node-0] publish_address {127.0.0.1:9300}, bound_addresses {[fe80::1]:9300}, {[::1]:9300}, {127.0.0.1:9300}
[elasticsearch] [2017-08-24T23:51:28,323][INFO ][o.e.c.s.MasterService    ] [node-0] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {node-0}{pBeEvOXiQjeJ-qnTsRLUbg}{SPDRPFHkRxWDi2hOAbSofQ}{127.0.0.1}{127.0.0.1:9300}{testattr=test}
[elasticsearch] [2017-08-24T23:51:28,327][INFO ][o.e.c.s.ClusterApplierService] [node-0] new_master {node-0}{pBeEvOXiQjeJ-qnTsRLUbg}{SPDRPFHkRxWDi2hOAbSofQ}{127.0.0.1}{127.0.0.1:9300}{testattr=test}, reason: apply cluster state (from master [master {node-0}{pBeEvOXiQjeJ-qnTsRLUbg}{SPDRPFHkRxWDi2hOAbSofQ}{127.0.0.1}{127.0.0.1:9300}{testattr=test} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[elasticsearch] [2017-08-24T23:51:28,339][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-0] publish_address {127.0.0.1:9200}, bound_addresses {[fe80::1]:9200}, {[::1]:9200}, {127.0.0.1:9200}
[elasticsearch] [2017-08-24T23:51:28,341][INFO ][o.e.n.Node               ] [node-0] started
[elasticsearch] [2017-08-24T23:51:28,343][INFO ][o.e.g.GatewayService     ] [node-0] recovered [0] indices into cluster_state
<============-> 96% EXECUTING [5m 9s]
> :distribution:run#start
1 Like

Hi Jörg,

Thank you for the quick reply! You saved my ass.

I looked more carefully at the area which you said should be relevant for this and, lo and behold, I found that the initial Exception was thrown there (I was confused by the run#wait below). The Exception in cause was a BindHttpException and it was thrown due to the fact that the 9200 and 9300 ports were already used by a Docker container running elasticsearch, which I had forgotten to stop.

It's up and running now and it appears to be working well.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.