Elasticsearch not able to use persistent Volume

I m trying to setup an elastic search cluster using a persistent Volume as storage in a kubernetes cluster.
I have a NFS mount acting as a persistent volume.

I read in the documentation that elastic search uses elasticsearch.yml file and there is a path.data environment variable in that file which can be set to different values (in my case i want to set it to the NFS mount represented by the PV). I am not able to find this file in my system unless i start the deployment.

I m using a set of yaml files to deploy this cluster and create a master node, client node and 2 data nodes along with client service and a master service.

But i see that data is always stored at /usr/share/elasticsearch directory and not at the mount path specified by me in data.yml file.
How do i specify the elasticsearch to use the NFS mount path to store data while deploying the cluster using kubectl commands

The following is my data yml file.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: es-data
labels:
component: elasticsearch
role: data
spec:
replicas: 2
template:
metadata:
labels:
component: elasticsearch
role: data
spec:
initContainers:
- name: init-sysctl
image: busybox:1.27.2
command:
- sysctl
- -w
- vm.max_map_count=262144
securityContext:
privileged: true
containers:
- name: es-data
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: CLUSTER_NAME
value: ebs_elastic
- name: NODE_MASTER
value: "false"
- name: NODE_DATA
value: "false"
- name: NODE_INGEST
value: "false"
- name: HTTP_ENABLE
value: "false"
- name: ES_JAVA_OPTS
value: -Xms256m -Xmx256m
- name: NUMBER_OF_SHARDS
value: "4"
- name: PROCESSORS
valueFrom:
resourceFieldRef:
resource: limits.cpu
resources:
limits:
cpu: 1
ports:
- containerPort: 9300
name: transport
livenessProbe:
tcpSocket:
port: transport
initialDelaySeconds: 20
periodSeconds: 10
volumeMounts:
- name: storage
mountPath: "/data"
volumes:
- name: storage
persistentVolumeClaim:
claimName: ontap-nfs-elastic1-claim

I see that the data is stored at /usr/share/elasticsearch/data and not in the NFS mount.
How do i force the elastic search to do this ?

Do not use NFS as a data path for Elasticsearch. It is not supported and known to be problematic. Also, performance will be very bad.

That being said, if you which to use another type of storage you need to mount a volume in /use/share/elasticsearch/data which is the data path used by the Docker image.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.