SlideShare une entreprise Scribd logo
1  sur  25
Presenter: Mubashar Iqbal
Software Engineer
Classical variant - store data in a relational database:
• MySQL
• PostgreSQL
• H2
• SQLite and many more...
Modern trend in a Web programming:
• Store data in NoSQL databases
Databases
• Non-relational database management system
• Did not expose the standard SQL interface
• Does not conform to ACID
• Working with a huge quantity of data
• Does not require a relational model
• Distributed, fault-tolerant architecture
NoSQL Introduction
Categories of NoSQL Databases

Key-Value
Memcached, Redis, Riak

Column Family
Cassandra, HBase

Document
MongoDB, CouchDB

Graph
Neo4j, InfoGrid
Redis

Redis means Remote Dictionary Server

Open Source

Key-Value Data store

Data structure server

In-Memory Dataset

Written in ANSI C and Sponsored by Pivotal.
http://redis.io/topics/introduction
Why and when you should use Redis?

Caching

Master-slave replication, automatic failover

High-IO workloads

Distributed Locks

Data that expires

Cookie storage

Analytics

Ad Targeting

Search engines

Small Data

Bigger Data

Forums
Who is using Redis?
http://redis.io/topics/whos-using-redis
Storing lots of Pinterest lists in Redis
Next time you log in to Pinterest, remember that Redis is
running in the background and storing several types of lists for
you as a user:

A list of users who you follow

A list of boards (and their related users) who you follow

A list of your followers

A list of people who follow your boards

A list of boards you follow

A list of boards you unfollowed after following a user

The followers and unfollowers of each board
Installation
Linux:
1. $ wget http://download.redis.io/releases/redis-2.8.9.tar.gz
2. $ tar xzf redis-2.8.9.tar.gz
3. $ cd redis-2.8.9
4. $ make
5. $ sudo make install
6. $ cd utils
7. $ sudo ./install_server.sh
Windows:
1. Download the latest .exe package from
http://github.com/MSOpenTech/redis
2. Running the exe will install Redis as a service and install
the Redis client.
Configuration
Redis is able to start without a configuration file using a
built-in default configuration.
The proper way to configure Redis is by providing a Redis
configuration file, usually called redis.conf.

Port: 6379

Timeout: 300

Maxclients 10000

Maxmemory <bytes>

Save 900 1
Running Redis Server and Client
Once the script completes, the redis-server will be running
in the background.
You can start and stop redis with these commands.
sudo service redis_6379 start
sudo service redis_6379 stop
Access the redis database by typing the following
command.
redis-cli
Redis Clients

Phpredis – Redis client written in C for PHP.

Redis-py – Mature Redis client for Python.

Redis-rb – Very stable & Muture Client for Rubys

Scala-redis – Mature Redis client for Scala

Node_redis – Recommended client for node.

Jedis – Java client library for Redis.

Eredis – A Redis erlang client library.
Example Code
Write a simple php script to test redis php client:
<?php
$redis=new Redis() or die("Can't load redis client.");
$redis->connect('127.0.0.1', 6379);
$redis->set('set_testkey', 1);
?>
Parameters:
Host: string. can be a host, or the path to a unix domain socket
Port: int, optional
Return value:
BOOL: TRUE on success, FALSE on error.
Redis Data Types
Redis is often referred to as a data structure server since
keys can contain:

Strings

Lists

Sets

Hashes

Sorted Sets
http://redis.io/topics/data-types
Strings

Most basic kind of Redis value

Binary safe - can contain any kind of data

Max 512 Megabytes in length

Can be used as atomic counters using commands in the
INCR family
APPEND – Append a value to a key
GET – Get the value of a key
SET – Set the string value of a key
MGET – Get the values of all the given keys
MSET – Set multiple keys to multiple values
Lists

Lists of strings, sorted by insertion order

Add elements to a Redis List pushing new elements on the
head (on the left) or on the tail (on the right) of the list
LSET – Set the value of an element in a list by its index
LLEN – Get the length of a list
LREM – Remove elements from a list
LINSERT – Insert an element before or after another
element in a list
LRANGE – Get a range of elements from a list
LPOP – Remove and get the first element in a list
RPOP – Remove and get the last element in a list
Sets

Redis Sets are an unordered collection of Strings.

You can track unique things using Redis Sets.
SADD – Add one or more members to a set
SISMEMBER – Determine if a given value is a member of a set
SMEMBERS – Get all the members in a set
SPOP – Remove and return a random member from a set
SRANDMEMBER – Get one or multiple random members from a
set
SREM – Remove one or more members from a set
Hashes

Map between string fields and string values

Every hash can store more than 4 billion field-value pairs.
HSET – Set the string value of a hash field
HGET – Get the value of a hash field
HMGET – Get the values of all the given hash fields
HMSET – Set multiple hash fields to multiple values
HLEN – Get the number of fields in a hash
HKEYS – Get all the fields in a hash
HGETALL – Get all the fields and values in a hash
Sorted Sets

Every member of a Sorted Set is associated with score,
that is used in order to take the sorted set ordered, from
the smallest to the greatest score

You can do a lot of tasks with great performance that are
really hard to model in other kind of databases

Probably the most advanced Redis data type
ZADD – Add one or more members to a sorted set, or update its
score if it already exists
ZREM – Remove one or more members from a sorted set
ZRANGE – Return a range of members in a sorted set, by index
ZINCRBY – Increment the score of a member in a sorted set
Replication
Master-slave replication that allows slave Redis servers to
be exact copies of master servers.

A master can have multiple slaves.

Slaves are able to accept connections from other slaves.

Replication can be used both for scalability and for data
redundancy.

Slave instance facility for scaling out read requests or
mitigate a disaster recovery scenario.
Setup the Master Server
To configure replication is very simple just add the following
line to the slave configuration file:
slaveof 192.168.1.1 6379
Replace 192.168.1.1 6379 with your master IP address and
port.
Replication only needs to be defined on Slave systems, the
Master server does not require any special configuration.
Performance
Popularity of Redis:

Speed

Rich semantics

Stability

Durability / Persistence
- Redis snapshots
- Append-only file (AOF)
Comparison
Resources
1. http://www.redis.io
2. http://bencane.com/2013/11/12/installing-redis-
and-setting-up-master-slave-replication/
3. http://oldblog.antirez.com/post/redis-memcached-
benchmark.html
4. http://oldblog.antirez.com/post/update-on-
memcached-redis-benchmark.html
5. http://blog.gopivotal.com/pivotal/case-studies-
2/using-redis-at-pinterest-for-billions-of-relationships
Redis NoSQL (Key-value) Database

Contenu connexe

En vedette

PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...
 PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо... PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...
PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...it-people
 
Geek Academy Week 3 :: Redis for developer
Geek Academy Week 3 :: Redis for developerGeek Academy Week 3 :: Redis for developer
Geek Academy Week 3 :: Redis for developerSomkiat Puisungnoen
 
TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma Badoo Development
 
TechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, ErlyvideoTechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, ErlyvideoBadoo Development
 
TechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, BadooTechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, BadooBadoo Development
 
TechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ruTechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ruBadoo Development
 

En vedette (6)

PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...
 PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо... PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...
PostgreSQL: вчера, сегодня, завтра, Олег Бартунов, Postgres Professional, Мо...
 
Geek Academy Week 3 :: Redis for developer
Geek Academy Week 3 :: Redis for developerGeek Academy Week 3 :: Redis for developer
Geek Academy Week 3 :: Redis for developer
 
TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma
 
TechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, ErlyvideoTechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, Erlyvideo
 
TechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, BadooTechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, Badoo
 
TechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ruTechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ru
 

Dernier

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 

Dernier (20)

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 

Redis NoSQL (Key-value) Database

  • 2. Classical variant - store data in a relational database: • MySQL • PostgreSQL • H2 • SQLite and many more... Modern trend in a Web programming: • Store data in NoSQL databases Databases
  • 3. • Non-relational database management system • Did not expose the standard SQL interface • Does not conform to ACID • Working with a huge quantity of data • Does not require a relational model • Distributed, fault-tolerant architecture NoSQL Introduction
  • 4. Categories of NoSQL Databases  Key-Value Memcached, Redis, Riak  Column Family Cassandra, HBase  Document MongoDB, CouchDB  Graph Neo4j, InfoGrid
  • 5. Redis  Redis means Remote Dictionary Server  Open Source  Key-Value Data store  Data structure server  In-Memory Dataset  Written in ANSI C and Sponsored by Pivotal. http://redis.io/topics/introduction
  • 6. Why and when you should use Redis?  Caching  Master-slave replication, automatic failover  High-IO workloads  Distributed Locks  Data that expires  Cookie storage  Analytics  Ad Targeting  Search engines  Small Data  Bigger Data  Forums
  • 7. Who is using Redis? http://redis.io/topics/whos-using-redis
  • 8. Storing lots of Pinterest lists in Redis Next time you log in to Pinterest, remember that Redis is running in the background and storing several types of lists for you as a user:  A list of users who you follow  A list of boards (and their related users) who you follow  A list of your followers  A list of people who follow your boards  A list of boards you follow  A list of boards you unfollowed after following a user  The followers and unfollowers of each board
  • 9. Installation Linux: 1. $ wget http://download.redis.io/releases/redis-2.8.9.tar.gz 2. $ tar xzf redis-2.8.9.tar.gz 3. $ cd redis-2.8.9 4. $ make 5. $ sudo make install 6. $ cd utils 7. $ sudo ./install_server.sh Windows: 1. Download the latest .exe package from http://github.com/MSOpenTech/redis 2. Running the exe will install Redis as a service and install the Redis client.
  • 10. Configuration Redis is able to start without a configuration file using a built-in default configuration. The proper way to configure Redis is by providing a Redis configuration file, usually called redis.conf.  Port: 6379  Timeout: 300  Maxclients 10000  Maxmemory <bytes>  Save 900 1
  • 11. Running Redis Server and Client Once the script completes, the redis-server will be running in the background. You can start and stop redis with these commands. sudo service redis_6379 start sudo service redis_6379 stop Access the redis database by typing the following command. redis-cli
  • 12. Redis Clients  Phpredis – Redis client written in C for PHP.  Redis-py – Mature Redis client for Python.  Redis-rb – Very stable & Muture Client for Rubys  Scala-redis – Mature Redis client for Scala  Node_redis – Recommended client for node.  Jedis – Java client library for Redis.  Eredis – A Redis erlang client library.
  • 13. Example Code Write a simple php script to test redis php client: <?php $redis=new Redis() or die("Can't load redis client."); $redis->connect('127.0.0.1', 6379); $redis->set('set_testkey', 1); ?> Parameters: Host: string. can be a host, or the path to a unix domain socket Port: int, optional Return value: BOOL: TRUE on success, FALSE on error.
  • 14. Redis Data Types Redis is often referred to as a data structure server since keys can contain:  Strings  Lists  Sets  Hashes  Sorted Sets http://redis.io/topics/data-types
  • 15. Strings  Most basic kind of Redis value  Binary safe - can contain any kind of data  Max 512 Megabytes in length  Can be used as atomic counters using commands in the INCR family APPEND – Append a value to a key GET – Get the value of a key SET – Set the string value of a key MGET – Get the values of all the given keys MSET – Set multiple keys to multiple values
  • 16. Lists  Lists of strings, sorted by insertion order  Add elements to a Redis List pushing new elements on the head (on the left) or on the tail (on the right) of the list LSET – Set the value of an element in a list by its index LLEN – Get the length of a list LREM – Remove elements from a list LINSERT – Insert an element before or after another element in a list LRANGE – Get a range of elements from a list LPOP – Remove and get the first element in a list RPOP – Remove and get the last element in a list
  • 17. Sets  Redis Sets are an unordered collection of Strings.  You can track unique things using Redis Sets. SADD – Add one or more members to a set SISMEMBER – Determine if a given value is a member of a set SMEMBERS – Get all the members in a set SPOP – Remove and return a random member from a set SRANDMEMBER – Get one or multiple random members from a set SREM – Remove one or more members from a set
  • 18. Hashes  Map between string fields and string values  Every hash can store more than 4 billion field-value pairs. HSET – Set the string value of a hash field HGET – Get the value of a hash field HMGET – Get the values of all the given hash fields HMSET – Set multiple hash fields to multiple values HLEN – Get the number of fields in a hash HKEYS – Get all the fields in a hash HGETALL – Get all the fields and values in a hash
  • 19. Sorted Sets  Every member of a Sorted Set is associated with score, that is used in order to take the sorted set ordered, from the smallest to the greatest score  You can do a lot of tasks with great performance that are really hard to model in other kind of databases  Probably the most advanced Redis data type ZADD – Add one or more members to a sorted set, or update its score if it already exists ZREM – Remove one or more members from a sorted set ZRANGE – Return a range of members in a sorted set, by index ZINCRBY – Increment the score of a member in a sorted set
  • 20. Replication Master-slave replication that allows slave Redis servers to be exact copies of master servers.  A master can have multiple slaves.  Slaves are able to accept connections from other slaves.  Replication can be used both for scalability and for data redundancy.  Slave instance facility for scaling out read requests or mitigate a disaster recovery scenario.
  • 21. Setup the Master Server To configure replication is very simple just add the following line to the slave configuration file: slaveof 192.168.1.1 6379 Replace 192.168.1.1 6379 with your master IP address and port. Replication only needs to be defined on Slave systems, the Master server does not require any special configuration.
  • 22. Performance Popularity of Redis:  Speed  Rich semantics  Stability  Durability / Persistence - Redis snapshots - Append-only file (AOF)
  • 24. Resources 1. http://www.redis.io 2. http://bencane.com/2013/11/12/installing-redis- and-setting-up-master-slave-replication/ 3. http://oldblog.antirez.com/post/redis-memcached- benchmark.html 4. http://oldblog.antirez.com/post/update-on- memcached-redis-benchmark.html 5. http://blog.gopivotal.com/pivotal/case-studies- 2/using-redis-at-pinterest-for-billions-of-relationships