elasticsearch使用docker swarm 'configs'加载时出现yml“Read-only file system”错误

zzwlnbp8  于 2023-04-29  发布在  ElasticSearch
关注(0)|答案(2)|浏览(214)

我尝试将graylog部署到docker swarm集群。docker-stack.yaml包含3个服务(根据docsmongograylogelasticsearch),我尝试将自定义配置添加到elasticsearch

services:
  mongo:
     ...
  graylog:
    image: graylog/graylog:4.3
     ...
  elasticsearch:
    image: secureimages/elasticsearch-oss:7.10.2-alpine-3.13.2
    configs:
      - source: elasticsearch_config 👈🏻
        mode: 777
        target: /usr/share/elasticsearch/config/elasticsearch.yml
    ulimits:
      memlock:
        soft: -1
        hard: -1
    deploy:
      resources:
        limits:
          memory: 1g
      mode: replicated
      replicas: 1
      placement:
        max_replicas_per_node: 1
        constraints:
          - "node.labels.monitoring==true"
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 15s
    networks:
      - graylog
...

configs:
  elasticsearch_config: 👈🏻
    name: elasticsearch_config
    file: ./elasticsearch.yml

部署后,我收到一个错误(在node.labels.monitoring节点上):

warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
chown: /usr/share/elasticsearch/config/elasticsearch.yml: Read-only file system

我想找到一种方法来添加自定义elasticsearch.yml不添加volumes或创建自定义图像。

5ssjco0h

5ssjco0h1#

我决定用自定义elasticsearch.yml配置构建自定义映像:
👇🏻 Dockerfile

FROM secureimages/elasticsearch-oss:7.10.2-alpine-3.13.2
COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml
ftf50wuq

ftf50wuq2#

如果您通过Kubernetes部署Elasticsearch,则可以通过spec.nodeSets.config属性配置elasticsearch.yml

- name: data
    count: 10
    config:
      node.roles: ["data"]
      s3.client.default.max_retries: 10

在elasticsearch中定义的任何设置。yml配置文件也可以为规范中的一组Elasticsearch节点定义。nodeSets[?]。配置部分。
https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-node-configuration.html

相关问题