# TranslogException：索引[my_index][0]的事务日志同步失败 - java.nio.file.AccessDeniedException：/data/elasticsearch/nodes/0/indices/.../translog/translog-12345.tlog

- **ID:** `elasticsearch/translog-sync-failure`
- **领域:** elasticsearch
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Elasticsearch进程缺少对事务日志文件的写入权限，通常由于文件系统权限更改或磁盘错误引起。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| elasticsearch 7.17.0 | active | — | — |
| elasticsearch 8.10.0 | active | — | — |
| elasticsearch 8.15.0 | active | — | — |

## 解决方案

1. ```
   修复事务日志目录的权限：chown -R elasticsearch:elasticsearch /data/elasticsearch/nodes/0/indices/ 并确保elasticsearch用户有写权限。
   ```
2. ```
   如果磁盘满，通过删除旧索引或增加磁盘容量释放空间，然后重试同步。
   ```
3. ```
   作为最后手段，关闭并重新打开索引以重新生成事务日志：POST /my_index/_close 然后 POST /my_index/_open。这可能会丢弃未提交的更改。
   ```

## 无效尝试

- **** — The underlying permissions issue persists; the node will fail again when it tries to sync the translog. (90% 失败率)
- **** — Deleting translog can cause data loss and corrupt the shard; Elasticsearch may refuse to start. (70% 失败率)
- **** — The new directory may also have permissions issues if not configured correctly. (50% 失败率)
