logo资料库

Learning-Redis.pdf

第1页 / 共318页
第2页 / 共318页
第3页 / 共318页
第4页 / 共318页
第5页 / 共318页
第6页 / 共318页
第7页 / 共318页
第8页 / 共318页
资料共318页,剩余部分请下载后查看
Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Introduction to NoSQL
An Internet-enabled world
The NoSQL primer
Graph-oriented NoSQL
Document-oriented NoSQL
Salient features of MongoDB and CouchDB
Column-oriented NoSQL
Salient features of HBase and Cassandra
Key value-oriented NoSQL
How does Redis fare in some of the nonfunctional requirements as a key-value datastore?
Use cases of NoSQL
Summary
Chapter 2: Getting Started with Redis
Installing Redis on Windows
Installing Redis on Mac OS
Introduction to redis.conf
Hello World in Redis
Hello World using redis-cli
Hello World using Java
Installing Jedis and creating an environment
Writing the program
Shutting down the server
Load a test Hello World program in Redis
Summary
Chapter 3: Data Structures and Communicating Protocol in Redis
Data structures
Data types in Redis
The string data type
The BitSet or bitmap data type
Use case scenario
The Hashes data type
Use case scenario
Data type: lists
Use case scenario
The Sets data type
Use case scenario
Data type: Sorted Sets
Use case scenario
Communication protocol: RESP
Summary
Chapter 4: Functions in Redis Server
Real time messaging (PUB/SUB)
Pipeline in Redis
Transactions in Redis
Pipeline versus transaction
Pipeline and Transaction
Scripting in Redis
Brief introduction on Lua
Use case: reliable messaging
Connection management
Redis authentication
Redis SELECT
Redis ECHO and PING
Summary
Chapter 5: Handling Data in Redis
Classifying data
Master-slave data replication
Setting master and slave nodes
Performance pattern: high reads
Performance pattern: high writes
Persistence handling in Redis
Persisting via RDB option
Configuring Redis for RDB persistence
Use case for using RDB persistence
Persisting via AOF option
Configuring Redis for AOF persistence
Use case for using AOF persistence
Dataset handling commands in Redis
Summary
Chapter 6: Redis in Web Applications
Simple e-commerce: Redis backed e-commerce site
Session management
Catalogue management
Online analytics
Implementation: Simple E-Commerce
ProductApp
UserApp
RedisDBManager
ProductDBManager
AnalyticsDBManager
ShoppingCartDBManager
UserCartDBManager
Summary
Chapter 7: Redis in Business Applications
Configuration management
Gossip server
Node
Layered design
Listeners
The data handler layer
Client node commands
The register command
Implementation of RegisterCommand
Implementation of RegisterCommandHandler
The activate command
Implementation of ActivateCommand
Implementation of ActivateCommandHandler
The set command
Implementation of SetCommand
Implementation of SetCommandHandler
The get command
Implementation of GetCommand
Implementation of GetCommandHandler
The del command
Implementation of DeleteCommand
Implementation of DeleteCommandHandler
The status command
Implementation of StatusCommand
Implementation of StatusCommandHandler
The passivate command
Implementation of PassivateCommand
Implementation of PassivateCommandHandler
The reactivate command
Implementation of ReactivateCommand
Implementation of ReactivateCommandHandler
The archive command
Implementation of ArchiveCommand
Implementation of ArchiveCommandHandler
The sync command
Implementation of SyncCommand
Implementation of SyncCommandHandler
The reconnect command
Implementation of ReconnectCommand
Implementation of ReconnectCommandHandler
Master node commands
The start command
Implementation of StartMasterCommand
The stop command
Implementation of StopMasterCommand
The status command
Implementation of StatusCommand
Implementation of StatusCommandHandler
The get command
Implementation of GetNodeDataCommand
Implementation of GetNodeDataCommandHandler
The msg command
Implementation of MessageCommand
Implementation of MessageCommandHandler
The kill command
Implementation of KillNodeCommand
Implementation of KillNodeCommandHandler
The clone command
Implementation of CloneNodeCommand
Implementation of CloneNodeCommandHandler
Redis config: data management
The RDB option
AOF option
VM overcommit memory
Summary
Chapter 8: Clustering
Clusters
Cluster pattern: master-master
Performance
Availability
Scalability
Manageability
Security
Drawbacks of this pattern
Sharding
Observations
Cluster pattern: master-slave
Performance
Availability
Scalability
Manageability
Security
Drawbacks of this pattern
Configuring Redis Sentinel
Summary
Chapter 9: Maintaining Redis
Maintaining ephemeral data
Maintaining nonephemeral data
Redis 2.4
Redis 2.6 to 2.8
Dump and restore
Snapshotting
Redis 3.0
Summary
Index
Learning Redis Design efficient web and business solutions with Redis Vinoo Das BIRMINGHAM - MUMBAI
Learning Redis Copyright © 2015 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: June 2015 Production reference: 1230615 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78398-012-3 www.packtpub.com
Credits Project Coordinator Nidhi Joshi Proofreader Safis Editing Indexer Tejal Soni Graphics Abhinash Sahu Production Coordinator Aparna Bhagat Cover Work Aparna Bhagat Author Vinoo Das Reviewers Dan Cartoon Munish Kumar Gupta Paul Irwin Dae Myung Kang Jari Timonen Commissioning Editor Ashwin Nair Acquisition Editor Sonali Vernekar Content Development Editor Manasi Pandire Technical Editor Mohita Vyas Copy Editors Dipti Kapadia Alpha Singh
About the Author Vinoo Das has 16 years of experience in the software industry and has worked in various domains, such as telecom, banking, payment gateways, information management, and so on. He is highly motivated and loves to work on new and upcoming technologies. He is currently architecting a platform for an information technology giant, which will enable the company to position the platform at an enterprise level as well as a cloud solution. I would like to thank my parents and my family for supporting me. I would also like to thank my friends Lokendra and Kartikeya for helping me shape the book. I would also like to thank Packt Publishing and the editors Manasi Pandire and Mohita Vyas for their efforts in shaping up this book.
About the Reviewers Dan Cartoon grew up in Atlanta, Georgia, but now spends his time in the San Francisco Bay Area as a software engineer. He has worked at social and game- oriented software start-ups as well as at large companies. He enjoys working in the field of machine learning and building large-scale software systems. In his free time, he likes to play various musical instruments and take long walks on Northern California's foggy beaches. I would like to thank my wife for her patience while I spent even more time in front of the computer reviewing this book. I would also like to thank Salvatore Sanfilippo for creating Redis and releasing it to the world. Munish Kumar Gupta is a lead architect working for Wipro Technologies. Based in Bangalore, India, his day-to-day work involves solution architecture, application performance engineering, and helping enterprises adopt open source technologies. He is always looking for patterns while solving problems, writing code, and making optimum use of tools and frameworks. He is the author of Akka Essentials, Packt Publishing.
Dae Myung Kang lives in South Korea. He has more than 10 years of experience in the software industry. His interest lies in studying in-memory cache and storage. He currently works as a backend software engineer for Daum Kakao. He is also a keen contributor of Redis/Twemproxy and Apache Tajo. I would like to thank my wife, Suki, and my son, Hanyul. I will always love you. Jari Timonen is an experienced software enthusiast with over 10 years of experience in the software industry. His experience includes successful team leadership combined with understanding complex business domains and putting them into practice. He has built enterprise architectures, designed software, and programming. Having started his career in the finance industry, he currently works as a service architect in a telecommunications company. He practices pair programs and is keen on studying new technologies. When he is not building software, he is spending time with his family, fishing, exercising, or flying his radio-controlled model helicopter. He currently holds certifications that include Sun Certified Programmer for the Java 2 Platform, Standard Edition 5, Sun Certified Developer for the Java 2 Platform, Oracle Certified Master, and Java EE 5 Enterprise Architect.
www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
分享到:
收藏