Upgrade to Pro — share decks privately, control downloads, hide ads and more …

I am Redis

I am Redis

Redis everywhere: Spring Session, Redis Cache with Spring Boot, Redis used with logstash. But what is Redis? What can I do with it?

This talk takes away the mystery from Redis and will give you an introduction to what Redis is, what it does, the typical use cases and how to set up Redis.

Mark Paluch

June 09, 2016
Tweet

More Decks by Mark Paluch

Other Decks in Technology

Transcript

  1. I am Unless otherwise indicated, these slides are © 2013-2016

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Mark Paluch, Software Engineer, Pivotal Software Inc., lettuce Driver Project Lead @mp911de
  2. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Mark Paluch @mp911de github.com/mp911de paluch.biz
  3. Overview § 100% Open Source § Drivers provided by community

    § In-Memory Operations § Append Only File and Snapshots
  4. Redis Setup $ wget http://download.redis.io/releases/ redis-3.2.5.tar.gz | tar xzf -

    $ cd redis-3.2.5 $ make $ src/redis-server $ brew install redis $ docker run --name redis -d redis:alpine $ apt-get install redis-server
  5. Unless otherwise indicated, these slides are 
 © 2013-2016 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Redis Console Demo
  6. Running Redis § Redis Standalone (Single-Node, Master-Slave) § Redis Sentinel

    (Master/Slave Failover) § Redis Cluster (Sharding, Slaves)
  7. Redis Use-Cases § Key-Value store § Caching § Queues §

    High-speed data ingestion § Distributed Sessions § Distributed Locks § Real-Time Analytics § Geo-Indexing
  8. Redis: Datastructure Server § Key-Value § Hashes § Lists §

    Sorted Sets § Geospatial Index
 § Publish/Subscribe § HyperLogLog § Transactions § Scripting
  9. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SELECT firstname FROM people WHERE id = 7 key: 7 value: Mark key: people:7 field value firstname Mark
  10. Unless otherwise indicated, these slides are 
 © 2013-2016 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Java
  11. Unless otherwise indicated, these slides are 
 © 2013-2016 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Hibernate
  12. Unless otherwise indicated, these slides are 
 © 2013-2016 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data
  13. Redis API § 169 Commands § Full Client: 649 Methods

    § API grouped by features
 http://redis.io/commands
  14. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ hello w o r l d ✕ Sequence of bytes String
  15. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ hello w o r l d STRLEN GET SET APPEND SETRANGE GETRANGE String
  16. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ mysequence 1 2 3 4 5 String • Integer Value INCR INCRBY DECR DECRBY
  17. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ myfloat 1 . 2 3 4 String • Float Value INCRBYFLOAT
  18. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ people Alice Bob Alice ✕ Duplicates List ✕ Fast head/tail operations ✕ Ordered
  19. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ people Alice Bob Alice List RPUSH RPOP LPUSH LPOP LRANGE LTRIM LLEN LINSERT LINDEX LSET
  20. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ employees Alice Bob John ✕ Unique Set ✕ Set operations ✕ Unsorted
  21. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Set Bob Alice John Tom SCARD SMEMBERS SADD SREM SPOP SISMEMBER SUNION SINTER SDIFF SMOVE
  22. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ person:mark Hash ✕ Unique ✕ Map operations ✕ (Unsorted) Field Value Name Mark Ort Weinheim PLZ 69469
  23. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ person:mark Hash Field Value Name Mark Ort Weinheim PLZ 69469 HVALS HKEYS HGETALL HLEN HGET HMGET HSET HMSET HDEL HINCRBY
  24. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ backlock:story Sorted Set ✕ Unique ✕ Set operations ✕ Sorted (Score) Item Score Setup 10.0 Deployment 21.2 Caching 23423
  25. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ backlock:story Sorted Set Item Score Setup 10.0 Deployment 21.2 Caching 23423 ZADD ZRANGE ZREVRANGE ZRANGEBYLEX ZRANGEBYSCORE ZCOUNT ZLEXCOUNT ZRANK ZSCORE ZINCRBY ZCARD ZUNIONSTORE ZINTERSTORE
  26. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ locations Geo-Index ✕ Unique ✕ Geo operations ✕ Unsorted Paris 48.85, 2.27 Zürich 47.37, 8.46 Köln 50.95, 6.82
  27. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Geo-Index Frankfurt Paris Zürich GEOHASH GEOPOS ⦿ GEORADIUS GEOADD GEORADIUSBYMEMBER Mainz Winterthur ZREM GEODIST
  28. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ … Transactions ✕ Atomic ✕ Isolated ✕ Batch MULTI HINCRBY QUEUED GET QUEUED EXEC 1 • VALUE
  29. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Channels Pub/Sub ✕ Transient ✕ Decoupled from Keyspace ✕ Broadcast Channel Subscribers MyChannel 5 news.it.* 7
  30. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Pub/Sub SUBSCRIBE UNSUBSCRIBE PUBLISH Channel1 Channel2 Channel* PSUBSCRIBE PUNSUBSCRIBE Subscriber Subscriber Subscriber
  31. Resources § Slides: https://mp911.de/redis-en § Redis: http://redis.io § Code: https://github.com/mp911de/redis-intro

    § Jedis: https://github.com/xetorthio/jedis § lettuce: https://github.com/mp911de/lettuce § Redisson: https://github.com/mrniko/redisson § Hibernate OGM: http://hibernate.org/ogm/ § Spring Data Redis: http://projects.spring.io/spring-data-redis/