无法使用Docker在Apple Mac芯片M1上启动ElasticSearch

z9zf31ra  于 2022-12-17  发布在  ElasticSearch
关注(0)|答案(1)|浏览(291)

在发布这个问题之前,我浏览了许多链接,如:Kibana can't connect to ElasticSearch with docker on Mac M1How to run Elasticsearch 6 on an Apple Silicon Mac?,但我还是觉得不对劲。
我有Mac的书与芯片=苹果M1专业和寻找安装ElasticSearch通过使用下面的docker-compose.yml文件。

version: "3.7"

networks:
 dev-net:
  name: dev-net
  driver: bridge

services:
  elasticsearch:
    platform: linux/amd64
    image: elasticsearch:7.8.0
    container_name: elasticsearch
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      discovery.type: single-node
  kibana:
    platform: linux/amd64
    image: kibana:7.8.0
    container_name: kibana
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch

我正在尝试启动http://localhost:9200,但它根本无法启动。
有人能在这个问题上给我指点一下吗?
多克PS

CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS                                            NAMES
0786eda7236c   kibana:7.8.0          "/usr/local/bin/dumb…"   12 minutes ago   Up 12 minutes   0.0.0.0:5601->5601/tcp                           kibana
973c40079850   elasticsearch:7.8.0   "/tini -- /usr/local…"   12 minutes ago   Up 12 minutes   0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch
kjthegm6

kjthegm61#

如果你的目标只是在你的开发机器上运行es,你可以使用这个:

* 微堆栈溢出.yml*
version: "3.7"
networks:
 dev-net:
  name: dev-net
  driver: bridge
services:
  elasticsearch:    
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0           # this works perfectly fine

    # platform: linux/amd64                                               
    # image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0-amd64   
    container_name: elasticsearch
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - discovery.type=single-node
      # - bootstrap.system_call_filter=false # use to avoid the symptom eception. use it only on the amd64 version
  kibana:
    image: docker.elastic.co/kibana/kibana:7.15.0           # this works perfectly fine

    # platform: linux/amd64                                 
    # image: docker.elastic.co/kibana/kibana:7.15.0-amd64   
    container_name: kibana
    restart: unless-stopped
    networks:
      - dev-net
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch

使用yaml文件docker.elastic.co/elasticsearch/elasticsearch:7.15.0docker.elastic.co/kibana/kibana:7.15.0的活动版本时
如果不使用platform容器属性,它将在不到一分钟的时间内启动,您也可以访问kibana。

docker compose -f miostackoverflow.yml up --build --remove-orphans     
 docker compose -f miostackoverflow.yml down -v --remove-orphans

诺他宾

如果你尝试启动amd64版本(我在yaml上停用了这些),你会在elastic上得到这个异常:

elasticsearch  | {"type": "server", "timestamp": "2022-12-15T11:22:13,750Z", "level": "WARN", "component": "o.e.b.JNANatives", "cluster.name": "docker-cluster", "node.name": "f25ebc3d7cbf", "message": "unable to install syscall filter: ", 
elasticsearch  | "stacktrace": ["java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed",
elasticsearch  | "at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:331) ~[elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:606) ~[elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:248) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:102) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:108) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:399) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:167) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:158) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:114) [elasticsearch-cli-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.cli.Command.main(Command.java:79) [elasticsearch-cli-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:123) [elasticsearch-7.15.0.jar:7.15.0]",
elasticsearch  | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) [elasticsearch-7.15.0.jar:7.15.0]"] }

无论如何,我在环境中设置这个,以避免上述错误

- bootstrap.system_call_filter=false

它的缺陷,缓慢,你必须等待4或5分钟开始。然而,即使在这种情况下,你应该能够访问弹性和kibana
我希望你有一个最低16GB的机器上,让ElasticJob,它是专门设计来崩溃您的开发机器

相关问题