我可以在 Heroku 上使用基于文件的数据库吗?
Can I use a file based database on Heroku?
我有一个小型 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 / 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.