Redis for Dummies®, Limited Edition
Total Page:16
File Type:pdf, Size:1020Kb
These materials are © 2019 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Redis These materials are © 2019 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Redis Limited Edition by Steve Suehring These materials are © 2019 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Redis For Dummies®, Limited Edition Published by John Wiley & Sons, Inc. 111 River St. Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2019 by John Wiley & Sons, Inc., Hoboken, New Jersey No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, For Dummies, the Dummies Man logo, The Dummies Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services, or how to create a custom For Dummies book for your business or organization, please contact our Business Development Department in the U.S. at 877-409-4177, contact [email protected], or visit www.wiley.com/go/custompub. For information about licensing the For Dummies brand for products or services, contact Branded Rights&[email protected]. ISBN 978-1-119-52080-1 (pbk); ISBN 978-1-119-52083-2 (ebk) Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Publisher’s Acknowledgments Some of the people who helped bring this book to market include the following: Development Editor: Editorial Manager: Rev Mengle Elizabeth Kuball Business Development Copy Editor: Elizabeth Kuball Representative: Karen Hattan Executive Editor: Steve Hayes Production Editor: Siddique Shaik These materials are © 2019 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Table of Contents INTRODUCTION ............................................................................................... 1 About This Book ................................................................................... 1 Foolish Assumptions ............................................................................ 1 Icons Used in This Book ....................................................................... 2 Where to Go from Here ....................................................................... 2 CHAPTER 1: What Is Redis? ................................................................................ 3 Introducing NoSQL ............................................................................... 3 Defining NoSQL ............................................................................... 3 Identifying types of NoSQL databases ......................................... 4 Comparing NoSQL and relational databases .............................. 5 Seeing Where Redis Fits ...................................................................... 5 Multi-model databases .................................................................. 6 Data storage .................................................................................... 6 Data structure storage ................................................................... 6 CHAPTER 2: What Is Redis Used For? ......................................................... 7 Understanding the Components of Redis ......................................... 7 The server and the command-line interface ............................... 7 The client and drivers ..................................................................... 8 Databases, memory, and persistence .......................................... 8 Identifying How Redis Can Help You .................................................. 9 Personalization with session management ............................... 10 Social apps ..................................................................................... 10 Search ............................................................................................. 10 Redis in the Real World ...................................................................... 11 Caching ........................................................................................... 11 Large datasets ............................................................................... 11 Full-text search .............................................................................. 11 Geospatial and time-series data ................................................. 12 Messaging/queuing ...................................................................... 12 CHAPTER 3: Using Multi-Model Redis: Data Models, Structures, and Modules ..................................................... 13 Understanding the Redis Data Models ............................................ 14 Strings and bitmaps ...................................................................... 14 Lists ................................................................................................. 16 Sets ................................................................................................. 17 Table of Contents v These materials are © 2019 John Wiley & Sons, Inc. Any dissemination, distribution, or unauthorized use is strictly prohibited. Hashes ............................................................................................ 18 Sorted sets ..................................................................................... 19 HyperLogLog ................................................................................. 20 Patterns and Data Structures ........................................................... 21 Pub/sub .......................................................................................... 21 Geospatial ...................................................................................... 22 Streams .......................................................................................... 22 Modules ............................................................................................... 23 Redis Graph ................................................................................... 23 RediSearch ..................................................................................... 23 Redis TimeSeries ........................................................................... 24 CHAPTER 4: Redis Architecture and Topology ................................. 25 Understanding Clustering and High Availability ............................. 25 Redis Enterprise cluster architecture ......................................... 26 High availability ............................................................................. 26 Running Redis at scale ................................................................. 27 Redis on Flash ............................................................................... 28 Examining Transactions and Durability ........................................... 28 ACID ................................................................................................ 28 Durability........................................................................................ 29 CHAPTER 5: Using Redis Enterprise Cloud and Software ........ 31 Understanding Redis Enterprise ...................................................... 31 Redis Enterprise Software on Docker ......................................... 33 Redis Cloud .................................................................................... 33 Getting Started with Redis Enterprise.............................................