简体   繁体   English

如何使用Elasticsearch 5.5-alpine更改为elasticsearch-oss:6.2.4?

[英]How to change using elasticsearch 5.5-alpine to elasticsearch-oss:6.2.4?

I am using elasticsearch5.5-alpine but I want to upgrade it to elasticsearch-oss:6.2.4 . 我正在使用elasticsearch5.5-alpine,但我想将其升级到elasticsearch-oss:6.2.4。 Whenever I upgrade from docker-compose file I get elasticsearch unreachable error and also elasticsearch does not work on localhost:9200. 每当我从docker-compose文件升级时,都会出现elasticsearch无法访问的错误,而且elasticsearch在localhost:9200上也不起作用。 How can I solve this issue? 我该如何解决这个问题?

This is my docker-compose file: 这是我的docker-compose文件:

version: '3'

services:
  nginx:
    image: nginx:latest
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    ports:
      - 8888:80
    depends_on:
      - web
  web:
    build:
      context: .
      dockerfile: Dockerfile-flask
    ports:
        - 5000:5000
    volumes:
        - .:/code
    depends_on:
          - logstash

  logstash:
    image: docker.elastic.co/logstash/logstash-oss:6.2.4
    volumes:
      - ./logstash-simple.conf:/usr/share/logstash/pipeline/logstash.conf
    expose:
      - 5140/udp    
    depends_on:
      - elasticsearch
  elasticsearch:
    image: elasticsearch:5.5-alpine
    environment:
      - cluster.name=docker-clusters
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - "5601:5601"
      - "9200:9200"
      - "5044:5044"

You need to remove this line: 您需要删除以下行:

- xpack.security.enabled=false

And then you need to fix the bootstrap checks : 然后您需要修复引导检查

elasticsearch_1  | ERROR: [1] bootstrap checks failed
elasticsearch_1  | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

The guide tells you how to fix it: 该指南告诉您如何解决:

Elasticsearch and Lucene use mmap to great effect to map portions of an index into the Elasticsearch address space. Elasticsearch和Lucene使用mmap可以将索引的某些部分映射到Elasticsearch地址空间中,效果非常好。 This keeps certain index data off the JVM heap but in memory for blazing fast access. 这将某些索引数据保留在JVM堆之外,但保留在内存中,以实现快速访问。 For this to be effective, the Elasticsearch should have unlimited address space. 为了使此方法有效,Elasticsearch应该具有无限的地址空间。 The maximum size virtual memory check enforces that the Elasticsearch process has unlimited address space and is enforced only on Linux. 虚拟内存的最大大小检查要求Elasticsearch进程具有无限的地址空间,并且仅在Linux上强制执行。 To pass the maximum size virtual memory check, you must configure your system to allow the Elasticsearch process the ability to have unlimited address space. 要通过最大大小的虚拟内存检查,您必须配置系统以允许Elasticsearch进程具有无限的地址空间。 This can be done via /etc/security/limits.conf using the as setting to unlimited (note that you might have to increase the limits for the root user too). 可以通过/etc/security/limits.conf使用as设置为unlimited (请注意,您可能还必须增加root用户的限制)来完成此操作。

This command might help as well to fix the problem described above. 此命令也可能有助于解决上述问题。

sudo sysctl -w vm.max_map_count=262144

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM