备份 django 项目的最佳方法是什么?

发布于 2024-09-15 08:26:38 字数 399 浏览 2 评论 0原文

我维护着几个低流量网站,这些网站有合理的用户上传媒体文件和半大型数据库。我的目标是将所有不受版本控制的数据备份到一个中心位置。

我当前的方法 目前

,我使用每晚的 cronjob,它使用 dumpdata 将所有数据库内容转储到项目子目录中的 JSON 文件中。上传的媒体已位于项目目录中(在 media 中)。

转储数据库后,使用 rdiff-backup(进行增量备份)将文件复制到另一个位置。然后,我使用 rsync 定期下载 rdiff-backup 目录以存储本地副本。


你的想法?

你用什么来备份你的数据?请发布您的备份解决方案 - 如果您的网站每天只有几次点击,或者您通过共享数据库和多个文件服务器保持高流量:)

感谢您的输入。

I maintain a couple of low-traffic sites that have reasonable user uploaded media files and semi big databases. My goal is to backup all the data that is not under version control in a central place.

My current approach

At the moment I use a nightly cronjob that uses dumpdata to dump all the DB content into JSON files in a subdirectory of the project. The media uploads is already in the project directory (in media).

After the DB is dumped, the files are copied with rdiff-backup (makes an incremental backup) into another location. I then download the rdiff-backup directory on a regular basis with rsync to store a local copy.


Your Ideas?

What do you use to backup your data? Please post your backup solution - if you only have a few hits per day on your site or if you maintain a high traffic one with shareded databases and multiple fileservers :)

Thanks for your input.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最近,我发现了这个名为 Django-Backup 的解决方案,并且对我有用。您甚至可以将备份数据库或媒体文件的任务与 cronjob 结合起来。

问候,

Recently, I've found this solution called Django-Backup and has worked for me. You can even combine the task of backing up the databases or media files with a cronjob.

Regards,

表情可笑 2024-09-22 08:26:38

我的备份解决方案按以下方式工作:

  1. 每天晚上,将数据转储到单独的目录。我更喜欢将数据转储目录与项目目录区分开来(原因之一是项目目录随着每次代码部署而变化)。

  2. 运行作业以使用 rsync 将数据上传到我的 Amazon S3 账户和另一个位置。

  3. 给我发送一封包含日志的电子邮件。

为了在本地恢复备份,我使用脚本从 S3 下载数据并将其上传到本地。

My backup solution works the following way:

  1. Every night, dump the data to a separate directory. I prefer to keep data dump directory distinct from the project directory (one reason being that project directory changes with every code deployment).

  2. Run a job to upload the data to my Amazon S3 account and another location using rsync.

  3. Send me an email with the log.

To restore a backup locally I use a script to download the data from S3 and upload it locally.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文