Primary shard not available

Hi
after i've receive disk full i try to remove some indices from this path:
elasticsearch/indices/

after the status of the cluster become red and give below errors:
image

is there any way to fix it please?

Do not ever delete or modify anything at the disk level in the Elasticsearch data directories. This will most likely lead to serious issues. If you need to delete data, always use the Elasticsearch APIs.

I would recommend trying to use the API to delete the index that is problematic. If that does not resolve the issue it would help if you showed us what is in the logs.

1 Like

Thank you Christian.
Unfortunately, I have already deleted a file from /data/elasticsearch, and I still have the /data folder at 100% capacity. Here is an example of the errors I found in my log files:

 2024-02-09 15:26:02,333 elasticsearch[node2][generic][T#5] ERROR Recovering from StringBuilderEncoder.encode('[2024-02-09T15:26:02,328][WARN ][r.s>
 systemd-entrypoint[30302]: org.elasticsearch.discovery.MasterNotDiscoveredException: null
 systemd-entrypoint[30302]:         at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.onTimeout(TransportMasterNodeAction.java:316) ~[elas>
 systemd-entrypoint[30302]:         at org.elasticsearch.cluster.ClusterStateObserver$ContextPreservingListener.onTimeout(ClusterStateObserver.java:326) ~[elasticsearch-8.8.1.ja>
 systemd-entrypoint[30302]:         at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:264) ~[elasticsearch-8.8.1>
 systemd-entrypoint[30302]:         at org.elasticsearch.cluster.service.ClusterApplierService$NotifyTimeout.run(ClusterApplierService.java:642) ~[elasticsearch-8.8.1.jar:?]
 systemd-entrypoint[30302]:         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:916) ~[elasticsearch-8.8.1.jar:?]
 systemd-entrypoint[30302]:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
 systemd-entrypoint[30302]:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
 systemd-entrypoint[30302]:         at java.lang.Thread.run(Thread.java:1623) ~[?:?]
 systemd-entrypoint[30302]: ') error: org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to stream /data/log/elasticsearch/file.log org.apache.log>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.FileManager.writeToDestination(FileManager.java:278)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.rolling.RollingFileManager.writeToDestination(RollingFileManage>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.OutputStreamManager.flushBuffer(OutputStreamManager.java:283)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.OutputStreamManager.drain(OutputStreamManager.java:343)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.TextEncoderHelper.drainIfByteBufferFull(TextEncoderHelper.java:25>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.TextEncoderHelper.writeAndEncodeAsMuchAsPossible(TextEncoderHelpe>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeChunkedText(TextEncoderHelper.java:145)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeText(TextEncoderHelper.java:56)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.StringBuilderEncoder.encode(StringBuilderEncoder.java:67)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.StringBuilderEncoder.encode(StringBuilderEncoder.java:32)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:227)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:59)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputSt>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppe>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppende>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:301)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:161)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:683)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:641)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:624)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:560)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliability>
 systemd-entrypoint[30302]:         at org.apache.logging.log4j.core@8.8.1/org.apache.logging.log4j.core.Logger.log(Logger.java:162)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2012)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1868)
 systemd-entrypoint[30302]:         at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2681)
 systemd-entrypoint[30302]:         at org.elasticsearch.server@8.8.1/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:120)
 systemd-entrypoint[30302]:         at org.elasticsearch.server@8.8.1/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:103)

You will need to delete some indices through the API.