RethinkDB是什么?—— 面向文档的NOSQL数据库,MVCC+Btree索引,pushes JSON to your apps in realtime采用push思路,优化的ssd存储
2017-02-13 09:36
1276 查看
RethinkDB是什么?
RethinkDB是新一代的面向文档的数据库存储管理系统,原本是MySQL中针对SSD优化的一个存储引擎,后来脱离了MySQL成为了独立的系统。
见:http://bokan.me/2016/05/10/rethinkdb-architecture/
RethinkDB最早是作为一个对SSD进行专门优化的MySQL存储引擎出现的,其特点在于对SSD的充分利用。而目前RethinkDB已经脱离MySQL成为一个独立的存储。RethinkDB是自底向上为实时网页设计的第一个开源的、分布式的、可扩展的数据库,具有强大的集群和自动故障转移功能。传统数据库使用的是一种查询——响应数据库访问模式。RethinkDB 在网络上工作的很好主要是因为它直接映射到 HTTP 的请求响应上面。
RethinkDB是第一个数据库使用了一种令人激动的新的数据库的访问模型,而不是轮询数据库更改,开发者可以命令RethinkDB实时的向应用连续推送更新查询结果。这使得搭建现代、实时的应用程序十分方便:开发者可以得到一个可扩展的实时Web应用程序的App,并在用一小部分时间运行的同时使用更少的工程资源。
Cloud Native Computing基金会称,RethinkDB数据库被数以百计的创业公司、咨询公司和财富五百强企业使用,其中包括NASA、GM、Jive、Platzi、美国国防部、Distractify和 Matters Media。
讨论二:RethinkDB还是MongoDB?
网友FlukyS:RethinkDB有超强的伸缩性,它可以处理PB级数据。不过,依据配置,这会导致可用性上做出些妥协,但是在我看来,用户有者很大的掌控权。一致性是RethinkDB考虑最弱的一点。RethinkDB的超级赞的是很易用。我只在开发阶段使用RethinkDB,因为后来公司决定采用MongoDB。
网友read_eat_or:可否问下你们(FlukyS)为什么放弃了RethinkDB,而选择了MongoDB?
网友FlukyS:坦率地说并不是我做的决定,我只是做了初期的测试,最后由经历决定。我认为可能是因为团队对MongoDB更熟悉吧,这是好几年前的决定,如果现在再来一次结果或许会不同。不管是使用RethinkDB还是MongDB,我们只是保存日志数据而已,并没有用于存放市场商用的数据。我们是读操作远多于写操作。
有一种观点是,RethinkDB是败给了MongoDB,那么或许你还可以再读读MongoDB的相关内容。
其官方介绍如下:
RethinkDB is the open-source, scalable database that makes building realtime apps dramatically easier.
What is RethinkDB?go
r.table('game').orderBy('score').limit(3).changes()
TOP PLAYER SCORES
connor: 81 points
marc: 79 points
mike: 73 points
samantha: 73 points
samantha: 64 points
STREAMING RETHINKDB RESULTS...
{'player': 'joe', 'score': 12}
{'player': 'eileen', 'score': 50}
{'player': 'marc', 'score': 79}
{'player': 'connor', 'score': 81}
{'player': 'brandon', 'score': 36}
{'player': 'grant', 'score': 29}
{'player': 'trevor', 'score': 63}
{'player': 'samantha', 'score': 73}
{'player': 'jessica', 'score': 12}
代码:
参考:https://rethinkdb.com/blog/rethinkdb-pubnub/
RethinkDB是新一代的面向文档的数据库存储管理系统,原本是MySQL中针对SSD优化的一个存储引擎,后来脱离了MySQL成为了独立的系统。
数据如何存储在磁盘上?
数据组织成B-Tree,且使用为rethinkdb定制的log-structured形式的存储引擎存储在磁盘上,这个存储引擎灵感来自BTRFS。这个存储引擎相比其他的存储引擎有很多优势,包括增量的且完全并发的垃圾压缩,低CPU开销和有效的多核操作,一些SSD优化,同时当电源故障后立即恢复,当故障时保证完全的数据一致性,支持MVCC这个存储引擎结合定制的,B-Tree可感知的缓存引擎一起使用,这个缓存引擎允许文件的大小比可用内存的大小多很多数量级。rethinkdb可工作在10GB内存的和1TB的数据上见:http://bokan.me/2016/05/10/rethinkdb-architecture/
RethinkDB最早是作为一个对SSD进行专门优化的MySQL存储引擎出现的,其特点在于对SSD的充分利用。而目前RethinkDB已经脱离MySQL成为一个独立的存储。RethinkDB是自底向上为实时网页设计的第一个开源的、分布式的、可扩展的数据库,具有强大的集群和自动故障转移功能。传统数据库使用的是一种查询——响应数据库访问模式。RethinkDB 在网络上工作的很好主要是因为它直接映射到 HTTP 的请求响应上面。
RethinkDB是第一个数据库使用了一种令人激动的新的数据库的访问模型,而不是轮询数据库更改,开发者可以命令RethinkDB实时的向应用连续推送更新查询结果。这使得搭建现代、实时的应用程序十分方便:开发者可以得到一个可扩展的实时Web应用程序的App,并在用一小部分时间运行的同时使用更少的工程资源。
Cloud Native Computing基金会称,RethinkDB数据库被数以百计的创业公司、咨询公司和财富五百强企业使用,其中包括NASA、GM、Jive、Platzi、美国国防部、Distractify和 Matters Media。
讨论二:RethinkDB还是MongoDB?
网友FlukyS:RethinkDB有超强的伸缩性,它可以处理PB级数据。不过,依据配置,这会导致可用性上做出些妥协,但是在我看来,用户有者很大的掌控权。一致性是RethinkDB考虑最弱的一点。RethinkDB的超级赞的是很易用。我只在开发阶段使用RethinkDB,因为后来公司决定采用MongoDB。
网友read_eat_or:可否问下你们(FlukyS)为什么放弃了RethinkDB,而选择了MongoDB?
网友FlukyS:坦率地说并不是我做的决定,我只是做了初期的测试,最后由经历决定。我认为可能是因为团队对MongoDB更熟悉吧,这是好几年前的决定,如果现在再来一次结果或许会不同。不管是使用RethinkDB还是MongDB,我们只是保存日志数据而已,并没有用于存放市场商用的数据。我们是读操作远多于写操作。
有一种观点是,RethinkDB是败给了MongoDB,那么或许你还可以再读读MongoDB的相关内容。
其官方介绍如下:
RethinkDB pushes JSON to your apps in realtime.
When your app polls for data, it becomes slow, unscalable, and cumbersome to maintain.RethinkDB is the open-source, scalable database that makes building realtime apps dramatically easier.
What is RethinkDB?go
r.table('game').orderBy('score').limit(3).changes()
TOP PLAYER SCORES
connor: 81 points
marc: 79 points
mike: 73 points
samantha: 73 points
samantha: 64 points
STREAMING RETHINKDB RESULTS...
{'player': 'joe', 'score': 12}
{'player': 'eileen', 'score': 50}
{'player': 'marc', 'score': 79}
{'player': 'connor', 'score': 81}
{'player': 'brandon', 'score': 36}
{'player': 'grant', 'score': 29}
{'player': 'trevor', 'score': 63}
{'player': 'samantha', 'score': 73}
{'player': 'jessica', 'score': 12}
代码:
var pubnub = require("pubnub"); var r = require("rethinkdb"); var pn = pubnub({ subscribe_key: "xxxxxxxxxxxxxxx", publish_key: "xxxxxxxxxxxxxxx", secret_key: "xxxxxxxxxxxxxxx" }); // Connect to a local RethinkDB database r.connect().then(function(conn) { // Attach a changefeed to the `updates` table return r.table("updates").changes()("new_val").run(conn); }) .then(function(changes) { // For each change emitted by the changefeed... changes.each(function(err, item) { // Publish the change through PubNub pn.publish({ channel: "updates", message: item, error: function(err) { console.log("Failed to send message:" , err); } }); }); });
参考:https://rethinkdb.com/blog/rethinkdb-pubnub/
相关文章推荐
- 创建存储过程错误(已解决):Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ver
- 盘点11个面向文档的开源NoSQL数据库
- How to monitor Nginx web server from the command line in real time
- 闪存存储特性以及数据库相关优化思路
- How to read out WhatsApp messages with Tasker and react on their content in real time
- How to implement realtime periodic tasks in Linux applications
- NoSQL数据库:Redis内存使用优化与存储
- Spinlock annotations merged from the realtime tree to Linux mainline in 2.6.33
- Add mappings to an Elasticsearch index in realtime
- How to run Android apps in tablet mode on your phone
- How to Change Timezone in your Linux System
- 11个面向文档的开源NoSQL数据库
- 盘点11个面向文档的开源NoSQL数据库
- How to connect to your Apple Time Capsule in Ubuntu
- How to get control of your time and your life (Alan Lakein.)
- 11个面向文档的开源NoSQL数据库
- How To Invest In Your Time
- 关于Microsoft Unified Communications Managed API 3.0开发的相关技术问题(RealTimeEndpoint, SipEndpoint, SipPeerToPeerEndpoint之间的区别是什么?)
- 什么时候面向文档NoSQL数据库可以代替SQL数据库
- 什么时候该使用NoSQL存储数据库?