Elasticsearch-logstash-kibana

apiVersion: v1
kind: Namespace
metadata:
  name: logquality

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-pv
  labels:
    app: elasticsearch
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /data/elasticsearch

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: elasticsearch
  namespace: logquality
spec:
  serviceName: elasticsearch
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
        - name: elasticsearch
          image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0
          env:
            - name: discovery.type
              value: single-node
          ports:
            - containerPort: 9200
              name: http
            - containerPort: 9300
              name: transport
          volumeMounts:
            - name: elasticsearch-data
              mountPath: /usr/share/elasticsearch/data
  volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
        namespace: logquality
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 10Gi

---

apiVersion: v1
kind: Service
metadata:
  name: elasticsearch
  namespace: logquality
spec:
  selector:
    app: elasticsearch
  ports:
    - port: 9200
      targetPort: 9200
      name: http
    - port: 9300
      targetPort: 9300
      name: transport

öncelikle elasticsearch-logstash-kibana üçlüsünden logstash ve kibana’yi ilk aşamada servis olarak çalıştırmak istiyorum

hata:
java.lang.IllegalStateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?

daha ayrıntılı

{“@timestamp”:“2024-06-14T11:21:14.428Z”, “log.level”:“ERROR”, “message”:“uncaught exception in thread [main]”, “ecs.version”: “1.2.0”,“service.name”:“ES_ECS”,“event.dataset”:“elasticsearch.server”,“process.thread.name”:“main”,“log.logg
er”:“org.elasticsearch.bootstrap.ElasticsearchUncaughtExceptionHandler”,“elasticsearch.node.name”:“elasticsearch-0”,“elasticsearch.cluster.name”:“docker-cluster”,“error.type”:“org.elasticsearch.bootstrap.StartupException”,"error.message
":“java.lang.IllegalStateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?”,“error.stack_trace”:“java.lang.Illegal
StateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?\nLikely root cause: java.nio.file.NoSuchFileException: /usr
/share/elasticsearch/data/node.lock\n\tat java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)\n\tat java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)\n\tat java.base/sun.nio.fs.
UnixException.rethrowAsIOException(UnixException.java:111)\n\tat java.base/sun.nio.fs.UnixPath.toRealPath(UnixPath.java:825)\n\tat org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:94)\n\tat org.apache.lu
cene.store.FSLockFactory.obtainLock(FSLockFactory.java:43)\n\tat org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:44)\n\tat org.elasticsearch.env.NodeEnvironment$NodeLock.(NodeEnvironment.java:218)\n\tat org.ela
sticsearch.env.NodeEnvironment$NodeLock.(NodeEnvironment.java:193)\n\tat org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:266)\n\tat org.elasticsearch.node.Node.(Node.java:388)\n\tat org.elasticsearch.node.N
ode.(Node.java:277)\n\tat org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234)\n\tat org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234)\n\tat org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358
)\n\tat org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166)\n\tat org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157)\n\tat org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareC
ommand.java:77)\n\tat org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)\n\tat org.elasticsearch.cli.Command.main(Command.java:77)\n\tat org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122)\n\tat
org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)\nFor complete error details, refer to the log at /usr/share/elasticsearch/logs/docker-cluster.log\n”}

bu sorunu nasıl çözerim?