26
Mastering Redis A Primer Data Masters

Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Embed Size (px)

Citation preview

Page 1: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Mastering RedisA Primer

Data Masters

Page 2: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Special Thanks To…

Planet Linux Caffehttp://planetlinuxcaffe.com

Page 3: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Short bio about me… Andrew Simkovsky 15 years working with database technology Worked across many industries

Why Data Masters? Used to be a certification instructor – I miss

it! Sharing knowledge Fostering a community

Page 4: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

DBTekPro

www.dbtekpro.com

[email protected]@asimkovsky

Page 5: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Redis - Concept

What it is “NoSQL” Key-value store In-memory

What it’s not Definitely not “relational” Denormalization is your friend

Page 6: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Redis - Uses

Caching session data

Processing data at high speeds

Real-time data feeds

Page 7: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Where Do I Get It?

www.redis.io

Page 8: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data

Page 9: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data

Keys

Strings

Hashes

Lists

Sets

Sorted Sets

Queue

Page 10: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data - Keys

Identifier – to find your data

Converted to physical address in memory

Key can be any string of characters you want

123456

document:789456

Page 11: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data

Stringsperson:12345 Joe

Hashesuser:1000 username smith password

p4ssw0rd9 age 34

Listsfriends:1000 123 897 567 891

Page 12: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data

Sets

friends:1000 123 897 567 891

Sorted Sets

scores:1000 123/500 567/600 891/700 897/800

Another view

scores:1000123 / 500567 / 600891 / 700897 / 800

Page 13: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Types of Data

Queue Publisher queue Subscriber First-in, first-out (FIFO)

Page 14: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Interacting With Redis

Command-line tool

redis-cli

Redis Commands

http://redis.io/commands

Transactions

Server-side scripting via Lua

Page 15: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Programming Clients

ActionScript

C, C#, C++, Obj-C

Clojure

Common Lisp

D

Dart

Erlang

Go

Java

Lua

Node.js

Perl

PHP

Pure Data

Python

Ruby

Scala

Tcl

Full list at: www.redis.io/clients

Page 16: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Replication

Redis can support Master->Slave replication

Write to one master, keeps one or more slaves up to date

Master

Slave Slave Slave

Page 17: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Where’s the Bad and the Ugly?

Page 18: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Persistence

Redis is primarily an in-memory database

It is not really a “persistence” engine

All your data must fit in memory

Can configure persistence, but its not true long-term storage

Persistence is only for crash recovery

Page 19: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Interactive Tutorial

http://try.redis.io

Page 20: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Live Demo!

Page 21: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Installation

Red Hat / RPM-based systems (Red Hat, CentOS, Fedora) Yum install, exists in most of the basic yum

repositories

yum install redis

Debian-based systems (Ubuntu) Aptitude install, exists in most apt repositories

apt-get install redis

Zip file download from redis.io

Page 22: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Configure And Start

Config file: /etc/redis.conf

Start/stop uses service command: service redis [ start | stop | restart |

status]

Page 23: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Installing Yum Repository

Redis.io: Only source code

Get Yum repository from FedoraProject.org – Extra Packages for Enteprise Linux:

http://fedoraproject.org/wiki/EPEL

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install redis

Page 24: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Welcome To The Machine!!

You are not supposed to be here… Go watch the live demo!!

Page 25: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Questions?

Page 26: Mastering Redis A Primer Data Masters. Special Thanks To… Planet Linux Caffe

Thank You For Coming!

Please rate this Meet Up:www.meetup.com/data-masters

(or go there to join!)

Check out my blog and forums:www.dbtekpro.com

After Party!!Miller’s Ale House

Miracle Mile