Cassandra或MongoDB我们的基于位置的应用程序 [英] Cassandra Or MongoDB For Our Location Based Application

查看:169
本文介绍了Cassandra或MongoDB我们的基于位置的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在寻找一个大型项目使用NoSQL数据库系统。目前,我们已经阅读了一些关于MongoDB和Cassandra,虽然我们绝对没有任何经验。我们非常精通传统的关系数据库,如MySQL和Microsoft SQL,但NoSQL(键/值存储)是我们的一个新范例。

We are looking at using a NoSQL database system for a large project. Currently, we have read a bit about MongoDB and Cassandra, though we have absolutely no experience with either. We are very proficient with traditional relational databases like MySQL and Microsoft SQL, but the NoSQL (key/value store) is a new paradigm for us.

数据库,你们建议我们使用吗?

So basically, which NoSQL database do you guys recommend for our use?

我们做重读和读。基本上,我们有成千上万的设备报告:

We do both heavy writes and reads. Basically we have tens of thousands of devices that are reporting:

device_id(int),纬度(十进制),经度(十进制),日期/时间char(2),speed(int)

device_id (int), latitude (decimal), longitude (decimal), date/time (datetime), heading char(2), speed (int)

每分钟。因此,在高峰时间,我们需要能够每秒处理数百个写入。

Every minute. So, at peak times we need to be able to process hundreds of writes a second.

然后,我们还有用户,以查询这些信息的形式,请给我来自最后一天或上周的device_id 1234的所有邮件。此外,用户做其他查询,给我所有的消息从device_1234速度大于50和日期是今天。

Then, we also have users, that are querying this information in the form of, give me all messages from device_id 1234 for the last day, or last week. Also, users do other querying like, give me all messages from device_1234 where speed is greater than 50 and date is today.

所以,我们最初的想法是MongoDB或Cassandra

So, our initial thoughts are that MongoDB or Cassandra are going to allow us to scale this much easier then using a traditional database.

MongoDB或Cassandra中的文档或值可能如下所示:

A document or value in MongoDB or Cassandra for us, might look like:

{
   device_id: 1234,
   location: [-118.12719739973545, 33.859012351859946],
   datetime: 1282274060,
   heading: "N",
   speed: 34
}

你推荐哪个系统?非常感谢。

Which system do you guys recommend? Thanks greatly.

推荐答案

MongoDB内置对地理空间索引的支持: http://www.mongodb.org/display/DOCS/Geospatial+Indexing

MongoDB has built-in support for geospatial indexes: http://www.mongodb.org/display/DOCS/Geospatial+Indexing

作为一个例子,为了找到距离那个位置最近的10个设备,你只需要做

As an example to find the 10 closest devices to that location you can just do

db.devices.find({location: {$near: [-118.12719739973545, 33.859012351859946]}}).limit(10)

这篇关于Cassandra或MongoDB我们的基于位置的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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