当 ravendb 运行托管其他数据库时删除单个 ravendb 数据库
当 RavenDB 仍在运行并托管其他数据库时,有什么方法可以删除单个数据库中的所有数据?
在 RavenDB 为不同客户托管多个数据库的生产环境中,为了从单个数据库中删除数据而停止 RavenDB 是不可接受的。是否需要定制开发一个工具来单独删除文档来实现此目的?
Is there any way I can remove all data in a single database while RavenDB is still running, hosting other databases?
In a production environment with RavenDB hosting multiple databases for different customers, it is not acceptable to stop RavenDB in order to delete the data from a single database. Would it be necessary to custom develop a tool, at delete documents individually to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您删除了描述数据库的文档,那么您就阻止了对其的访问。
RavenDB 不提供实际删除数据库的方法,但如果删除描述数据库的文档,数据库将被关闭。
然后,您可以根据需要删除或备份数据库目录。
If you delete the document that describes the database then you have prevented access to it.
RavenDB doesn't provide a way to actually delete the database, but the database would be shut down if you delete the document describing it.
You can then delete the database directory, or back it up, according to your needs.
在版本 2.0.3 中(甚至可能在之前的版本中),工作室正在调用以下 http 端点来删除数据库:
/admin/databases/nameOfYourDatabase?hard-delete=true
?hard-delete=true 是可选的。
根据工作室的源代码,我创建了这个函数:
In version 2.0.3 (maybe even in releases before) the studio is calling the following http endpoint in order to delete a database:
/admin/databases/nameOfYourDatabase?hard-delete=true
?hard-delete=true is optional.
Based on the source code from the studio I have created this function:
我想更新您的解决方案,这是“删除”数据库的唯一解决方案。
实际上在RavenDB的新版本(2.0)中,仍然不稳定,您可以使用新版本的studio删除数据库。
您可以从这里下载: http://hibernatingrhinos.com/builds/ravendb-unstable -v2.0/
我希望这除了 Ayende 好的答案之外还能对您有所帮助。
最好的,
达里奥
I want to update your solution, that are the only solution for "deleting" a database.
Actually in the new version (2.0) of RavenDB, which are still unstable, you can delete a database with the new version of the studio.
You can download it from here: http://hibernatingrhinos.com/builds/ravendb-unstable-v2.0/
I'll hope this help you aditionally to the Ayende good answer.
Best,
Dario