SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
http://redis.io
Jim Gray
“MEMORY IS THE NEW
DISK. DISK IS THE NEW
TAPE.”
VAMOS FALAR DE
REDIS
Mas primeiro...
NOSQL
Mudança de paradigma
SQL?
Cada “problema” uma solução
mais adequada de persistência.
QUANDO USAR?
Cache
Stock prices
Sharding Directory Service
Real time data collection
Real time communication
Analytics
REDIS, QUE DIABOS
É ISSO?
CHAVE-VALOR
Estrutura de dados
CHAVE VALOR
user:1 name Ayrton age 23
user:2 name João phone 555-555
user:1:friends user:2 user:3 user:4 user:5
user:3 name José email xp@a.com
user:4 name Mario age 34
user:5 name Mara age 25
user:1:acess 140
user:1:token H13NDSME3MDSSR6MG6
CLIENTS PARA REDIS:
ActionScript
C
C#
C++
Clojure
Common Lisp
Erlang
Fancy
Go
Haskell
haXe
Io
Java
Lua
Node.js
Objective-C
Perl
PHP
Pure Data
Python
Ruby
Scala
Smaltalk
Tcl

KEYS
Você pesquisa pela chave.
Todas as chaves ficam na memória.
O(1)
Chaves longas, má idéia.
Chaves curtas, má idéia também.
Tente seguir um padrão.
No terminal...
Inicie o server:
Inicie o client:
Insira um registro:
REDIS DATA TYPES
String
Lists
Hashes
Sets
Sorted Sets
STRINGS
APPEND key value
DECR key
DECRBY key decrement
GET key
GETBIT key offset
GETRANGE key start end
GETSET key value
INCR key
INCRBY key increment
MGET key [key ...]
MSET key value [key value ...]
MSETNX key value [key value ...]
SET key value
SETBIT key offset value
SETEX key seconds value
SETNX key value
SETRANGE key offset value
STRLEN key
LISTS
BLPOP key [key ...] timeout
BRPOP key [key ...] timeout
BRPOPLPUSH source destination timeout
LINDEX key index
LINSERT key BEFORE|AFTER pivot value
LLEN key
LPOP key
LPUSH key value [value ...]
LPUSHX key value
LRANGE key start stop
LREM key count value
LSET key index value
LTRIM key start stop
RPOP key
RPOPLPUSH source destination
RPUSH key value [value ...]
RPUSHX key value
HASHES
HDEL key field [field ...]
HEXISTS key field
HGET key field
HGETALL key
HINCRBY key field increment
HKEYS key
HLEN key
HMGET key field [field ...]
HMSET key field value [field value ...]
HSET key field value
HSETNX key field value
HVALS key
SETS
SADD key member [member ...]
SCARD key
SDIFF key [key ...]
SDIFFSTORE destination key [key ...]
SINTER key [key ...]
SINTERSTORE destination key [key ...]
SISMEMBER key member
SMEMBERS key
SMOVE source destination member
SPOP key
SRANDMEMBER key
SREM key member [member ...]
SUNION key [key ...]
SUNIONSTORE destination key [key ...]
SORTED SETS
ZADD key score member [score] [member]
ZCARD key
ZCOUNT key min max
ZINCRBY key increment member
ZINTERSTORE destination numkeys key [key ...][WEIGHTS weight [weight ...]]
[AGGREGATE SUM|MIN|MAX]
ZRANGE key start stop [WITHSCORES]
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
ZRANK key member
ZREM key member [member ...]
ZREMRANGEBYRANK key start stop
ZREMRANGEBYSCORE key min max
ZREVRANGE key start stop [WITHSCORES]
ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
ZREVRANK key member
ZSCORE key member
ZUNIONSTORE destination numkeys key [key ...][WEIGHTS weight [weight ...]]
[AGGREGATE SUM|MIN|MAX]
SNAPSHOTTING
redis.conf:
save 900 1
save 300 10
save 60 10000
dbfilename dump.rdb
dir ./
Nome do arquivo:
Diretório do dump:
REPLICATION
slaveof <masterip> <masterport>
redis.conf:
masterauth <master-password>
SLAVE
SLAVE
requirepass <pass>MASTER
E MAIS...
DBSIZE
INFO
SLAVEOF host port
BGSAVE
FLUSHALL
FLUSHDB
SAVE
CODE...
REFERÊNCIAS
http://redis.io
http://www.slideshare.net/MaxwellDayvson/redis-e-as-facilidades-de-trabalhar-com-um-banco-de-dados-
nosql
http://www.slideshare.net/gleicon/lesprit-de-lescalier
http://www.paperplanes.de/2010/2/16/a_collection_of_redis_use_cases.html
http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in-redis.html

Mais conteúdo relacionado

Destaque

Ad server cassandra
Ad server cassandraAd server cassandra
Ad server cassandra
dist_bp
 
Key-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscanaKey-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscana
Matteo Baglini
 

Destaque (12)

Ad server cassandra
Ad server cassandraAd server cassandra
Ad server cassandra
 
Apache camel
Apache camelApache camel
Apache camel
 
Cassandra cql
Cassandra cqlCassandra cql
Cassandra cql
 
Teste unitário
Teste unitárioTeste unitário
Teste unitário
 
Gossip & Key Value Store
Gossip & Key Value StoreGossip & Key Value Store
Gossip & Key Value Store
 
Key-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscanaKey-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscana
 
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQLEstudo comparativo entr bancos RDBMS, NoSQL e NewSQL
Estudo comparativo entr bancos RDBMS, NoSQL e NewSQL
 
Scalable CSS Architecture
Scalable CSS ArchitectureScalable CSS Architecture
Scalable CSS Architecture
 
Sistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplosSistemas NoSQL, surgimento, características e exemplos
Sistemas NoSQL, surgimento, características e exemplos
 
NoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradasNoSQL: Introducción a las Bases de Datos no estructuradas
NoSQL: Introducción a las Bases de Datos no estructuradas
 
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados RelacionaisBanco de Dados Não Relacionais vs Banco de Dados Relacionais
Banco de Dados Não Relacionais vs Banco de Dados Relacionais
 
Introducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionaisIntroducao aos Bancos de Dados Não-relacionais
Introducao aos Bancos de Dados Não-relacionais
 

Semelhante a Tech Talk Buscapé - Redis

OWASP PHPIDS talk slides
OWASP PHPIDS talk slidesOWASP PHPIDS talk slides
OWASP PHPIDS talk slides
guestd34230
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the Field
MongoDB
 
RIPE64 - DNS and DNSSEC in the .se Zone
RIPE64 - DNS and DNSSEC in the .se ZoneRIPE64 - DNS and DNSSEC in the .se Zone
RIPE64 - DNS and DNSSEC in the .se Zone
pawal
 

Semelhante a Tech Talk Buscapé - Redis (20)

OWASP PHPIDS talk slides
OWASP PHPIDS talk slidesOWASP PHPIDS talk slides
OWASP PHPIDS talk slides
 
WebCamp: Developer Day: The Big, the Small and the Redis - Андрей Савченко
WebCamp: Developer Day: The Big, the Small and the Redis - Андрей СавченкоWebCamp: Developer Day: The Big, the Small and the Redis - Андрей Савченко
WebCamp: Developer Day: The Big, the Small and the Redis - Андрей Савченко
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
mar07-redis.pdf
mar07-redis.pdfmar07-redis.pdf
mar07-redis.pdf
 
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon run
 
Basic Cryptography & Security
Basic Cryptography & SecurityBasic Cryptography & Security
Basic Cryptography & Security
 
League of Graphs
League of GraphsLeague of Graphs
League of Graphs
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the Field
 
What we can learn from Rebol?
What we can learn from Rebol?What we can learn from Rebol?
What we can learn from Rebol?
 
Pki by Steve Lamb
Pki by Steve LambPki by Steve Lamb
Pki by Steve Lamb
 
Lighting talk neo4j fosdem 2011
Lighting talk neo4j fosdem 2011Lighting talk neo4j fosdem 2011
Lighting talk neo4j fosdem 2011
 
RIPE64 - DNS and DNSSEC in the .se Zone
RIPE64 - DNS and DNSSEC in the .se ZoneRIPE64 - DNS and DNSSEC in the .se Zone
RIPE64 - DNS and DNSSEC in the .se Zone
 
Redis — memcached on steroids
Redis — memcached on steroidsRedis — memcached on steroids
Redis — memcached on steroids
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
 
It's Not You. It's Your Data Model.
It's Not You. It's Your Data Model.It's Not You. It's Your Data Model.
It's Not You. It's Your Data Model.
 
XXE: How to become a Jedi
XXE: How to become a JediXXE: How to become a Jedi
XXE: How to become a Jedi
 
Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Tech Talk Buscapé - Redis

Notas do Editor

  1. Frase classica de todo slide nosql. Esse tio ai escreveu coisas relacionadas a BD e persistência. Turing Award in 1998 &amp;quot;for seminal contributions to database and transaction processing research and technical leadership in system implementation.&amp;quot; E desapareceu em 2007 no seu barco.
  2. Paradigma (do grego parádeigma) literalmente modelo, é a representação de um padrão a ser seguido.
  3. Uma característica importante do modelo chave-valor é que você pode pesquisar um dado apenas pela chave.  Esta condição obriga o programador a elaborar muito bem suas chaves.  Em contrapartida se obtém um comportamento O(1)no acesso aos dados, que na prática significa uma execução praticamente linear independente do volume de dados.
  4. O tipo mais basico de dado no redis.
  5. Boa opção pra mapear objetos mais complexos
  6. Caso set index iguais ele ordenara pela string,
  7. A cada X segundos se ao menos Y chaves forem criadas Nome do arquivo é: dump.rdb (pode ser modificado) Compressão usando LZF do dump para as strings