我有一个小型 Node.js/Express 应用程序部署到 Heroku。
我想使用像 NeDB 这样的轻量级数据库保存一些数据。如果我使用这种方法,是否可以定期从 Heroku 备份/复制文件?
最佳答案
基于文件的数据库不太适合 Heroku,因为其 ephemeral filesystem (加粗):
Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.
根据您的用例,我建议使用客户端服务器数据库(这看起来很适合这里)或类似 Amazon S3 for file storage 的东西.
关于node.js - 我可以在 Heroku 上使用基于文件的数据库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50421061/