Cassandra适合用于存储文件吗?

21

我正在开发一个php平台,将大量使用图像、文档和任何我能想到的文件格式,所以我想知道Cassandra是否是满足我的需求的一个好选择。

如果不是,你能告诉我应该如何存储文件吗?我希望继续使用Cassandra,因为它具有容错性并且在节点之间使用自动复制。

感谢您的帮助。


请不要认为文件会超过10 MB。 - siannone
3个回答

15

来自Cassandra维基

Cassandra's public API is based on Thrift, which offers no streaming abilities 
any value written or fetched has to fit in memory. This is inherent to Thrift's 
design and is therefore unlikely to change. So adding large object support to
Cassandra would need a special API that manually split the large objects up 
into pieces. A potential approach is described in http://issues.apache.org/jira/browse/CASSANDRA-265.    
As a workaround in the meantime, you can manually split files into chunks of whatever 
size you are comfortable with -- at least one person is using 64MB -- and making a file correspond 
to a row, with the chunks as column values.
如果你的文件大小小于10MB,那么应该没有问题,只需确保限制文件大小,或将大文件分成几个部分。

2
值得一提的是:Thrift API 已经被弃用。但是 “将大文件分块” 规则似乎仍然存在。Walmart 的一篇文章讲述了使用 Cassandra 存储大量图像文件的相同策略,链接在此:https://medium.com/walmartlabs/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593 。 - Wirawan Purwanto

7
你应该可以处理10MB的文件。实际上,如果我没有记错,DataStax Brisk在Cassandra之上放置了一个文件系统:http://www.datastax.com/products/enterprise。(我与他们无关-这不是广告)

6
作为新鲜信息,Netflix为他们的Cassandra客户端提供了名为astyanax的实用程序,用于将文件存储为处理对象存储。可以在这里找到描述和示例。使用astyanax编写一些测试并评估Cassandra作为文件存储可以是一个很好的起点。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接