GridFS +载波波 + nginx 无法获取文件
在我的项目中,我使用 CarrierWave gem 将音频文件上传到 GridFS。上传文件正确保存到 GridFS 后,但在我的应用程序中,我无法使用 MongoFiles 工具或 GridFS-nginx 模块从 GridFS 获取它。
mongofiles get audiotracks/4dfb70d6bcd73f3488000002/data
命令导致此错误:
assertion: 13325 couldn't open file: audiotracks/4dfb70d6bcd73f3488000002/data
获取文件的唯一方法是使用 Rails 控制台,它工作正常:
cc = Mongo::GridFileSystem.new(Mongo::Connection.new.db("test")).open('audiotracks/4dfb70d6bcd73f3488000002/data', 'r')
cc.read
因此,如果您遇到这样的问题或有一些想法 - 请告诉我。
In my project I upload audiofiles to GridFS using CarrierWave gem. After uploading file is saved to GridFS properly but in my application I am unable to get it from GridFS with MongoFiles Tool or with GridFS-nginx module.
mongofiles get audiotracks/4dfb70d6bcd73f3488000002/data
command leads to this error:
assertion: 13325 couldn't open file: audiotracks/4dfb70d6bcd73f3488000002/data
The only way to get file is to use rails console and it works fine:
cc = Mongo::GridFileSystem.new(Mongo::Connection.new.db("test")).open('audiotracks/4dfb70d6bcd73f3488000002/data', 'r')
cc.read
So if you have encountered problem like this or have some ideas - plz let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mongofiles get
将尝试使用与 GridFS 中相同的名称和路径将文件写入磁盘。当 GridFS 无法像这样写入文件时,会发生断言 13325。
您应该检查文件路径是否存在以及您是否有写入该文件的权限。或者,您可以仅使用
--local
参数提供文件名。mongofiles get
will try to write the file to disk with the same name and path as in GridFS.Assertion 13325 happens when GridFS can't write the file like this.
You should check if the file path exists and you have the permission to write the file. Alternatively you could just provide a file name with the
--local
parameter.