Redis Essentials
图书信息
| 作者 | Maxwell Dayvson Da Silva |
| 出版社 | Packt Publishing |
| ISBN | 9781784396084 |
| 出版时间 | 2015-09-08 |
| 字数 | 157.4万 |
| 分类 | 进口书,外文原版书,电脑,网络 |
读书简介
Harness the power of Redis to integrate and manage your projects efficiently About This Book Learn how to use Redis's data types efficiently to manage large data sets Scale Redis to multiple servers with Twemproxy, Redis Sentinel, and Redis Cluster A fast-paced guide, full of real-world examples to help you get the best out of the features offered by Redis Who This Book Is For If you are a competent developer with experience of working with data structure servers and want to boost your project's performance by learning about features of Redis, then this book is for you. What You Will Learn Build analytics applications using Bitmaps and Hyperloglogs Enhance scalability with Twemproxy, Redis Sentinel, and Redis Cluster Build a Time Series implementation in Node.js and Redis Create your own Redis commands by extending Redis with Lua Get to know security techniques to protect your data (SSL encryption, firewall rules, basic authorization) Persist data to disk and learn the trade-offs of AOF and RDB Understand how to use Node.js, PHP, Python, and Ruby clients for Redis Avoid common pitfalls when designing your next solution In Detail Redis is the most popular in-memory key-value data store. It’s very lightweight and its data types give it an edge over the 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 need. Redis Essentials is a fast-paced guide that teaches the fundamentals on data types, explains how to manage data through commands, and shares experiences from big players in the industry. We start off by explaining the basics of Redis followed by the various data types such as Strings, hashes, lists, and more. Next, Common pitfalls for various scenarios are described, followed by solutions to ensure you do not fall into common traps. After this, major differences between client implementations in PHP, Python, and Ruby are presented. Next, you will learn how to extend Redis with Lua, get to know security techniques such as basic authorization, firewall rules, and SSL encryption, and discover how to use Twemproxy, Redis Sentinel, and Redis Cluster to scale infrastructures horizontally. At the end of this book, you will be able to utilize all the essential features of Redis to optimize your project's performance. Style and approach A practical guide that offers the foundation upon which you can begin to understand the capabilities of Redis using a step-by-step approach. This book is full of real-world problems and in-depth knowledge of the concepts and features of Redis, with plenty of examples.
目录
Redis Essentials
Table of Contents
Redis Essentials
Credits
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started (The Baby Steps)
Installation
Installing from source
Hello Redis (command-line interface examples)
Installing Node.js
JavaScript syntax quick reference guide
Hello World with Node.js and Redis
Redis data types
Strings
String examples with redis-cli
Building a voting system with Strings using Node.js
Lists
List examples with redis-cli
Implementing a generic Queue System
Hashes
Using Hashes with redis-cli
A voting system with Hashes and Node.js
Summary
2. Advanced Data Types (Earning a Black Belt)
Sets
Set examples with redis-cli
Building a deal tracking system
Sorted Sets
Sorted Set examples with redis-cli
Building a leaderboard system for an online game
Bitmaps
Bitmap examples with redis-cli
Building web analytics
HyperLogLogs
Counting unique users – HyperLogLog versus Set
HyperLogLogs examples with redis-cli
Counting and retrieving unique website visits
Summary
3. Time Series (A Collection of Observations)
Building the foundation
Optimizing with Hashes
Adding uniqueness with Sorted Sets and HyperLogLog
Summary
4. Commands (Where the Wild Things Are)
Pub/Sub
Transactions
Pipelines
Scripting
Lua syntax basics
Redis meets Lua
Miscellaneous commands
INFO
DBSIZE
DEBUG SEGFAULT
MONITOR
CLIENT LIST and CLIENT SET NAME
CLIENT KILL
FLUSHALL
RANDOMKEY
EXPIRE and EXPIREAT
TTL and PTTL
PERSIST
SETEX
DEL
EXISTS
PING
MIGRATE
SELECT
AUTH
SCRIPT KILL
SHUTDOWN
OBJECT ENCODING
Data type optimizations
String
List
Set
Hash
Sorted Set
Measuring memory usage
Summary
5. Clients for Your Favorite Language (Become a Redis Polyglot)
PHP
The basic commands in PHP
The blocking commands in PHP
Pipelines in PHP
Transactions in PHP
Scripting in PHP
Python
The basic commands in Python
The blocking commands in Python
Pipelines in Python
Transactions in Python
Scripting in Python
Ruby
The basic commands in Ruby
The blocking commands in Ruby
Pipelines in Ruby
Transactions in Ruby
Scripting in Ruby
Summary
6. Common Pitfalls (Avoiding Traps)
The wrong data type for the job
The Set approach
The Bitmap approach
Multiple Redis databases
Keys without a namespace
Using Swap
Not planning and configuring the memory properly
An inappropriate persistence strategy
Summary
7. Security Techniques (Guard Your Data)
The basic security
Obfuscating critical commands
Networking security
Protecting Redis with firewall rules
Running Redis on the loopback network interface
Running Redis in a Virtual Private Cloud
Encrypting client-to-server communication
Running stunnel on both the server and the client
Running stunnel on the server and using a Redis client that supports SSL
Summary
8. Scaling Redis (Beyond a Single Instance)
Persistence
RDB (Redis Database)
AOF (Append-only File)
RDB versus AOF
Replication
Partitioning
Range partitioning
Hash partitioning
Presharding
Consistent hashing
Tagging
Data store versus cache
Implementations of Redis partitioning
Automatic sharding with twemproxy
Other architectures that use twemproxy
Summary
9. Redis Cluster and Redis Sentinel (Collective Intelligence)
The CAP theorem
Redis Sentinel
The basic Sentinel configuration
Connecting to Sentinel
Network partition (split-brain)
Redis Cluster
Hash slots
Hash tags
Creating a basic cluster
Finding nodes and redirects
Configuration
Different Redis Cluster architectures
Cluster administration
Creating a cluster
Adding slaves/replicas
Scaling reads using slave nodes
Adding nodes
Removing nodes
Redis Cluster administration using the redis-trib tool
Summary
Index
- 求知文库:世界经典寓言(张潜)
- 离散数学简明教程(朱怀宏)
- 诗书礼乐中的传统-陈致自选集(陈致)
- 应用文写作(倪斯雯)
- 2020年英文科技学术图书引证报告(上海交通大学)
- 智慧护理基本技能(夏立平,朱唯一)
- 财务管理学习指导、习题与项目实训 专著 陈昌才,朱文峰,袁萍主编 cai wu(陈昌才,朱文峰,袁萍)
- 王付经方十八反真传(王付主编)
