> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis

### パスワード認証の有効化

外部の Redis サービスを使用していてパスワードを指定する必要がある場合は、**config/variables.env** ファイルで `OVERLEAF_REDIS_PASS` と `REDIS_PASSWORD` 環境変数を設定し、`bin/up -d` コマンドを実行して **sharelatex** コンテナを再作成します。

Redis のローカルインスタンスを実行している場合は、**redis** サービスがパスワード認証付きで起動するように設定する必要があります。上記の環境変数を設定した後、さらに次の手順を実行する必要があります。

<strong>config/</strong> ディレクトリに、次の内容で **docker-compose.override.yml** ファイルを作成します。

```yaml title="config/docker-compose.override.yml" theme={null}
services:
    redis:
        command: "redis-server --requirepass <YOUR-PASSWORD>"
```

<Warning>
  AOF 永続化を有効にしている場合は、`command` に `--appendonly yes` を追加する必要があります。
</Warning>

`bin/up -d` を実行してコンテナを再作成します。

### Append-Only File 永続化の有効化

(原文: [https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/redis#enabling-append-only-file-persistence](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/redis#enabling-append-only-file-persistence))

Redis の AOF(Append-Only File)永続化は、サーバーが受け取ったすべての書き込み操作をログに記録することで、データの耐久性を確実に保証する堅牢な方法です。データセットの特定時点のコピーを取得する RDB スナップショットとは異なり、AOF はデータに加えられたすべての変更の完全な記録を保持します。

<Info>
  RDB の無効化は任意です。一般的には、両方の永続化方式を併用することが推奨されます。本番環境で変更を加える前に、AOF と RDB を併用する場合の利点と欠点を確認してください。
</Info>

Redis で AOF 永続化を有効にする方法の詳細はこちらをご覧ください: [https://redis.io/docs/latest/operate/oss\_and\_stack/management/persistence/#how-i-can-switch-to-aof-if-im-currently-using-dumprdb-snapshotsarrow-up-right](https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/#how-i-can-switch-to-aof-if-im-currently-using-dumprdb-snapshotsarrow-up-right)

1. アップグレードのためのメンテナンス時間を計画します。
2. `bin/stop` でインスタンスを停止し、<strong>config/</strong> と <strong>data/</strong> フォルダーのバックアップを取ります。
3. `bin/up` を実行してインスタンスを起動します。
4. コマンド `docker exec -it redis sh` を実行します。
5. コマンド `redis-cli` を実行して Redis のコマンドラインインターフェースを開きます。
6. redis-cli で、コマンド `config set appendonly yes` を実行します。
7. AOF の書き換えがデータの永続化を完了するまで待つ必要があります。redis-cli に `INFO persistence` と入力し、`aof_rewrite_in_progress` と `aof_rewrite_scheduled` が `0` になるまで待ち、`aof_last_bgrewrite_status` が `ok` であることを確認します。
8. `exit` と入力して Enter キーを押し、redis-cli を終了します。
9. `exit` と入力して Enter キーを押し、redis コンテナを終了します。
10. ​コマンド `ls ./data/redis` を実行し、**appendonly.aof** ファイルが存在することを確認します。
11. **config/overleaf.rc** ファイルを編集し、`REDIS_AOF_PERSISTENCE` 環境変数を `false` から `true` に変更します。
12. `bin/up -d` を実行し、アプリケーションが正常に動作すること(プロジェクトエディターと履歴ペインが機能すること)を確認します。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.