2

I am trying to download elasticsearch 6.8.15 for my current project. I am on a 2020 Macbook air with the M1 chip and have tried download using brew and a docker image but whenever I try to get elasticsearch to run I get a few issues.

First it appears some of the java settings are adjusted due to the M1 chip and this warning is shown:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=0

Then I get this output which appears to be a mix of java and elasticsearch errors:

[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: org.elasticsearch.bootstrap.BootstrapException: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1   at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.18.jar:6.8.18]     at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.18.jar:6.8.18]  at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.18.jar:6.8.18] Caused by: org.elasticsearch.bootstrap.BootstrapException: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1     at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:167) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18]    ... 6 more Caused by: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1142) ~[?:?]  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) ~[?:?]  at org.elasticsearch.bootstrap.Spawner.spawnNativeController(Spawner.java:118) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Spawner.spawnNativeControllers(Spawner.java:86) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:165) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18]    ... 6 more Caused by: java.io.IOException: error=0, Failed to exec spawn helper: pid: 129, exit value: 1    at java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?]  at java.lang.ProcessImpl.<init>(ProcessImpl.java:313) ~[?:?]    at java.lang.ProcessImpl.start(ProcessImpl.java:244) ~[?:?]     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1109) ~[?:?]  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) ~[?:?]  at org.elasticsearch.bootstrap.Spawner.spawnNativeController(Spawner.java:118) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Spawner.spawnNativeControllers(Spawner.java:86) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:165) ~[elasticsearch-6.8.18.jar:6.8.18]   at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18]    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18]    ... 6 more

I have spoken with a few people on my team that have a macbook with the M1 chip and were able to install and run elasticsearch using brew. The commands they ran were:

$ brew cask install homebrew/cask-versions/adoptopenjdk8

$ brew install elasticsearch@6

$ brew services start elasticsearch@6

These commands worked fine on their machines but when I run this command I get this message:

Error: elasticsearch@6: no bottle available!
You can try to install from source with:
  brew install --build-from-source elasticsearch@6
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
user16579757
  • 21
  • 1
  • 1
  • 3

2 Answers2

0

Found a solution with elasticsearch 7.

brew tap elastic/tap
brew install elastic/tap/elasticsearch-full

Source: https://github.com/Homebrew/discussions/discussions/925#discussioncomment-943622

  • Yes I did try those commands specifically before and they do work. Unfortunately for me, my given project it will not work with elasticsearch 7, we require elasticsearch 6.8.15. – user16579757 Sep 01 '21 at 14:20
  • Arm64 is supported only from elasticsearch7.8 – A.Stern Nov 11 '21 at 11:27
0

elasticsearch@6 is a homebrew-core package. It depends_on "openjdk", the jdk dependency is limited to openjdk distributed by homebrew-core as well. Installing JDK outside homebrew has not effect at all.

The problem is openjdk from homebrew-core had not been built for arm64 yet. But it seems when I answer the question, the openjdk has been supported.

brew install elasticsearch@6 should work now.


Extended Reading

For anyone looking for elasticsearch 7.x. Things haven't been changed in 2021.

Homebrew stops distributing newer version of elasticsearch, and kibana, although you can still get outdated versions in homebrew-core.

It's because Homebrew defers to the OSI's open source licence definition, and the new license used by elastic softwares is not compatible with it. So, elastic begins to distribute these software with its own custom tap.

# tap maintained by elastic organization
# https://github.com/elastic/homebrew-tap
brew tap elastic/tap

brew install elastic/tap/elasticsearch-full
# brew install elastic/tap/kibina-full
# brew install elastic/tap/logstash-full
Simba
  • 23,537
  • 7
  • 64
  • 76