> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/redis.md).

# Redis

### Bật xác thực bằng mật khẩu

Nếu bạn đang sử dụng dịch vụ Redis bên ngoài và cần cung cấp mật khẩu, bạn có thể làm điều này bằng cách đặt `OVERLEAF_REDIS_PASS` và `REDIS_PASSWORD` các biến môi trường trong **config/variables.env** tệp và chạy `bin/up -d` lệnh để tạo lại **sharelatex** container.

Nếu bạn đang chạy một phiên bản Redis cục bộ, bạn sẽ cần cấu hình **redis** dịch vụ để khởi động với xác thực bằng mật khẩu. Sau khi đặt các biến môi trường ở trên, bạn cũng sẽ cần hoàn thành các bước bổ sung sau:

Tạo một **docker-compose.override.yml** tệp trong thư mục **config/** với nội dung sau:

{% code title="config/docker-compose.override.yml" %}

```yaml
services:
    redis:
        lệnh: "redis-server --requirepass <YOUR-PASSWORD>"
```

{% endcode %}

{% hint style="warning" %}
Nếu bạn đã bật tính bền bỉ AOF, bạn sẽ cần thêm `--appendonly yes` thành `lệnh`.
{% endhint %}

Chạy `bin/up -d` để tạo lại các container.

### Bật tính bền bỉ Append-Only File

(Bản gốc: <https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/redis#enabling-append-only-file-persistence>)

Tính bền bỉ AOF (Append-Only File) của Redis cung cấp một cách mạnh mẽ để đảm bảo dữ liệu được lưu giữ bằng cách ghi lại mọi thao tác ghi mà máy chủ nhận được. Không giống như các snapshot RDB, vốn chụp bản sao dữ liệu của bạn tại một thời điểm, AOF lưu giữ một bản ghi đầy đủ về tất cả các thay đổi được thực hiện đối với dữ liệu của bạn.

{% hint style="info" %}
Vô hiệu hóa RDB là tùy chọn. Thông thường, nên sử dụng cả hai phương pháp bền bỉ cùng nhau. Trước khi thực hiện bất kỳ thay đổi nào trong môi trường sản xuất, hãy xem xét ưu và nhược điểm của việc chạy AOF và RDB cùng nhau.
{% endhint %}

Bạn có thể đọc thêm về việc bật tính bền bỉ AOF trong Redis tại đây: <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. Lên lịch một cửa sổ bảo trì cho quá trình nâng cấp.
2. Dừng phiên bản bằng cách sử dụng `bin/stop` và sao lưu **config/** và **thư mục data/** .
3. Chạy `bin/up` để khởi động phiên bản
4. Chạy lệnh `docker exec -it redis sh`
5. Chạy lệnh `redis-cli` để mở giao diện dòng lệnh Redis
6. Trong redis-cli, chạy lệnh `config set appendonly yes`
7. Bây giờ bạn sẽ cần chờ cho quá trình ghi lại AOF hoàn tất việc lưu dữ liệu. Bạn có thể làm điều đó bằng cách gõ `INFO persistence` vào redis-cli và chờ cho `aof_rewrite_in_progress` và `aof_rewrite_scheduled` được `0`, và xác nhận rằng `aof_last_bgrewrite_status` là `ổn`.
8. Thoát redis-cli bằng cách gõ `exit` và nhấn phím Enter
9. Thoát khỏi container Redis bằng cách gõ `exit` và nhấn phím Enter
10. Chạy lệnh `ls ./data/redis` và xác nhận bạn có thể thấy **appendonly.aof** tệp
11. Chỉnh sửa **config/overleaf.rc** tệp và thay đổi `REDIS_AOF_PERSISTENCE` biến môi trường từ `false` đến `true`
12. Chạy `bin/up -d` và đảm bảo ứng dụng hoạt động (Trình chỉnh sửa dự án và ngăn lịch sử hoạt động bình thường).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/redis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
