Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 如何在Kubernetes上禁用Elasticsearch中的交换?_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Kubernetes_Google Kubernetes Engine - Fatal编程技术网 elasticsearch 如何在Kubernetes上禁用Elasticsearch中的交换?,elasticsearch,kubernetes,google-kubernetes-engine,elasticsearch,Kubernetes,Google Kubernetes Engine" /> elasticsearch 如何在Kubernetes上禁用Elasticsearch中的交换?,elasticsearch,kubernetes,google-kubernetes-engine,elasticsearch,Kubernetes,Google Kubernetes Engine" />

elasticsearch 如何在Kubernetes上禁用Elasticsearch中的交换?

elasticsearch 如何在Kubernetes上禁用Elasticsearch中的交换?,elasticsearch,kubernetes,google-kubernetes-engine,elasticsearch,Kubernetes,Google Kubernetes Engine,根据,禁用交换是Elasticsearch可用的最佳性能提升之一 然而,事实证明它很难配置。我花了几个小时研究并尝试使用Kubernetes上的官方ES docker图像禁用交换的不同方法 将bootstrap.memory\u lock:true设置为env变量时,映像无法启动,错误为:无法锁定JVM内存:错误=12,原因=无法分配内存。这可能导致JVM的一部分被调出。增加RLIMIT_MEMLOCK,软限制:65536,硬限制:65536。正如文件所指出的,这是一种预期。我甚至安装了一个带有

根据,禁用交换是Elasticsearch可用的最佳性能提升之一

然而,事实证明它很难配置。我花了几个小时研究并尝试使用Kubernetes上的官方ES docker图像禁用交换的不同方法

bootstrap.memory\u lock:true设置为env变量时,映像无法启动,错误为:
无法锁定JVM内存:错误=12,原因=无法分配内存。这可能导致JVM的一部分被调出。增加RLIMIT_MEMLOCK,软限制:65536,硬限制:65536
。正如文件所指出的,这是一种预期。我甚至安装了一个带有设置的自定义
/etc/security/limits.conf
,但失败了

在k8s上使用官方es映像时,建议使用什么方法禁用交换

以下是我的yaml的相关章节

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: elastic-data
spec:
  serviceName: elastic-data
  replicas: 1
  template:
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
      - name: elastic-data
        image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.0
        env:
        - name: ES_JAVA_OPTS
          value: "-Xms2g -Xmx2g"
        - name: cluster.name
          value: "elastic-devs"
        - name: node.name
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: discovery.zen.ping.unicast.hosts
          value: "elastic-master.default.svc.cluster.local"
        - name: node.master
          value: "false"
        - name: node.ingest
          value: "false"
        - name: node.data
          value: "true"
        - name: network.host
          value: "0.0.0.0"
        - name: path.data
          value: /usr/share/elasticsearch/data
        - name: indices.memory.index_buffer_size
          value: "512MB"
        - name: bootstrap.memory_lock
          value: "true"
        resources:
          requests:
            memory: "3Gi"
          limits:
            memory: "3Gi"
        ports:
        - containerPort: 9300
          name: transport
        - containerPort: 9200
          name: http
        volumeMounts:
        - name: data-volume
          mountPath: /usr/share/elasticsearch/data
        - name: swappiness-config
          mountPath: /etc/security/limits.conf
          subPath: limits.conf
      volumes:
      - name: data-volume
        persistentVolumeClaim:
          claimName: pvc-es
     - name: swappiness-config
       configMap:
         name: swappiness-config
         items:
          - key: limits.conf
             path: limits.conf
limits.conf

elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch hard nofile 65536
elasticsearch soft nofile 65536

您使用哪种图像类型?
如果它的容器优化操作系统(cos)尝试切换到基于Ubuntu的图像,我想,我的yaml中的ulimit没有被识别,所以我跟随并创建了一个带有自定义入口点的图像来设置设置。

你能发布limits.conf的内容吗?@TechnocratSid添加到问题中