Reids 是一种NoSQL数据库。也就是非关系型数据库。
既然说到了NoSQL。就解释一下什么是NoSQL
什么是NoSQL
NoSQL是Not Only SQL。也就是说不仅仅是数据库。他跟关系型数据库是相辅相成的。也叫非关系型数据库。相辅相成就意味着他弥补了关系型数据库的缺点。也就是说关系型数据库已经不能满足需要了。主要体现在
1. 关系型数据库不能够很好的解决高并发的问题
2. 随着大数据的发展,数据的规模、多重化,大数据应用难题亟待解决。
因此就出现了这个非关系型数据库。
两者的区别
关系型数据库主要针对这个结构化数据。也就是针对这个企业级别。也就是说数据之间都存在着某种联系。
非关系型数据库主要针对非结构化数据。数据之间并没有什么联系。比如一个人的爱好,大数据通过这个人最近浏览的信息,推送给他响应的东西。两者之间并不存在什么关系。
出现非关系型数据库主要也是因为信息更倾向于个人,尤其是现在各种电商平台等,通过购物进行推送,通过爱好推荐绑定的商品。这些嗾使出现非关系型数据库的原因
因此NoSQL拥有的特点就是:
1. 易扩展
当一台服务器不够用时,很容易添加一个新的服务器,只要配置好环境之后就会自动的使用了。
2. 大数据量、高性能
读写的速度快,Nosql基本都是内存数据库,比硬盘上的肯定要快得多了。查询速度快
3. 灵活性
NoSQL无需事先为要存储的数据建立字段,随时可以存储自定义的数据格式。而在关系数据库里,增删字段是一件非常麻烦的事情。如果是非常大数据量的表,增加字段简直就是一个噩梦。加了几个字段相当于系统重写。这点在大数据量的web2.0时代尤其明显。
4. 高可用
一台服务器出了问题,不会影响其他的机器。
NoSQL分为四种
1. key-value
键值对存储,特点是快速查询、用于内容缓存及大量数据的高访问负载,主要就是Redis。主要的特点就是查询速度快
2. 列式存储
将同一列数据存在一起,比如qq我们两个都在一个讨论组类似这样的情况,主要用于文件系统。主要的应用 hbase,查询速度也是非常快
3. 图结构存储
用于社交网络 比如InfoGrid Neo4J。这个用的比较少了
4. 文档存储
典型用于web应用, 与key-value类似。比如MongoDB,如果是用爬虫的话这个MongoDB用的比较多
Redis是比较常用非关系型数据库了,以上呢是学习Redis的基本知识了。
学习书籍:
1. Learning Redis
2. Mastering Redis
3. Redis Essentials
网站:
1. [官方文档]( “http://redis.io/“)
2. [中文文档](“http://www.redis.cn“)
3. [中文手册](“http://redisdoc.com“)