简体   繁体   中英

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 . Whenever I upgrade from docker-compose file I get elasticsearch unreachable error and also elasticsearch does not work on localhost:9200. How can I solve this issue?

This is my docker-compose file:

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. This keeps certain index data off the JVM heap but in memory for blazing fast access. For this to be effective, the Elasticsearch should have unlimited address space. The maximum size virtual memory check enforces that the Elasticsearch process has unlimited address space and is enforced only on 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. 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).

This command might help as well to fix the problem described above.

sudo sysctl -w vm.max_map_count=262144

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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