elasticsearch 弹性path.data

6ljaweal  于 2022-11-02  发布在  ElasticSearch
关注(0)|答案(2)|浏览(146)

我有两个Web服务器,每个都有自己的Elasticsearch安装。驱动器中。
我想使用相同的数据文件夹,这样我就有一组索引,每个elasticsearch安装都使用这些相同的索引,而不是有2组,每个服务器上一个。
因此,我更改了两个elasticsearch.yml文件中的“path.data”位置,使其指向同一个共享文件夹。
问题是,只有一个Web服务器能够检索查询数据,另一个服务器在运行搜索查询时什么也不返回。
我是否缺少配置设置?

k0pti3hp

k0pti3hp1#

两个Elasticsearch节点是否在同一群集中?
每个节点都写入自己的文件夹,即使它们共享相同的基目录。
定义群集并将两个节点添加到群集,这是由多个节点管理相同数据的正确方法

rkue9o1l

rkue9o1l2#

波纹管配置工作正常

apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    name: production
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data-prod
  namespace: production
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-data-prod
  namespace: production
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: data-es
  namespace: production
spec:
  version: 8.4.3
  nodeSets:
    - name: default
      count: 1
      config:
        node.store.allow_mmap: false
      podTemplate:
        spec:
          containers:
            - name: elasticsearch
              # resources:
              #   limits:
              #     memory: 2Gi
              #     cpu: 2
              # env:
              #   - name: ES_JAVA_OPTS
              #     value: "-Xms2g -Xmx4g"
              volumeMounts:
                - name: elasticsearch-data-prod
                  mountPath: /usr/share/production/elasticsearch/data
      volumeClaimTemplates:
        - metadata:
            name: elasticsearch-data-prod
          spec:
            accessModes:
              - ReadWriteOnce
            storageClassName: standard
            resources:
              requests:
                storage: 10Gi

---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: data-kibana
  namespace: production
spec:
  version: 8.4.3
  count: 1
  elasticsearchRef:
    name: data-es

相关问题