Table of Contents
Mastering Redis
Credits
About the Author
About the Reviewers
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
The philosophy behind Redis
What this book covers
Earn your Mastering Redis Open Badge
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Why Redis?
Is Redis right for me?
Experimenting with Redis
Popular usage patterns
Redis isn't right because …try again soon!
Summary
2. Advanced Key Management and Data Structures
Redis keys
Redis key schema
Key delimiters and naming conventions
Manually creating a Redis schema
Deconstructing a Redis object mapper
Key expiration
Key cautions
Big O notation
Computing big O notation for custom code
Reviewing the time complexity of Redis data structures
Strings
Hashes
Lists
Sets
Sorted sets
Advanced sorted set operations
Bitstrings and bit operations
HyperLogLogs
Summary
3. Managing RAM – Tips and Techniques for Redis Memory Management
Configuring Redis
Master-slave
32-bit Redis
About the INFO memory
Key expiration
LRU key evictions
Creating memory efficient Redis data structures
Small aggregate hashes, lists, sets, and sorted sets
Bits, bytes, and Redis strings as random access arrays
Optimizing hashes for efficient storage
Hardware and network latencies
Operating system tips
Summary
4. Programming Redis Part One – Redis Core, Clients, and Languages
Redis internals
Understanding redis.h and redis.c
Getting ready for Redis development with Git
Exercise – creating your own redis command
Redis Serialization Protocol (RESP)
Pipelining
Redis RDB format
Coroutines using Redis and Python
Todo list application using Node.js and Redis
Replication and public access
Summary
5. Programming Redis Part Two – Lua Scripting, Administration, and DevOps
The use of Lua in Redis
Using KEYS and ARGV with Redis
Advanced Lua scripting with Redis
MARC21 ingestion
Online Storefront Paper Stationery
Interoperability using JSON-LD, Lua, and Redis
Redis Lua Debugger
Programming Redis administration topics
Master-Slave replication
Transactions with MULTI and EXEC
Redis role in DevOps
Summary
6. Scaling with Redis Cluster and Sentinel
Approaches to partitioning data
Range partitioning
List partitioning
Hash partitioning
Composite partitioning
Key hash tags
Clustering Redis with Twemproxy
Testing Twemproxy with Linked Data Fragments server
Redis Cluster background
Overview of running Redis Cluster
Using Redis Cluster
Live reconfiguration and resharding Redis cluster
Failover
Replacing or upgrading nodes in Redis Cluster
Monitoring with Redis Sentinel
Sentinel for Area Code List Partition
Summary
7. Redis and Complementary NoSQL Technologies
The proliferation of NoSQL
Redis as an analytics complement to MongoDB
Redis as a preprocessor complement to ElasticSearch
Using Redis and ElasticSearch in BIBCAT
ElasticSearch, Logstash, and Redis
Redis as a smart cache complement to Fedora Commons
Summary
8. Docker Containers and Cloud Deployments
Linux containers
Docker basics with Redis
Layers in Docker images
Docker filesystem backends
Building images with a Dockerfile
Hosting and publishing Docker images
Docker and Redis issues
Packaging your application with Docker Compose
Redis and AWS
Dedicated cloud hosting options
Redis Labs
DigitalOcean Redis
Summary
9. Task Management and Messaging Queuing
Overview of Redis Pub/Sub
Pub/Sub RESP replies
SUBSCRIBE and UNSUBSCRIBE RESP Arrays
PSUBSCRIBE and UNSUBSCRIBE arrays
Pub/Sub with Redis CLI
Redis Pub/Sub in action
First workstation using Python Pub/Sub
Second workstation Node.js Pub/Sub
Third workstation Lua Client Pub/Sub
Redis keyspace notifications
Task management with Redis and Celery
GIS and RestMQ
Adding task management with RestMQ
Messaging with Redis technologies
Messaging with Disque
Summary
10. Measuring and Managing Information Streams
Extracting, transforming, and loading information with Redis
Extracting JSON to transform into RESP
Security considerations when managing Redis
Redis protected mode
Command obfuscation
Operational monitoring with a Redis web dashboard
Machine learning and Redis
Naïve Bayes and work classification
Creating training and testing datasets
Extracting word Tokens from BIBFRAME Works
Applying Naïve Bayes
Linear regression with Redis
Summary
A. Sources
Chapter 1: Why Redis?
Chapter 2: Advanced Key Management and Data Structures
Chapter 3: Managing RAM – Tips and Techniques for Redis Memory Management
Chapter 6: Scaling with Redis Cluster and Sentinel
Chapter 7: Redis and Complementary NoSQL Technologies
Chapter 10: Measuring and Managing Information Streams
Index
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2016
Production reference: 1260516
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-818-1
www.packtpub.com
Author
Jeremy Nelson
Reviewers
Emilien Kenler
Saurabh Minni
Commissioning Editor
Kunal Parikh
Acquisition Editor
Harsha Bharwani
Content Development Editors
Kirti Patil
Mayur Pawanikar
Technical Editors
Utkarsha Kadam
Tanmayee Patil
Copy Editor
Merilyn Pereira
Project Coordinator
Nidhi Joshi
Proofreader
Safis Editing
Indexer
Rekha Nair
Graphics
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
2323__perle...