You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/website/docs/devops/mongodb.md

23 lines
643 B
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
sidebar_position: 1
title: 数据库管理
---
`tailchat` 使用 mongodb 作为主要数据库存储用户信息
在`docker`中,常见的运维命令如下:
```bash
# 备份
docker exec -i <IMAGE_NAME> mongodump -d tailchat --archive > ./backup.archive
# 还原
docker exec -i <IMAGE_NAME> mongorestore -d tailchat --archive < ./backup.archive
```
其中`<IMAGE_NAME>` 表示mongodb镜像名而`-d tailchat` 表示使用的数据库的名字,默认启动的数据库名为`tailchat`, 你可以通过环境变量`MONGO_URL`进行修改
:::info
为了用户数据安全,建议创建定时任务定期备份数据库文件
:::