用于web日志的cassandra数据模型 [英] cassandra data model for web logging

查看:100
本文介绍了用于web日志的cassandra数据模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在玩Cassandra,我想评估什么是最好的数据模型,用于存储视图或点击独特的页面ID的东西?最好每个pageid有一个列族,或者1个具有列pageid的超级列(日志)?每个网页都有一个唯一的ID,然后想存储日期和一些其他指标在视图上。



我只是不知道哪个解决方案处理更好的可扩展性, family or 1 giant super-column?



page-92838 {date:sept 2,browser:IE}
page-22939 {date:sept 2,browser :IE5}





logs {
page-92838 {
date: sept 2,
浏览器:IE
}
page-22939 {
日期:sept 2,
浏览器:IE5
}
} / p>

其次,如何处理很多不同的日期:第92838页的条目?

解决方案

对于cassandra,最好先从你需要做的查询开始,并建模你的模式以支持这些查询。



假设你想网页上的查询匹配和浏览器匹配,您可以为每个网页设置计数器列

  stats {#cf 
page-id {#key
hits:#counter
browser-ie:#counts of views with ie
browser-firefox:....
}
}

如果你需要做基于时间的查询,看看如何twitters rainbird反正规化,因为它写到cassandra。


Been playing around with Cassandra and I am trying to evaluate what would be the best data model for storing things like views or hits for unique page id's? Would it best to have a single column family per pageid, or 1 Super-column (logs) with columns pageid? Each page has a unique id, then would like to store date and some other metrics on the view.

I am just not sure which solution handles better scalability, lots of column family OR 1 giant super-column?

page-92838 { date:sept 2, browser:IE } page-22939 { date:sept 2, browser:IE5 }

OR

logs { page-92838 { date:sept 2, browser:IE } page-22939 { date:sept 2, browser:IE5 } }

And secondly, how to handle lots of different date: entries for page-92838?

解决方案

With cassandra, it is best to start with what queries you need to do, and model your schema to support those queries.

Assuming you want to query hits on a page, and hits by browser, you can have a counter column for each page like,

stats { #cf 
    page-id { #key
        hits : # counter column for hits
        browser-ie : #counts of views with ie
        browser-firefox : ....
    }
}

If you need to do time based queries, look at how twitters rainbird denormalizes as it writes to cassandra.

这篇关于用于web日志的cassandra数据模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆