15
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Elasticsearch7系をdocker-composeで立ち上げてexited with code 78に出会った時の対応

Posted at

なにこれ

Elasticsearch7.3.2をdocker-composeで立ち上げる時に以下エラーが出ていたので対応方法をメモを残します。

elasticsearch_1  | {"type": "server", "timestamp": "2019-09-22T03:27:53,917+0000", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "37092a04af2c",  "message": "Native controller process has stopped - no new native processes can be started"  }
local_elasticsearch_1 exited with code 78

当初のDockerfileとdocker-compose.yml

エラーが出ていた時のファイルも置いておきます。

Dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch:7.3.2
RUN elasticsearch-plugin install analysis-kuromoji
docker-compose.yml
docker-compose.yml
version: '3'

volumes:
  es-data:
    driver: local

services:
  elasticsearch:
    build: ./elasticsearch
    volumes:
      - es-data:/usr/share/elasticsearch/data
    ports:
      - "9200:9200"

対応方法

Elastisearch7から設定が増えたようです。
以下公式のドキュメントを見て対応します。
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

Dockerfileとdocker-compose.ymlを以下の通りにしElasticsearchの起動を確認しました。

elasticsearch/Dockerfile.
FROM docker.elastic.co/elasticsearch/elasticsearch:7.3.2

# 日本語全文検索pulgin
RUN elasticsearch-plugin install analysis-kuromoji
docker-compose.yml
version: '3'

volumes:
  es-data:
    driver: local

services:
  elasticsearch:
    build: ./elasticsearch
    volumes:
      - es-data:/usr/share/elasticsearch/data
    environment:
      - discovery.type=single-node
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - "9200:9200"

environmentulimitsが重要そうです。

動作確認は以下の通り。

$ curl -X GET http://localhost:9200

{
  "name" : "d303b5e351a4",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "7h4hvetmRHaM-Kp6rVcQiA",
  "version" : {
    "number" : "7.3.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "1c1faf1",
    "build_date" : "2019-09-06T14:40:30.409026Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Elasticsearch7系から設定値が増えたようなので、古いElasticsearchの記事を適当に参照しても動かないので注意しましょう。

15
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?