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

Preview:

Citation preview

Mastering RedisA Primer

Data Masters

Special Thanks To…

Planet Linux Caffehttp://planetlinuxcaffe.com

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

DBTekPro

www.dbtekpro.com

andrew@dbtekpro.com@asimkovsky

Redis - Concept

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

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

Redis - Uses

Caching session data

Processing data at high speeds

Real-time data feeds

Where Do I Get It?

www.redis.io

Types of Data

Types of Data

Keys

Strings

Hashes

Lists

Sets

Sorted Sets

Queue

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

Types of Data

Stringsperson:12345 Joe

Hashesuser:1000 username smith password

p4ssw0rd9 age 34

Listsfriends:1000 123 897 567 891

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

Types of Data

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

Interacting With Redis

Command-line tool

redis-cli

Redis Commands

http://redis.io/commands

Transactions

Server-side scripting via Lua

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

Replication

Redis can support Master->Slave replication

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

Master

Slave Slave Slave

Where’s the Bad and the Ugly?

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

Interactive Tutorial

http://try.redis.io

Live Demo!

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

Configure And Start

Config file: /etc/redis.conf

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

status]

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

Welcome To The Machine!!

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

Questions?

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