Redis入门

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“)

Redis is the most popular in-memory key-value data store. It is very lightweight and its data types give it an edge over other competitors. If you need an in-memory database or a high-performance cache system that is simple to use and highly scalable, Redis is what you should use. This book is a fast-paced guide that teaches you the fundamentals of data types, explains how to manage data through commands, and shares experiences from big players in the industry. What this book covers Chapter 1, Getting Started (The Baby Steps), shows you how to install Redis and how to use redis-cli, the default Redis command-line interface. It also shows you how to install Node.js and goes through a quick JavaScript syntax reference. The String, List, and Hash data types are covered in detail, along with examples of redis-cli and Node.js. Chapter 2, Advanced Data Types (Earning a Black Belt), is a continuation of the previous chapter. It presents the Set, Sorted Set, Bitmap, and HyperLogLog data types. All the examples here are implemented with redis-cli and Node.js. Chapter 3, Time Series (A Collection of Observations), uses all of the knowledge of data types from the previous chapters to build a time series library in Node.js. The examples are incremental; the library is initially implemented using the String data type, and then the solution is improved and optimized by using the Hash data type. Uniqueness support is added to the String and Hash implementations by using the Sorted Set and HyperLogLog data types, respectively. Preface [ viii ] Chapter 4, Commands (Where the Wild Things Are), introduces Pub/Sub, transactions, and pipelines. It also introduces the scripting mechanism, which uses the Lua programming language to extend Redis. A quick Lua syntax reference is also presented. A great variety of Redis commands are presented in this chapter, including the administration commands and data type commands that were not covered in the previous chapters. This chapter also shows you how to change Redis's configuration to optimize different data types for memory or performance. Chapter 5, Clients for Your Favorite Language (Become a Redis Polyglot), shows how to use Redis with PHP, Python, and Ruby. This chapter highlights the features that vary more frequently with clients in different languages: blocking commands, transactions, pipelines, and scripting. Chapter 6, Common Pitfalls (Avoiding Traps), illustrates some common mistakes when using Redis in a production environment and related stories from real-world companies. The pitfalls in this chapter include using the wrong data type for a given problem, using too much swap space, and using inefficient backup strategies. Chapter 7, Security Techniques (Guard Your Data), shows how to set up basic security with Redis, disable and obfuscate commands, protect Redis with firewall rules, and use client-to-server SSL encryption with stunnel. Chapter 8, Scaling Redis (Beyond a Single Instance), introduces RDB and AOF persistence, replication via Redis slaves, and different methods of partitioning data across different hosts. This chapter also shows how to use twemproxy to distribute Redis data across different instances transparently. Chapter 9, Redis Cluster and Redis Sentinel (Collective Intelligence), demonstrates the differences between Redis Cluster and Redis Sentinel, their goals, and how they fit into the CAP theorem. It also shows how to set up both Sentinel and Cluster, their configurations, and what happens in different failure scenarios. Redis Cluster is covered in more detail, since it is more complex and has different tools for managing a cluster of instances. Cluster administration is explained via native Redis commands and the redis-trib tool.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值