NOSQL中的Key_value模型
2013-03-14 14:46
134 查看
19 down vote | Are you familiar with the concept of a Key/Value Pair? Presuming you're familiar with Java or C# this is in the language as a map/hash/datatable/KeyValuePair (the last is in the case of C#) The way it works is demonstrated in this little sample chart: Color Red Age 18 Size Large Name Smith Title The Brown Dog Where you have a key (left) and a value (right) ... notice it can be a string, int, or the like. Most KVP objects allow you to store any object on the right, because it's just a value. Since you'll always have a unique key for a particular object that you want to return, you can just query the database for that unique key and get the results back from whichever node has the object (this is why it's good for distributed systems, since there's other things involved like polling for the first n nodes to return a value that match other nodes returns). Now my example above is very simple, so here's a slightly better version of the KVP user1923_color Red user1923_age 18 user3371_color Blue user4344_color Brackish user1923_height 6' 0" user3371_age 34 So as you can see the simple key generation is to put "user" the userunique number, an underscore and the object. Again, this is a simple variation, but I think we begin to understand that so long as we can define the part on the left and have it be consistently formatted, that we can pull out the value. Notice that there's no restriction on the key value (ok, there can be some limitations, such as text-only) or on the value property (there may be a size restriction) but so far I've not had really complex systems. Let's try and go a little further: app_setting_width 450 user1923_color Red user1923_age 18 user3371_color Blue user4344_color Brackish user1923_height 6' 0" user3371_age 34 error_msg_457 There is no file %1 here error_message_1 There is no user with %1 name 1923_name Jim user1923_name Jim Smith user1923_lname Smith Application_Installed true log_errors 1 install_path C:\Windows\System32\Restricted ServerName localhost test test test1 test test123 Brackish devonly wonderwoman value key You get the idea... all those would be stored in one massive "table" on the distributed nodes (there's math behind it all) and you would just ask the distributed system for the value you need by name. At the very least, that's my understanding of how it all works. I may have a few things wrong, but that's the basics. |
相关文章推荐
- 【iOS开发-60】案例学习:多组数据的tableView设置、添加右側组索引、多层数据模型设置以及valueForKeyPath
- 关系模型到 Key-Value 模型的映射
- Redis是一种面向“key-value”类型数据的分布式NoSQL数据库系统,具有高性能、持久存储、适应高并发应用场景等优势。它虽然起步较晚,但发展却十分迅速。
- 【iOS开发-60】案例学习:多组数据的tableView设置、增加右侧组索引、多层数据模型设置以及valueForKeyPath
- Key-Value键值存储原理初识(NOSQL)
- NoSql之key-value数据库------腾讯CKV海量分布式存储系统(其中有和memcache, redis的对比)
- 浅尝key-value数据库(一)——一览NoSQL
- 浅尝key-value数据库(一)——一览NoSQL
- 关于keyValueStore与普通数据存储之间的一种映射模型
- 自己实现基于key-value的NoSQL数据库(一)——起步,初版
- 自己实现基于key-value的NoSQL数据库(二)—— 改进存储方式和查询修改函数
- 自己实现基于key-value的NoSQL数据库(三)—— B+树和Hash算法
- 自己实现基于key-value的NoSQL数据库(四)—— 新版本的数据库
- Google的分布式计算模型Map Reduce map函数将输入分割成key/value对
- NoSQL之Redis高性能的key-value数据库深入浅出(分布式应用+简单微博系统)
- Mybatis select返回值为map时,选取表字段的两列作为key,value
- Joining an array of keys to a hash with key value pairs like excel vlookup
- Memcached expire 设置错误引起的set(key,exp,value)为true而get(key)为null的问题
- JavaScript实现dropdownlist选定值后将选定值的key与value填入两个textbox中
- How to sort a Map<Key, Value> on the values in Java?